vcpkg/ports/pcre/portfile.cmake

132 lines
5.3 KiB
CMake
Raw Normal View History

set(PCRE_VERSION 8.44)
set(EXPECTED_SHA adddec1236b25ff1c90e73835c2ba25d60a5839cbde2d6be7838a8ec099f7443dede931dc39002943243e21afea572eda71ee8739058e72235a192e4324398f0)
set(PATCHES
# Fix CMake Deprecation Warning concerning OLD behavior for policy CMP0026
# Suppress MSVC compiler warnings C4703, C4146, C4308, which fixes errors
# under x64-uwp and arm-uwp
2020-10-27 08:44:56 +08:00
pcre-8.44_suppress_cmake_and_compiler_warnings-errors.patch
export-cmake-targets.patch)
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.zip"
2017-04-30 22:34:53 +08:00
FILENAME "pcre-${PCRE_VERSION}.zip"
SHA512 ${EXPECTED_SHA}
SILENT_EXIT
)
if (EXISTS "${ARCHIVE}")
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES ${PATCHES}
)
else()
vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
REPO pcre/pcre
REF ${PCRE_VERSION}
FILENAME "pcre-${PCRE_VERSION}.zip"
SHA512 ${EXPECTED_SHA}
PATCHES ${PATCHES}
)
endif()
2017-04-30 22:34:53 +08:00
2016-10-20 08:08:48 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
2017-04-30 22:34:53 +08:00
PREFER_NINJA
2016-10-20 08:08:48 +08:00
OPTIONS -DPCRE_BUILD_TESTS=NO
-DPCRE_BUILD_PCREGREP=NO
2016-10-20 08:16:08 +08:00
-DPCRE_BUILD_PCRE32=YES
-DPCRE_BUILD_PCRE16=YES
2016-10-26 02:07:57 +08:00
-DPCRE_BUILD_PCRE8=YES
-DPCRE_SUPPORT_JIT=YES
-DPCRE_SUPPORT_UTF=YES
-DPCRE_SUPPORT_UNICODE_PROPERTIES=YES
2017-04-30 22:34:53 +08:00
# optional dependencies for PCREGREP
-DPCRE_SUPPORT_LIBBZ2=OFF
-DPCRE_SUPPORT_LIBZ=OFF
-DPCRE_SUPPORT_LIBEDIT=OFF
-DPCRE_SUPPORT_LIBREADLINE=OFF
2016-10-20 08:08:48 +08:00
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
vcpkg_install_cmake()
2020-10-27 08:44:56 +08:00
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
foreach(FILE ${CURRENT_PACKAGES_DIR}/include/pcre.h ${CURRENT_PACKAGES_DIR}/include/pcreposix.h)
file(READ ${FILE} PCRE_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(REPLACE "defined(PCRE_STATIC)" "1" PCRE_H "${PCRE_H}")
else()
string(REPLACE "defined(PCRE_STATIC)" "0" PCRE_H "${PCRE_H}")
endif()
file(WRITE ${FILE} "${PCRE_H}")
endforeach()
# Create pkgconfig files
set(PACKAGE_VERSION ${PCRE_VERSION})
set(prefix "${CURRENT_INSTALLED_DIR}")
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/include")
if(VCPKG_TARGET_IS_LINUX)
# Used here in .pc.in files: Libs.private: @PTHREAD_CFLAGS@
set(PTHREAD_CFLAGS "-pthread")
endif()
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
configure_file("${SOURCE_PATH}/libpcre.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcre.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcre16.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcre16.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcre32.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcre32.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcrecpp.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcrecpp.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcreposix.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpcreposix.pc" @ONLY)
endif()
# debug
set(prefix "${CURRENT_INSTALLED_DIR}/debug")
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/../include")
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
configure_file("${SOURCE_PATH}/libpcre.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcre16.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre16.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcre32.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre32.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcrecpp.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcrecpp.pc" @ONLY)
configure_file("${SOURCE_PATH}/libpcreposix.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcreposix.pc" @ONLY)
if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre.pc
"-lpcre" "-lpcred"
)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre16.pc
"-lpcre16" "-lpcre16d"
)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre32.pc
"-lpcre32" "-lpcre32d"
)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcrecpp.pc
"-lpcre -lpcrecpp" "-lpcred -lpcrecppd"
)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcreposix.pc
"-lpcreposix" "-lpcreposixd"
)
endif()
endif()
[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-25 02:39:21 +08:00
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES pthread)
2016-10-20 08:08:48 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/man)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/man)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
2020-10-27 08:44:56 +08:00
vcpkg_copy_pdbs()
configure_file(${CMAKE_CURRENT_LIST_DIR}/unofficial-pcre-config.cmake ${CURRENT_PACKAGES_DIR}/share/unofficial-pcre/unofficial-pcre-config.cmake @ONLY)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
2016-10-20 08:08:48 +08:00