From e94dfc2b92690f565adf7943c6bdb13a32ccf0db Mon Sep 17 00:00:00 2001 From: Alexey Rochev Date: Tue, 21 Feb 2023 19:47:24 +0300 Subject: [PATCH] [libidn2] Fix linking static libidn2 into shared library (#29749) --- .../fix-static-into-shared-linking.patch | 30 +++++++++++++++++++ ports/libidn2/portfile.cmake | 8 +++++ ports/libidn2/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/l-/libidn2.json | 5 ++++ 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 ports/libidn2/fix-static-into-shared-linking.patch diff --git a/ports/libidn2/fix-static-into-shared-linking.patch b/ports/libidn2/fix-static-into-shared-linking.patch new file mode 100644 index 0000000000..e9df074d55 --- /dev/null +++ b/ports/libidn2/fix-static-into-shared-linking.patch @@ -0,0 +1,30 @@ +--- a/lib/puny_decode.c ++++ b/lib/puny_decode.c +@@ -242,12 +242,3 @@ + /* cannot overflow because out <= old value of *output_length */ + return punycode_success; + } +- +-/* Create a compatibility symbol if supported. Hidden references make +- the target symbol hidden, hence the alias. */ +-#ifdef HAVE_SYMVER_ALIAS_SUPPORT +-__typeof__ (_idn2_punycode_decode_internal) _idn2_punycode_decode +- __attribute__((visibility ("default"), +- alias ("_idn2_punycode_decode_internal"))); +-__asm__ (".symver _idn2_punycode_decode, _idn2_punycode_decode@IDN2_0.0.0"); +-#endif +--- a/lib/puny_encode.c ++++ b/lib/puny_encode.c +@@ -243,12 +243,3 @@ + *output_length = out; + return punycode_success; + } +- +-/* Create a compatibility symbol if supported. Hidden references make +- the target symbol hidden, hence the alias. */ +-#ifdef HAVE_SYMVER_ALIAS_SUPPORT +-__typeof__ (_idn2_punycode_encode_internal) _idn2_punycode_encode +- __attribute__((visibility ("default"), +- alias ("_idn2_punycode_encode_internal"))); +-__asm__ (".symver _idn2_punycode_encode, _idn2_punycode_encode@IDN2_0.0.0"); +-#endif diff --git a/ports/libidn2/portfile.cmake b/ports/libidn2/portfile.cmake index 466391ce71..000dd544b4 100644 --- a/ports/libidn2/portfile.cmake +++ b/ports/libidn2/portfile.cmake @@ -8,10 +8,18 @@ vcpkg_download_distfile(ARCHIVE SHA512 a6e90ccef56cfd0b37e3333ab3594bb3cec7ca42a138ca8c4f4ce142da208fa792f6c78ca00c01001c2bc02831abcbaf1cf9bcc346a5290fd7b30708f5a462f3 ) +vcpkg_list(SET patches) +if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + # Fix linking static libidn2 into shared library + # https://gitlab.com/libidn/libidn2/-/issues/80 + vcpkg_list(APPEND patches "fix-static-into-shared-linking.patch") +endif() + vcpkg_extract_source_archive(SOURCE_PATH ARCHIVE "${ARCHIVE}" SOURCE_BASE "v${VERSION}" PATCHES + ${patches} disable-subdirs.patch fix-msvc.patch fix-uwp.patch diff --git a/ports/libidn2/vcpkg.json b/ports/libidn2/vcpkg.json index 5a80c500ee..e560622892 100644 --- a/ports/libidn2/vcpkg.json +++ b/ports/libidn2/vcpkg.json @@ -1,7 +1,7 @@ { "name": "libidn2", "version": "2.3.4", - "port-version": 1, + "port-version": 2, "description": "GNU Libidn is an implementation of the Stringprep, Punycode and IDNA 2003 specifications. Libidn's purpose is to encode and decode internationalized domain names.", "homepage": "https://www.gnu.org/software/libidn/", "license": null, diff --git a/versions/baseline.json b/versions/baseline.json index 69b53ae9f0..b3df9df1b1 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4010,7 +4010,7 @@ }, "libidn2": { "baseline": "2.3.4", - "port-version": 1 + "port-version": 2 }, "libigl": { "baseline": "2.3.0", diff --git a/versions/l-/libidn2.json b/versions/l-/libidn2.json index f39b16c817..552f76f234 100644 --- a/versions/l-/libidn2.json +++ b/versions/l-/libidn2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "4784d5f7f99d7ea1ebe6f1ef01943e402e7bfddf", + "version": "2.3.4", + "port-version": 2 + }, { "git-tree": "111b9ff4af9664333f73344385dfbbfa40d9bc20", "version": "2.3.4",