[libunistring] Add support for building on Windows (#24253)

* [libunistring] Add support for building on Windows

Tweaked the portfile to no longer trigger autotools as it
caused more problems when trying to build for MSVC, so the
old automake patch is no longer needed.

The awk script used in configure should've worked, but seems
to somehow get double-interpolated somewhere along the way in
such a way as to strip out quotes needed in the script, so
put in in a dedicated script.

Added wrappers so the build scripts can use "nm" and "ar" as
if this were a UNIX target.

Fixed compiler output (warnings) getting merged with dumpbin
output and putting garbage into lib/config.h

* [libunistring] Fix non-x64 Windows builds.

* [libunistring] Bump port-version

* vcpkg x-add-version --all

* [libunistring] Mark failure under UWP as expected

* [libunistring] Remove my wrapper scripts in favour of built-in ones.

* vcpkg x-add-version --all

* [libunistring] UWP isn't supported.

* vcpkg x-add-version --all
This commit is contained in:
Daniel Collins 2022-04-21 22:30:13 +01:00 committed by GitHub
parent ecd55433fd
commit 8288d7ee5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 18 deletions

View File

@ -1,13 +0,0 @@
--- a/m4/init-package-version.m4
+++ b/m4/init-package-version.m4
@@ -82,9 +82,9 @@
[AC_SUBST([PACKAGE], [$1])
AC_SUBST([VERSION], [$2])
])
m4_define([AM_INIT_AUTOMAKE],
m4_defn([gl_RPL_INIT_AUTOMAKE]))
])
-m4_define([gl_INIT_DUMMY], [])
+m4_define([gl_INIT_DUMMY], [dummy])
AC_DEFUN([gl_RPL_INIT_AUTOMAKE], [
m4_ifval([$2],

View File

@ -0,0 +1,53 @@
--- /dev/null
+++ b/build-aux/dumpbin-to-nm.awk
@@ -0,0 +1,14 @@
+{last_section=section; section=$ 3};
+/^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};
+/Section length .*#relocs.*(pick any)/{hide[last_section]=1};
+/^ *Symbol name *: /{split($ 0,sn,":"); si=substr(sn[2],2)};
+/^ *Type *: code/{print "T",si,substr(si,length(prfx))};
+/^ *Type *: data/{print "I",si,substr(si,length(prfx))};
+$ 0!~/External *\|/{next};
+$ 0~/__local_stdio_printf_options/{next};
+/ 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};
+{if(hide[section]) next};
+{f="D"}; $ 0~/\(\).*\|/{f="T"};
+{split($ 0,a,/\||\r/); split(a[2],s)};
+s[1]~/^[@?]/{print f,s[1],s[1]; next};
+s[1]~prfx {split(s[1],t,"@"); print f,t[1],substr(t[1],length(prfx))}
--- a/configure
+++ b/configure
@@ -10274,21 +10274,7 @@
# D for any global variable and I for any imported variable.
# Also find C++ and __fastcall symbols from MSVC++,
# which start with @ or ?.
- lt_cv_sys_global_symbol_pipe="$AWK '"\
-" {last_section=section; section=\$ 3};"\
-" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
-" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
-" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
-" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
-" \$ 0!~/External *\|/{next};"\
-" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-" {if(hide[section]) next};"\
-" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
-" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
-" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
-" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
-" ' prfx=^$ac_symprfx"
+ lt_cv_sys_global_symbol_pipe="$AWK -f '$(realpath "$(dirname $0)")/build-aux/dumpbin-to-nm.awk' prfx=^$ac_symprfx"
else
lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -5934,7 +5938,7 @@
test -f $$sf || sf=$(srcdir)/$$sf; \
of=`echo "$$f" | sed -e 's,^.*/,,' -e 's,\\.[^.]*$$,,'`.$(OBJEXT); \
echo "$(COMPILE) -c $$sf" 1>&6; \
- $(COMPILE) -c $$sf || { rm -f config.h; exit 1; }; \
+ $(COMPILE) -c $$sf 1>&6 || { rm -f config.h; exit 1; }; \
sh ./exported.sh $$of 1>&5; \
rm -f $$of `echo "$$of" | sed -e 's,\\.$(OBJEXT)$$,.lo,'`; \
;; \

View File

@ -13,16 +13,17 @@ vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE "${ARCHIVE}"
REF ${LIBUNISTRING_VERSION}
PATCHES fix-for-automake-1.16.4.patch # automake 1.16.4 uses m4_ifset instead of m4_ifdef
PATCHES libunistring-msys-msvc-build.patch
)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
COPY_SOURCE
USE_WRAPPERS
OPTIONS
"--with-libiconv-prefix=${CURRENT_INSTALLED_DIR}"
)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

View File

@ -1,10 +1,10 @@
{
"name": "libunistring",
"version": "0.9.10",
"port-version": 2,
"port-version": 3,
"description": "GNU libunistring provides functions for manipulating Unicode strings and for manipulating C strings according to the Unicode standard.",
"homepage": "https://www.gnu.org/software/libunistring/",
"supports": "!windows",
"supports": "!uwp",
"dependencies": [
"libiconv"
]

View File

@ -4114,7 +4114,7 @@
},
"libunistring": {
"baseline": "0.9.10",
"port-version": 2
"port-version": 3
},
"liburing": {
"baseline": "2.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2ae1c5ae3927f718073792b5cb86fa434b5c8c49",
"version": "0.9.10",
"port-version": 3
},
{
"git-tree": "1d6ff819975c70dc53d9aefa5d9046a0a21617b4",
"version": "0.9.10",