diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/apr | |
Diffstat (limited to 'vcpkg/ports/apr')
| -rw-r--r-- | vcpkg/ports/apr/0100-add-host-tools-dir.diff | 23 | ||||
| -rw-r--r-- | vcpkg/ports/apr/portfile.cmake | 117 | ||||
| -rw-r--r-- | vcpkg/ports/apr/unglue.patch | 17 | ||||
| -rw-r--r-- | vcpkg/ports/apr/unofficial-apr-config.cmake | 19 | ||||
| -rw-r--r-- | vcpkg/ports/apr/usage-cmake | 19 | ||||
| -rw-r--r-- | vcpkg/ports/apr/vcpkg.json | 30 |
6 files changed, 225 insertions, 0 deletions
diff --git a/vcpkg/ports/apr/0100-add-host-tools-dir.diff b/vcpkg/ports/apr/0100-add-host-tools-dir.diff new file mode 100644 index 0000000..c38d897 --- /dev/null +++ b/vcpkg/ports/apr/0100-add-host-tools-dir.diff @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d16eec6..92146f4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -87,13 +87,17 @@ STRING(REGEX REPLACE ".*#define APR_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" APR_PAT + + CONFIGURE_FILE(include/apr.hwc + ${PROJECT_BINARY_DIR}/apr.h) + + ADD_EXECUTABLE(gen_test_char tools/gen_test_char.c) + ++set(UNOFFICIAL_APR_HOST_TOOLS_DIR "$<TARGET_FILE_DIR:gen_test_char>" CACHE STRING "") ++set(UNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX "$<TARGET_PROPERTY:gen_test_char,SUFFIX>" CACHE STRING "") ++install(TARGETS gen_test_char) ++ + ADD_CUSTOM_COMMAND( + COMMENT "Generating character tables, apr_escape_test_char.h, for current locale" + DEPENDS gen_test_char +- COMMAND $<TARGET_FILE:gen_test_char> > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h ++ COMMAND "${UNOFFICIAL_APR_HOST_TOOLS_DIR}/gen_test_char${UNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX}" > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h + OUTPUT ${PROJECT_BINARY_DIR}/apr_escape_test_char.h + ) + ADD_CUSTOM_TARGET( diff --git a/vcpkg/ports/apr/portfile.cmake b/vcpkg/ports/apr/portfile.cmake new file mode 100644 index 0000000..a8ed343 --- /dev/null +++ b/vcpkg/ports/apr/portfile.cmake @@ -0,0 +1,117 @@ +vcpkg_download_distfile(ARCHIVE + URLS "https://downloads.apache.org/apr/apr-${VERSION}.tar.bz2" + FILENAME "apr-${VERSION}.tar.bz2" + SHA512 629b60680d1244641828019db903a1b199e8a19c8f27a5132b93faacb381ce561f88463345ab019258f1f1e8cfdf8aa986ac815153a8e7e04a22b3932f9fedd2 +) + +vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + unglue.patch + 0100-add-host-tools-dir.diff +) + +set(CURRENT_HOST_TOOLS_DIR "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}") + +set(CROSSCOMPILING_OPTIONS "") +if(VCPKG_CROSSCOMPILING) + list(APPEND CROSSCOMPILING_OPTIONS + "-DUNOFFICIAL_APR_HOST_TOOLS_DIR=${CURRENT_HOST_TOOLS_DIR}" + "-DUNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX=${VCPKG_HOST_EXECUTABLE_SUFFIX}" + ) +endif() + +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + private-headers APR_INSTALL_PRIVATE_H + ) + + string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" APR_BUILD_STATIC) + string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" APR_BUILD_SHARED) + + vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DAPR_BUILD_STATIC=${APR_BUILD_STATIC} + -DAPR_BUILD_SHARED=${APR_BUILD_SHARED} + -DAPR_BUILD_TESTAPR=OFF + -DINSTALL_PDB=OFF + -DMIN_WINDOWS_VER=Windows7 + -DAPR_HAVE_IPV6=ON + ${FEATURE_OPTIONS} + ${CROSSCOMPILING_OPTIONS} + ) + + vcpkg_cmake_install() + vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/apr") + file( + INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-apr-config.cmake" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-apr" + ) + # There is no way to suppress installation of the headers in debug builds. + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + vcpkg_copy_tools(TOOL_NAMES gen_test_char AUTO_CLEAN) + + vcpkg_copy_pdbs() + + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage-cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME usage) +else() + # To cross-compile you will need a triplet file that locates the tool chain and sets --host and --cache parameters of "./configure". + # The ${VCPKG_PLATFORM_TOOLSET}.cache file must have been generated on the targeted host using "./configure -C". + # For example, to target aarch64-linux-gnu, triplets/aarch64-linux-gnu.cmake should contain (beyond the standard content): + # set(VCPKG_PLATFORM_TOOLSET aarch64-linux-gnu) + # set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${MY_CROSS_DIR}/cmake/Toolchain-${VCPKG_PLATFORM_TOOLSET}.cmake) + # set(CONFIGURE_PARAMETER_1 --host=${VCPKG_PLATFORM_TOOLSET}) + # set(CONFIGURE_PARAMETER_2 --cache-file=${MY_CROSS_DIR}/autoconf/${VCPKG_PLATFORM_TOOLSET}.cache) + if(CONFIGURE_PARAMETER_1) + message(STATUS "Configuring apr with ${CONFIGURE_PARAMETER_1} ${CONFIGURE_PARAMETER_2} ${CONFIGURE_PARAMETER_3}") + else() + message(STATUS "Configuring apr") + endif() + set(ENV{CFLAGS} "$ENV{CFLAGS} -Wno-error=implicit-function-declaration") + vcpkg_configure_make( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "--prefix=${CURRENT_INSTALLED_DIR}" + "${CONFIGURE_PARAMETER_1}" + "${CONFIGURE_PARAMETER_2}" + "${CONFIGURE_PARAMETER_3}" + ) + + vcpkg_install_make() + + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/apr-1.pc" + "-lapr-\${APR_MAJOR_VERSION}" "-lapr-1" + ) + endif() + + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/apr-1.pc" + "-lapr-\${APR_MAJOR_VERSION}" "-lapr-1" + ) + vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES pthread rt dl uuid crypt) + + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/apr-1-config" "\"${CURRENT_INSTALLED_DIR}\"" "$(realpath \"`dirname $0`/../../..\")") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/apr-1-config" "APR_SOURCE_DIR=\"${SOURCE_PATH}\"" "") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/apr-1-config" "APR_BUILD_DIR=\"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel\"" "") + + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/build-1/libtool" "${CURRENT_INSTALLED_DIR}/lib" "" IGNORE_UNCHANGED) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/build-1/libtool" "${CURRENT_INSTALLED_DIR}/debug/lib" "" IGNORE_UNCHANGED) + + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/build-1/apr_rules.mk" "${CURRENT_INSTALLED_DIR}" "$(INCLUDE)/..") + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/apr-1-config" "\"${CURRENT_INSTALLED_DIR}/debug\"" "$(realpath \"`dirname $0`/../../../..\")") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/apr-1-config" "APR_SOURCE_DIR=\"${SOURCE_PATH}\"" "") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/apr-1-config" "APR_BUILD_DIR=\"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg\"" "") + + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/build-1/libtool" "${CURRENT_INSTALLED_DIR}/lib" "" IGNORE_UNCHANGED) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/build-1/libtool" "${CURRENT_INSTALLED_DIR}/debug/lib" "" IGNORE_UNCHANGED) + + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/build-1/apr_rules.mk" "${CURRENT_INSTALLED_DIR}/debug" "$(INCLUDE)/..") + endif() + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +endif() + +# Handle copyright +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/apr/unglue.patch b/vcpkg/ports/apr/unglue.patch new file mode 100644 index 0000000..0ce518b --- /dev/null +++ b/vcpkg/ports/apr/unglue.patch @@ -0,0 +1,17 @@ +diff --git a/include/apr_version.h b/include/apr_version.h +index e96de3835..de3437d71 100644 +--- a/include/apr_version.h ++++ b/include/apr_version.h +@@ -114,9 +114,9 @@ + + /** An alternative formatted string of APR's version */ + /* macro for Win32 .rc files using numeric csv representation */ +-#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \ +- ##APR_MINOR_VERSION ##, \ +- ##APR_PATCH_VERSION ++#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION , \ ++ APR_MINOR_VERSION , \ ++ APR_PATCH_VERSION + + + #ifndef APR_VERSION_ONLY diff --git a/vcpkg/ports/apr/unofficial-apr-config.cmake b/vcpkg/ports/apr/unofficial-apr-config.cmake new file mode 100644 index 0000000..a7ed87e --- /dev/null +++ b/vcpkg/ports/apr/unofficial-apr-config.cmake @@ -0,0 +1,19 @@ +message(WARNING "find_package(unofficial-apr) is deprecated.\nUse find_package(apr) instead")
+include(CMakeFindDependencyMacro)
+find_dependency(apr CONFIG)
+
+if(TARGET apr::apr-1 AND NOT TARGET unofficial::apr::apr-1)
+ add_library(unofficial::apr::apr-1 INTERFACE IMPORTED)
+ target_link_libraries(unofficial::apr::apr-1 INTERFACE apr::apr-1)
+elseif(TARGET apr::libapr-1 AND NOT TARGET unofficial::apr::libapr-1)
+ add_library(unofficial::apr::libapr-1 INTERFACE IMPORTED)
+ target_link_libraries(unofficial::apr::libapr-1 INTERFACE apr::libapr-1)
+endif()
+
+if(TARGET apr::aprapp-1 AND NOT TARGET unofficial::apr::aprapp-1)
+ add_library(unofficial::apr::aprapp-1 INTERFACE IMPORTED)
+ target_link_libraries(unofficial::apr::aprapp-1 INTERFACE apr::aprapp-1)
+elseif(TARGET apr::libaprapp-1 AND NOT TARGET unofficial::apr::libaprapp-1)
+ add_library(unofficial::apr::libaprapp-1 INTERFACE IMPORTED)
+ target_link_libraries(unofficial::apr::libaprapp-1 INTERFACE apr::libaprapp-1)
+endif()
diff --git a/vcpkg/ports/apr/usage-cmake b/vcpkg/ports/apr/usage-cmake new file mode 100644 index 0000000..0430db5 --- /dev/null +++ b/vcpkg/ports/apr/usage-cmake @@ -0,0 +1,19 @@ +APR provides CMake targets whose names will start with the 'lib' prefix in shared configurations, while static configurations will not:
+
+ find_package(apr CONFIG REQUIRED)
+
+ # Use the shared configuration
+ target_link_libraries(main PRIVATE apr::apr-1 apr::libaprapp-1)
+
+ # Use the static configuration
+ target_link_libraries(main PRIVATE apr::apr-1 apr::aprapp-1)
+
+To ensure compatibility with both static and shared configurations:
+
+ find_package(apr CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE
+ $<$<TARGET_EXISTS:apr::apr-1>:apr::apr-1>
+ $<$<TARGET_EXISTS:apr::aprapp-1>:apr::aprapp-1>
+ $<$<TARGET_EXISTS:apr::libapr-1>:apr::libapr-1>
+ $<$<TARGET_EXISTS:apr::libaprapp-1>:apr::libaprapp-1>
+ )
diff --git a/vcpkg/ports/apr/vcpkg.json b/vcpkg/ports/apr/vcpkg.json new file mode 100644 index 0000000..13c8e15 --- /dev/null +++ b/vcpkg/ports/apr/vcpkg.json @@ -0,0 +1,30 @@ +{ + "name": "apr", + "version": "1.7.6", + "description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.", + "homepage": "https://apr.apache.org/", + "license": "Apache-2.0", + "supports": "!uwp & !mingw", + "dependencies": [ + { + "name": "apr", + "host": true, + "platform": "windows" + }, + { + "name": "vcpkg-cmake", + "host": true, + "platform": "windows" + }, + { + "name": "vcpkg-cmake-config", + "host": true, + "platform": "windows" + } + ], + "features": { + "private-headers": { + "description": "Install non-standard files required for building Apache httpd" + } + } +} |