2020-03-12 00:28:19 +08:00
|
|
|
set(PCRE_VERSION 8.44)
|
2019-10-08 01:35:13 +08:00
|
|
|
|
2016-10-20 08:08:48 +08:00
|
|
|
vcpkg_download_distfile(ARCHIVE
|
2019-10-08 01:35:13 +08:00
|
|
|
URLS "https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.zip"
|
2017-04-30 22:34:53 +08:00
|
|
|
"https://downloads.sourceforge.net/project/pcre/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.zip"
|
|
|
|
FILENAME "pcre-${PCRE_VERSION}.zip"
|
2020-03-12 00:28:19 +08:00
|
|
|
SHA512 adddec1236b25ff1c90e73835c2ba25d60a5839cbde2d6be7838a8ec099f7443dede931dc39002943243e21afea572eda71ee8739058e72235a192e4324398f0
|
2016-10-20 08:08:48 +08:00
|
|
|
)
|
|
|
|
|
2019-10-08 01:35:13 +08:00
|
|
|
vcpkg_extract_source_archive_ex(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
ARCHIVE ${ARCHIVE}
|
|
|
|
PATCHES
|
2020-03-12 00:28:19 +08:00
|
|
|
# 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
|
|
|
|
pcre-8.44_suppress_cmake_and_compiler_warnings-errors.patch
|
2019-10-08 01:35:13 +08:00
|
|
|
)
|
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()
|
|
|
|
|
2016-11-17 16:28:54 +08:00
|
|
|
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()
|
|
|
|
|
2020-06-06 03:24:03 +08:00
|
|
|
# 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()
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
# debug
|
|
|
|
set(prefix "${CURRENT_INSTALLED_DIR}/debug")
|
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
|
set(libdir "\${prefix}/lib")
|
|
|
|
set(includedir "\${prefix}/../include")
|
|
|
|
|
|
|
|
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)
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre.pc LIBPCRE.PC)
|
|
|
|
string(REPLACE "-lpcre" "-lpcred" LIBPCRE.PC ${LIBPCRE.PC})
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre.pc ${LIBPCRE.PC})
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre16.pc LIBPCRE16.PC)
|
|
|
|
string(REPLACE "-lpcre16" "-lpcre16d" LIBPCRE16.PC ${LIBPCRE16.PC})
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre16.pc ${LIBPCRE16.PC})
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre32.pc LIBPCRE32.PC)
|
|
|
|
string(REPLACE "-lpcre32" "-lpcre32d" LIBPCRE32.PC ${LIBPCRE32.PC})
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcre32.pc ${LIBPCRE32.PC})
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcrecpp.pc LIBPCRECPP.PC)
|
|
|
|
string(REPLACE "-lpcre -lpcrecpp" "-lpcred -lpcrecppd" LIBPCRECPP.PC ${LIBPCRECPP.PC})
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcrecpp.pc ${LIBPCRECPP.PC})
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcreposix.pc LIBPCREPOSIX.PC)
|
|
|
|
string(REPLACE "-lpcreposix" "-lpcreposixd" LIBPCREPOSIX.PC ${LIBPCREPOSIX.PC})
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpcreposix.pc ${LIBPCREPOSIX.PC})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
|
2016-10-20 08:08:48 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
|
|
|
2016-10-27 10:25:11 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/man)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/man)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
|
|
|
|
|
2019-09-06 01:43:09 +08:00
|
|
|
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
2016-10-20 08:08:48 +08:00
|
|
|
|
2019-10-08 01:35:13 +08:00
|
|
|
vcpkg_copy_pdbs()
|