Skip to content

Commit

Permalink
Merge pull request #10 from RyeMutt/rye/universal
Browse files Browse the repository at this point in the history
Update libapr to 1.7.5 and add macOS universal build support
  • Loading branch information
RyeMutt authored Dec 10, 2024
2 parents 945d742 + 7cf8f8d commit d7f1d87
Show file tree
Hide file tree
Showing 59 changed files with 4,032 additions and 2,413 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
os: [windows-2022, macos-12, ubuntu-22.04]
os: [windows-2022, macos-15, ubuntu-22.04]
addrsize: ["64"]
continue-on-error: false
runs-on: ${{ matrix.os }}
Expand All @@ -20,10 +20,10 @@ jobs:
- name: Setup Apt Packages
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
run: |
sudo apt-get update
sudo apt-get -y install autoconf automake autopoint gettext
- uses: secondlife/action-autobuild@v4
- uses: secondlife/action-autobuild@v5
with:
addrsize: ${{ matrix.addrsize }}
release:
Expand Down
11 changes: 5 additions & 6 deletions apr-util/build/apu-conf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,16 @@ AC_ARG_WITH([expat],
# Add given path to standard search paths if appropriate:
if test "$withval" != "/usr"; then
APR_ADDTO(LDFLAGS, [-L$withval/lib])
APR_ADDTO(CPPFLAGS, [-I$withval/include])
APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
APR_ADDTO(CPPFLAGS, [-I$withval/include/expat])
APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/expat])
APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
fi
APU_TRY_EXPAT_LINK([Expat 1.95.x], apu_cv_expat_system,
[expat.h], [-lexpat])
fi
])
if test $apu_try_external_expat = 1; then
APU_SYSTEM_EXPAT
fi
APR_ADDTO(APRUTIL_EXPORT_LIBS, [$apu_expat_libs])
APR_ADDTO(APRUTIL_LIBS, [$apu_expat_libs])
Expand Down
23 changes: 23 additions & 0 deletions apr/CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
-*- coding: utf-8 -*-
Changes for APR 1.7.5

*) Unix: Implement apr_shm_perms_set() for the "POSIX shm_open()"
and "classic mmap" shared memory implementations. [Joe Orton,
Ruediger Pluem]

*) Fix missing ';' for XML/HTML hex entities from apr_escape_entity().
[Yann Ylavic]

*) Fix crash in apr_pool_create() with --enable-pool-debug=all|owner.
[Yann Ylavic]

*) Improve platform detection by updating config.guess and config.sub.
[Rainer Jung]

*) CMake: Add support for CMAKE_WARNING_AS_ERROR. [Ivan Zhakov]

*) CMake: Enable support for MSVC runtime library selection by abstraction.
[Ivan Zhakov]

*) CMake: Export installed targets (libapr-1, apr-1, libaprapp-1, aprapp-1)
to apr:: namespace. [Ivan Zhakov]

Changes for APR 1.7.4

*) Fix a regression where writing to a file opened with both APR_FOPEN_APPEND
Expand Down
187 changes: 135 additions & 52 deletions apr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,45 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(APR C)

# Enable support for MSVC runtime library selection by abstraction
# if supported by CMake.
IF(POLICY CMP0091)
CMAKE_POLICY(SET CMP0091 NEW)
ENDIF()

# Add simple support CMAKE_WARNING_AS_ERROR if CMake doesn't
# support it.
IF (CMAKE_VERSION VERSION_LESS 3.24)
IF(CMAKE_WARNING_AS_ERROR AND MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
ENDIF()
ENDIF()

SET(apr_name apr-1)
SET(apr_libname libapr-1)

OPTION(APR_INSTALL_PRIVATE_H "Install selected private .h files (for httpd)" OFF)
OPTION(APR_HAVE_IPV6 "IPv6 support" ON)
OPTION(INSTALL_PDB "Install .pdb files (if generated)" ON)
OPTION(APR_BUILD_TESTAPR "Build the test suite" OFF)
OPTION(APR_BUILD_SHARED "Build shared libraries" ON)
OPTION(APR_BUILD_STATIC "Build static libraries" ON)
OPTION(TEST_STATIC_LIBS "Test programs use APR static libraries instead of shared libraries?" OFF)
SET(MIN_WINDOWS_VER "Vista"
CACHE STRING "Minimum Windows version")

SET(APR_INSTALL_BIN_DIR "bin" CACHE STRING "Install subdirectory for binary files")
SET(APR_INSTALL_LIB_DIR "lib" CACHE STRING "Install subdirectory for library files")
SET(APR_INSTALL_INCLUDE_DIR "include" CACHE STRING "Install subdirectory for include files")

IF(NOT APR_BUILD_SHARED AND NOT APR_BUILD_STATIC)
MESSAGE(FATAL_ERROR "Both APR_BUILD_SHARED and APR_BUILD_STATIC have been disabled")
ENDIF()

IF(NOT APR_BUILD_STATIC AND TEST_STATIC_LIBS)
MESSAGE(FATAL_ERROR "APR_BUILD_STATIC has been disabled, but TEST_STATIC_LIBS is enabled")
ENDIF()

# create 1-or-0 representation of feature tests for apr.h

SET(apr_have_ipv6_10 0)
Expand All @@ -47,6 +78,13 @@ ELSE()
SET(win32_winnt_str ${MIN_WINDOWS_VER})
ENDIF()

# Read current version.
FILE(STRINGS include/apr_version.h VERSION_STRINGS REGEX "#define (APR_MAJOR_VERSION|APR_MINOR_VERSION|APR_PATCH_VERSION)")

STRING(REGEX REPLACE ".*#define APR_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" APR_MAJOR_VERSION ${VERSION_STRINGS})
STRING(REGEX REPLACE ".*#define APR_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" APR_MINOR_VERSION ${VERSION_STRINGS})
STRING(REGEX REPLACE ".*#define APR_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" APR_PATCH_VERSION ${VERSION_STRINGS})

CONFIGURE_FILE(include/apr.hwc
${PROJECT_BINARY_DIR}/apr.h)

Expand All @@ -71,11 +109,11 @@ ADD_CUSTOM_TARGET(
# you've generated apr.h before using a different build

SET(APR_INCLUDE_DIRECTORIES
${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include/arch/win32
${CMAKE_CURRENT_SOURCE_DIR}/include/arch/unix
${CMAKE_CURRENT_SOURCE_DIR}/include/private
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/arch/win32>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/arch/unix>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/private>
)

SET(APR_SYSTEM_LIBS
Expand Down Expand Up @@ -261,28 +299,62 @@ SET(APR_TEST_SUITES
SET(install_targets)
SET(install_bin_pdb)

IF (MSVC)
# Ignore Microsoft's interpretation of secure development
# and the POSIX string handling API
ADD_COMPILE_DEFINITIONS(_CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS)
ENDIF()

# libapr-1 is shared, apr-1 is static
ADD_LIBRARY(libapr-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libapr.rc)
SET(install_targets ${install_targets} libapr-1)
SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libapr-1.pdb)
TARGET_LINK_LIBRARIES(libapr-1 ${APR_SYSTEM_LIBS})
SET_TARGET_PROPERTIES(libapr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_EXPORT;WINNT")
ADD_DEPENDENCIES(libapr-1 test_char_header)

ADD_LIBRARY(apr-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED})
SET(install_targets ${install_targets} apr-1)
TARGET_LINK_LIBRARIES(apr-1 ${APR_SYSTEM_LIBS})
SET_TARGET_PROPERTIES(apr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;WINNT")
ADD_DEPENDENCIES(apr-1 test_char_header)
IF (APR_BUILD_SHARED)
ADD_LIBRARY(${apr_libname} SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libapr.rc)
LIST(APPEND install_targets ${apr_libname})
LIST(APPEND install_bin_pdb ${PROJECT_BINARY_DIR}/${apr_libname}.pdb)
TARGET_LINK_LIBRARIES(${apr_libname}
PRIVATE ${APR_SYSTEM_LIBS})
TARGET_COMPILE_DEFINITIONS(${apr_libname}
PRIVATE "APR_DECLARE_EXPORT;WINNT"
INTERFACE "APR_DECLARE_IMPORT;WINNT")
TARGET_INCLUDE_DIRECTORIES(${apr_libname}
PRIVATE ${APR_INCLUDE_DIRECTORIES}
INTERFACE $<INSTALL_INTERFACE:${APR_INSTALL_INCLUDE_DIR}> ${APR_INCLUDE_DIRECTORIES}
)
ADD_DEPENDENCIES(${apr_libname} test_char_header)
ENDIF()

IF (APR_BUILD_STATIC)
ADD_LIBRARY(${apr_name} STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED})
LIST(APPEND install_targets ${apr_name})
TARGET_LINK_LIBRARIES(${apr_name}
PRIVATE ${APR_SYSTEM_LIBS})
TARGET_COMPILE_DEFINITIONS(${apr_name}
PRIVATE "APR_DECLARE_STATIC;WINNT"
INTERFACE "APR_DECLARE_STATIC;WINNT")
TARGET_INCLUDE_DIRECTORIES(${apr_name}
PRIVATE ${APR_INCLUDE_DIRECTORIES}
INTERFACE $<INSTALL_INTERFACE:${APR_INSTALL_INCLUDE_DIR}> ${APR_INCLUDE_DIRECTORIES}
)
ADD_DEPENDENCIES(${apr_name} test_char_header)
ENDIF()

# libaprapp-1 and aprapp-1 are static
ADD_LIBRARY(libaprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED})
SET(install_targets ${install_targets} libaprapp-1)
SET_TARGET_PROPERTIES(libaprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_APP;WINNT")
IF (APR_BUILD_SHARED)
ADD_LIBRARY(libaprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED})
LIST(APPEND install_targets libaprapp-1)
SET_TARGET_PROPERTIES(libaprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_APP;WINNT")
TARGET_INCLUDE_DIRECTORIES(libaprapp-1
PRIVATE ${APR_INCLUDE_DIRECTORIES}
)
ENDIF()

ADD_LIBRARY(aprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED})
SET(install_targets ${install_targets} aprapp-1)
SET_TARGET_PROPERTIES(aprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;APR_APP;WINNT")
IF (APR_BUILD_STATIC)
ADD_LIBRARY(aprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED})
LIST(APPEND install_targets aprapp-1)
SET_TARGET_PROPERTIES(aprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;APR_APP;WINNT")
TARGET_INCLUDE_DIRECTORIES(aprapp-1
PRIVATE ${APR_INCLUDE_DIRECTORIES}
)
ENDIF()

IF(APR_BUILD_TESTAPR)
ENABLE_TESTING()
Expand All @@ -300,21 +372,16 @@ IF(APR_BUILD_TESTAPR)
${PROJECT_BINARY_DIR}/data/mmap_datafile.txt)

IF(TEST_STATIC_LIBS)
SET(whichapr apr-1)
SET(whichapr ${apr_name})
SET(whichaprapp aprapp-1)
SET(apiflag -DAPR_DECLARE_STATIC)
ELSE()
SET(whichapr libapr-1)
SET(whichapr ${apr_libname})
SET(whichaprapp libaprapp-1)
SET(apiflag)
ENDIF()

ADD_EXECUTABLE(testapp test/testapp.c)
TARGET_LINK_LIBRARIES(testapp ${whichapr} ${whichaprapp} ${APR_SYSTEM_LIBS})
TARGET_LINK_LIBRARIES(testapp ${whichapr} ${whichaprapp})
SET_TARGET_PROPERTIES(testapp PROPERTIES LINK_FLAGS /entry:wmainCRTStartup)
IF(apiflag)
SET_TARGET_PROPERTIES(testapp PROPERTIES COMPILE_FLAGS ${apiflag})
ENDIF()
ADD_TEST(NAME testapp COMMAND testapp)

SET (APR_TEST_SOURCES
Expand All @@ -327,27 +394,21 @@ IF(APR_BUILD_TESTAPR)
ENDFOREACH()

ADD_EXECUTABLE(testall ${APR_TEST_SOURCES})
TARGET_LINK_LIBRARIES(testall ${whichapr} ${APR_SYSTEM_LIBS})
TARGET_LINK_LIBRARIES(testall ${whichapr} ws2_32.lib)
SET_TARGET_PROPERTIES(testall PROPERTIES COMPILE_DEFINITIONS "BINPATH=$<TARGET_FILE_DIR:testall>")
IF(apiflag)
SET_TARGET_PROPERTIES(testall PROPERTIES COMPILE_FLAGS ${apiflag})
ENDIF()

FOREACH(test ${APR_TEST_SUITES})
ADD_TEST(NAME ${test} COMMAND testall -v ${test})
ENDFOREACH()

ADD_LIBRARY(mod_test MODULE test/mod_test.c)
TARGET_LINK_LIBRARIES(mod_test ${whichapr} ${APR_SYSTEM_LIBS})
TARGET_LINK_LIBRARIES(mod_test ${whichapr})
SET_PROPERTY(TARGET mod_test APPEND PROPERTY LINK_FLAGS /export:print_hello)
# nasty work-around for difficulties adding more than one additional flag
# (they get joined in a bad way behind the scenes)
GET_PROPERTY(link_flags TARGET mod_test PROPERTY LINK_FLAGS)
SET(link_flags "${link_flags} /export:count_reps")
SET_TARGET_PROPERTIES(mod_test PROPERTIES LINK_FLAGS ${link_flags})
IF(apiflag)
SET_TARGET_PROPERTIES(mod_test PROPERTIES COMPILE_FLAGS ${apiflag})
ENDIF()

# Build all the single-source executable files with no special build
# requirements.
Expand All @@ -371,11 +432,10 @@ IF(APR_BUILD_TESTAPR)
FOREACH(sourcefile ${single_source_programs})
STRING(REGEX REPLACE ".*/([^\\]+)\\.c" "\\1" proggie ${sourcefile})
ADD_EXECUTABLE(${proggie} ${sourcefile})
TARGET_LINK_LIBRARIES(${proggie} ${whichapr} ${APR_SYSTEM_LIBS})
TARGET_LINK_LIBRARIES(${proggie} ${whichapr})
SET_TARGET_PROPERTIES(${proggie} PROPERTIES COMPILE_DEFINITIONS "BINPATH=$<TARGET_FILE_DIR:${proggie}>")
IF(apiflag)
SET_TARGET_PROPERTIES(${proggie} PROPERTIES COMPILE_FLAGS ${apiflag})
ENDIF()

ADD_DEPENDENCIES(testall ${proggie})
ENDFOREACH()

# Add tests for programs that run by themselves with no arguments.
Expand All @@ -401,20 +461,38 @@ IF(APR_BUILD_TESTAPR)
ENDIF (APR_BUILD_TESTAPR)

# Installation
INCLUDE(CMakePackageConfigHelpers)

string(TOLOWER "${PROJECT_NAME}" project_name_lower)

INSTALL(TARGETS ${install_targets}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${project_name_lower}-config-version.cmake"
VERSION ${APR_MAJOR_VERSION}.${APR_MINOR_VERSION}.${APR_PATCH_VERSION}
COMPATIBILITY SameMajorVersion
)

INSTALL(TARGETS ${install_targets} EXPORT apr-config
RUNTIME DESTINATION ${APR_INSTALL_BIN_DIR}
LIBRARY DESTINATION ${APR_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${APR_INSTALL_LIB_DIR}
)

INSTALL(EXPORT apr-config
NAMESPACE apr::
DESTINATION "lib/cmake/${project_name_lower}"
FILE "${project_name_lower}-config.cmake"
)

INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${project_name_lower}-config-version.cmake"
DESTINATION "lib/cmake/${project_name_lower}"
)

IF(INSTALL_PDB)
INSTALL(FILES ${install_bin_pdb}
DESTINATION bin
DESTINATION ${APR_INSTALL_BIN_DIR}
CONFIGURATIONS RelWithDebInfo Debug)
ENDIF()

INSTALL(FILES ${APR_PUBLIC_HEADERS_STATIC} ${APR_PUBLIC_HEADERS_GENERATED} DESTINATION include)
INSTALL(FILES ${APR_PUBLIC_HEADERS_STATIC} ${APR_PUBLIC_HEADERS_GENERATED} DESTINATION ${APR_INSTALL_INCLUDE_DIR})
IF(APR_INSTALL_PRIVATE_H)
# Kludges for unexpected dependencies of httpd 2.x, not installed by default
SET(APR_PRIVATE_H_FOR_HTTPD
Expand All @@ -423,8 +501,8 @@ IF(APR_INSTALL_PRIVATE_H)
include/arch/win32/apr_arch_utf8.h
include/arch/win32/apr_private.h
)
INSTALL(FILES ${APR_PRIVATE_H_FOR_HTTPD} DESTINATION include/arch/win32)
INSTALL(FILES include/arch/apr_private_common.h DESTINATION include/arch)
INSTALL(FILES ${APR_PRIVATE_H_FOR_HTTPD} DESTINATION ${APR_INSTALL_INCLUDE_DIR}/arch/win32)
INSTALL(FILES include/arch/apr_private_common.h DESTINATION ${APR_INSTALL_INCLUDE_DIR}/arch)
ENDIF()

STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
Expand All @@ -436,9 +514,14 @@ MESSAGE(STATUS "")
MESSAGE(STATUS " Build type ...................... : ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS " Install .pdb (if available)...... : ${INSTALL_PDB}")
MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS " Directory for binary files .... : PREFIX/${APR_INSTALL_BIN_DIR}")
MESSAGE(STATUS " Directory for library files ... : PREFIX/${APR_INSTALL_LIB_DIR}")
MESSAGE(STATUS " Directory for include files ... : PREFIX/${APR_INSTALL_INCLUDE_DIR}")
MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
MESSAGE(STATUS " IPv6 ............................ : ${APR_HAVE_IPV6}")
MESSAGE(STATUS " Minimum Windows version ......... : ${MIN_WINDOWS_VER}")
MESSAGE(STATUS " Build shared libs ............... : ${APR_BUILD_SHARED}")
MESSAGE(STATUS " Build static libs ............... : ${APR_BUILD_STATIC}")
MESSAGE(STATUS " Build test suite ................ : ${APR_BUILD_TESTAPR}")
IF(TEST_STATIC_LIBS)
MESSAGE(STATUS " (testing static libraries)")
Expand Down
Loading

0 comments on commit d7f1d87

Please sign in to comment.