From a3eee82a385619ea7d78a5cbaa705eaebe978163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= Date: Mon, 13 Jul 2020 22:00:43 +0200 Subject: [PATCH] [pcre2] Fix -mshstk needed with -fcf-protection (#12347) - Fixes the following error: src/sljit/sljitConfigInternal.h:219:2: error: #error "-mshstk is needed to compile with -fcf-protection" - Upstream bug report: https://bugs.exim.org/show_bug.cgi?id=2578 - Add patch based on upstream commit: https://vcs.pcre.org/pcre2?view=revision&revision=1256 - Fixes #12343 --- ports/pcre2/CONTROL | 1 + .../pcre2-10.35_add_check_for_Intel_CET.patch | 26 +++++++++++++++++++ ports/pcre2/portfile.cmake | 1 + 3 files changed, 28 insertions(+) create mode 100644 ports/pcre2/pcre2-10.35_add_check_for_Intel_CET.patch diff --git a/ports/pcre2/CONTROL b/ports/pcre2/CONTROL index 265da8e0a..75fd95488 100644 --- a/ports/pcre2/CONTROL +++ b/ports/pcre2/CONTROL @@ -1,4 +1,5 @@ Source: pcre2 Version: 10.35 +Port-Version: 1 Homepage: https://pcre.org/ Description: PCRE2 is a re-working of the original Perl Compatible Regular Expressions library diff --git a/ports/pcre2/pcre2-10.35_add_check_for_Intel_CET.patch b/ports/pcre2/pcre2-10.35_add_check_for_Intel_CET.patch new file mode 100644 index 000000000..81b91d028 --- /dev/null +++ b/ports/pcre2/pcre2-10.35_add_check_for_Intel_CET.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt 2020-05-09 16:43:10.000000000 +0200 ++++ b/CMakeLists.txt 2020-07-09 19:33:12.725648600 +0200 +@@ -146,6 +146,23 @@ + ) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + ++# Check whether Intel CET is enabled, and if so, adjust compiler flags. This ++# code was written by PH, trying to imitate the logic from the autotools ++# configuration. ++ ++CHECK_C_SOURCE_COMPILES( ++ "#ifndef __CET__ ++ #error CET is not enabled ++ #endif ++ int main() { return 0; }" ++ INTEL_CET_ENABLED ++) ++ ++IF (INTEL_CET_ENABLED) ++ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mshstk") ++ENDIF(INTEL_CET_ENABLED) ++ ++ + # User-configurable options + # + # Note: CMakeSetup displays these in alphabetical order, regardless of diff --git a/ports/pcre2/portfile.cmake b/ports/pcre2/portfile.cmake index c47f729b2..3395cccf0 100644 --- a/ports/pcre2/portfile.cmake +++ b/ports/pcre2/portfile.cmake @@ -4,6 +4,7 @@ set(PATCHES pcre2-10.35_fix-space.patch # Upstream: https://bugs.exim.org/show_bug.cgi?id=2588 pcre2-10.35_fix-uwp.patch pcre2-10.35_fix_postfix_for_debug_Windows_builds.patch # Upstream: https://bugs.exim.org/show_bug.cgi?id=2600 + pcre2-10.35_add_check_for_Intel_CET.patch # Upstream: https://bugs.exim.org/show_bug.cgi?id=2578 ) vcpkg_download_distfile(ARCHIVE