2016-11-03 21:06:02 +08:00
|
|
|
|
2024-09-04 02:51:48 +08:00
|
|
|
set(VERSION 1.7.5)
|
2017-11-02 07:35:07 +08:00
|
|
|
|
2016-11-03 21:06:02 +08:00
|
|
|
vcpkg_download_distfile(ARCHIVE
|
2023-02-03 07:46:55 +08:00
|
|
|
URLS "https://archive.apache.org/dist/apr/apr-${VERSION}.tar.bz2"
|
2017-11-02 07:35:07 +08:00
|
|
|
FILENAME "apr-${VERSION}.tar.bz2"
|
2024-09-04 02:51:48 +08:00
|
|
|
SHA512 d8a7553642da0c81261ac3992536efd9d43ecb9154934ef1a10ae808d6a3ce8198b40433091d3a6d04f61e67c59426fb5276193a37e810ae4bc74a8a10fb651b
|
2016-11-03 21:06:02 +08:00
|
|
|
)
|
2019-10-08 01:35:13 +08:00
|
|
|
|
2023-03-20 14:36:01 +08:00
|
|
|
vcpkg_extract_source_archive(SOURCE_PATH
|
2021-11-09 13:07:51 +08:00
|
|
|
ARCHIVE "${ARCHIVE}"
|
2022-05-13 10:36:04 +08:00
|
|
|
PATCHES
|
2022-07-29 05:54:27 +08:00
|
|
|
unglue.patch
|
2019-10-08 01:35:13 +08:00
|
|
|
)
|
2016-11-03 21:06:02 +08:00
|
|
|
|
2020-05-07 04:20:49 +08:00
|
|
|
if (VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
2021-07-21 01:24:58 +08:00
|
|
|
FEATURES
|
2022-05-13 10:36:04 +08:00
|
|
|
private-headers APR_INSTALL_PRIVATE_H
|
2020-05-07 04:20:49 +08:00
|
|
|
)
|
2019-03-13 04:37:08 +08:00
|
|
|
|
2024-09-04 02:51:48 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" APR_BUILD_STATIC)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" APR_BUILD_SHARED)
|
|
|
|
|
2021-11-09 13:07:51 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2020-05-07 04:20:49 +08:00
|
|
|
OPTIONS
|
2024-09-04 02:51:48 +08:00
|
|
|
-DAPR_BUILD_STATIC=${APR_BUILD_STATIC}
|
|
|
|
-DAPR_BUILD_SHARED=${APR_BUILD_SHARED}
|
|
|
|
-DAPR_BUILD_TESTAPR=OFF
|
2020-05-07 04:20:49 +08:00
|
|
|
-DINSTALL_PDB=OFF
|
|
|
|
-DMIN_WINDOWS_VER=Windows7
|
|
|
|
-DAPR_HAVE_IPV6=ON
|
|
|
|
${FEATURE_OPTIONS}
|
|
|
|
)
|
2016-11-03 21:06:02 +08:00
|
|
|
|
2021-11-09 13:07:51 +08:00
|
|
|
vcpkg_cmake_install()
|
2024-09-04 02:51:48 +08:00
|
|
|
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"
|
|
|
|
)
|
2020-05-07 04:20:49 +08:00
|
|
|
# There is no way to suppress installation of the headers in debug builds.
|
2021-11-09 13:07:51 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
2016-11-03 21:06:02 +08:00
|
|
|
|
2020-05-07 04:20:49 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2024-09-10 11:22:46 +08:00
|
|
|
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage-cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME usage)
|
2016-11-04 03:08:24 +08:00
|
|
|
else()
|
2020-05-07 04:20:49 +08:00
|
|
|
# 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()
|
2020-09-25 06:15:06 +08:00
|
|
|
set(ENV{CFLAGS} "$ENV{CFLAGS} -Wno-error=implicit-function-declaration")
|
2020-05-07 04:20:49 +08:00
|
|
|
vcpkg_configure_make(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
OPTIONS
|
|
|
|
"--prefix=${CURRENT_INSTALLED_DIR}"
|
|
|
|
"${CONFIGURE_PARAMETER_1}"
|
|
|
|
"${CONFIGURE_PARAMETER_2}"
|
|
|
|
"${CONFIGURE_PARAMETER_3}"
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_make()
|
|
|
|
|
2022-04-20 00:06:53 +08:00
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/apr-1.pc"
|
|
|
|
"-lapr-\${APR_MAJOR_VERSION}" "-lapr-1"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-11-09 13:07:51 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/apr-1.pc"
|
2020-06-26 02:11:17 +08:00
|
|
|
"-lapr-\${APR_MAJOR_VERSION}" "-lapr-1"
|
|
|
|
)
|
2020-07-25 02:39:21 +08:00
|
|
|
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES pthread rt dl uuid crypt)
|
2021-11-09 13:07:51 +08:00
|
|
|
|
2023-03-20 14:36:01 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/apr-1-config" "\"${CURRENT_INSTALLED_DIR}\"" "$(realpath \"`dirname $0`/../../..\")")
|
2021-12-07 13:13:20 +08:00
|
|
|
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\"" "")
|
2022-04-20 00:06:53 +08:00
|
|
|
|
2024-06-20 05:07:05 +08:00
|
|
|
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)
|
2023-03-20 14:36:01 +08:00
|
|
|
|
2023-03-29 05:53:57 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/build-1/apr_rules.mk" "${CURRENT_INSTALLED_DIR}" "$(INCLUDE)/..")
|
2022-04-20 00:06:53 +08:00
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
2023-03-20 14:36:01 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/apr-1-config" "\"${CURRENT_INSTALLED_DIR}/debug\"" "$(realpath \"`dirname $0`/../../../..\")")
|
2022-04-20 00:06:53 +08:00
|
|
|
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\"" "")
|
2022-07-19 04:14:05 +08:00
|
|
|
|
2024-06-20 05:07:05 +08:00
|
|
|
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)
|
2023-03-20 14:36:01 +08:00
|
|
|
|
2023-03-29 05:53:57 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/build-1/apr_rules.mk" "${CURRENT_INSTALLED_DIR}/debug" "$(INCLUDE)/..")
|
2022-04-20 00:06:53 +08:00
|
|
|
endif()
|
2022-05-13 10:36:04 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
2016-11-04 03:08:24 +08:00
|
|
|
endif()
|
|
|
|
|
2016-11-03 21:06:02 +08:00
|
|
|
# Handle copyright
|
2021-11-09 13:07:51 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|