vcpkg/ports/apr/portfile.cmake

118 lines
5.5 KiB
CMake
Raw Normal View History

vcpkg_download_distfile(ARCHIVE
URLS "https://archive.apache.org/dist/apr/apr-${VERSION}.tar.bz2"
2017-11-01 16:35:07 -07:00
FILENAME "apr-${VERSION}.tar.bz2"
SHA512 d8a7553642da0c81261ac3992536efd9d43ecb9154934ef1a10ae808d6a3ce8198b40433091d3a6d04f61e67c59426fb5276193a37e810ae4bc74a8a10fb651b
)
vcpkg_extract_source_archive(SOURCE_PATH
2021-11-09 06:07:51 +01:00
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)
2021-11-09 06:07:51 +01:00
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}
)
2021-11-09 06:07:51 +01:00
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.
2021-11-09 06:07:51 +01:00
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_copy_tools(TOOL_NAMES gen_test_char AUTO_CLEAN)
vcpkg_copy_pdbs()
2024-09-10 05:22:46 +02:00
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()
2021-11-09 06:07:51 +01:00
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/apr-1.pc"
"-lapr-\${APR_MAJOR_VERSION}" "-lapr-1"
)
[vcpkg/scripts/pkgconfig] rewrite pkg-config check for libraries (#11550) * [vcpkg/scripts/pkgconfig] rewrite pkgconfig check for libraries. * [vcpkg/scripts/pkgconfig] fix more details. * [vcpkg/scripts/pkgconfig] smaller improvements * ws change to check functionallity of script for testing. * [vcpkg/scripts/pkgconfig] update to latest test version * Revert "ws change to check functionallity of script for testing." This reverts commit 26269e9e776009230777d9390465715f2ebac465. * [nettle] bump control for vcpkg_fixup_pkgconfig test * [gmp] rerun CI to create new *.pc files * [gmp/nettle] enable port debug * [vcpkg/script/pkgconfig] fix path conversion regex for CI * [CI|OSX] install pkg-config on osx * [gmp/nettle] disable port debug * [vcpkg/scripts/pkgconfig] update to latest version of x windows pr * [zlib] add pkgconfig file * [zstd] add fixup pkgconfig * [libpng] add pc file installation * [bzip2] install pc file and leave a TODO for somebody else ;) * [bzip2] bump control * [vcpkg/scripts/pkgconfig] skip checks if pkgconfig cannot be found. - small bugfix in ignore flags regex * retry zstd and zlib * [libpng] retry by adding dl and m to system libraries for osx * [libpng] add missing vcpkg_fixup_pkgconfig() * [vcpkg/scripts/pkgconfig] unset var if found. fixes checks for other configurations which will be always succesful otherwise * [libpng] bump control * [libpng] enable port debug to debug osx regression * ws change to retrigger osx ci and hopeing that it works * fix typo * [libpng] remove -lm flag on apple platforms * ws change to rerun some ports in ci for good measure after the merge with master * Re-trigger CI test * [zstd] add pkgconfig * [zstd] correct debug link * [vcpkg/script/pkgconfig] - add more search suffixes for static libs - add additional debug messages for debuging - fix unsetting of cache variables hiding issues with debug libraries - fixed pkgconfig fix in the debug case * [pcre] add pthread dependency to pcre * [protobuf] fix pkgconfig * include quotes around the prefix in the case the prefix path was quoted (fixes some regressions) add option NOT_STATIC_PKGCONFIG to run pkg-config without the --static argument * [ignition-msgs5] get rid of a dev warning * [apr] fix apr regression * [protobuf] fix protobuf regression * [sdl1] fix regression due to variable expansion of pkg-config. Use similar regex to the library removal for ignored flags. * [ignition] fix regression * remove changes of zlib portfile. * reset changes in osx ci pipeline * add DISABLE_PARALLEL_CONFIGURE Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com> Co-authored-by: Billy Robert O'Neal <bion@microsoft.com>
2020-07-24 20:39:21 +02:00
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES pthread rt dl uuid crypt)
2021-11-09 06:07:51 +01:00
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/apr-1-config" "\"${CURRENT_INSTALLED_DIR}\"" "$(realpath \"`dirname $0`/../../..\")")
2021-12-07 06:13:20 +01: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\"" "")
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-28 17:53:57 -04:00
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\"" "")
2022-07-18 22:14:05 +02: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-28 17:53:57 -04:00
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
2021-11-09 06:07:51 +01:00
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)