From 99d57e7ad49c5a80628e9f009c2fcd7dbaa5e162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 18 Oct 2022 12:43:02 +0200 Subject: [PATCH 1/6] Update to 0.21.1 --- Gettext.Tools.nuspec | 2 +- Makefile | 6 +-- ...ext-0.21-0002-fix-unc-paths-handling.patch | 48 ------------------- 3 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 patches/gettext-0.21-0002-fix-unc-paths-handling.patch diff --git a/Gettext.Tools.nuspec b/Gettext.Tools.nuspec index 45844ee..e05dfdf 100644 --- a/Gettext.Tools.nuspec +++ b/Gettext.Tools.nuspec @@ -2,7 +2,7 @@ Gettext.Tools - 0.21.0.1 + 0.21.1 GNU gettext tools for Windows Vaclav Slavik GPL-3.0-or-later diff --git a/Makefile b/Makefile index d8b6f8a..ddcb4b3 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -GETTEXT_VERSION = 0.21 +GETTEXT_VERSION = 0.21.1 LIBICONV_VERSION = 1.16 # version of the gettext-tools-windows package; usually same as GETTEXT_VERSION # use "-n" suffix; for NuGet, use ".n" suffix instead, e.g. 0.20.1-1 and 0.20.1.1 -PACKAGE_VERSION = $(GETTEXT_VERSION)-1 -NUGET_VERSION = $(GETTEXT_VERSION).0.1 +PACKAGE_VERSION = $(GETTEXT_VERSION) +NUGET_VERSION = $(GETTEXT_VERSION) # Awful trickery to undo MSYS's magical path conversion (see # http://www.mingw.org/wiki/Posix_path_conversion) which happens to break diff --git a/patches/gettext-0.21-0002-fix-unc-paths-handling.patch b/patches/gettext-0.21-0002-fix-unc-paths-handling.patch deleted file mode 100644 index 0ac3aa3..0000000 --- a/patches/gettext-0.21-0002-fix-unc-paths-handling.patch +++ /dev/null @@ -1,48 +0,0 @@ -canonicalize: Add support for UNC file names on native Windows. - -Reported and initial patch by Vaclav Slavik in -. - -* lib/canonicalize.c (canonicalize_filename_mode): For UNC file names, -extend the prefix to include the server. - -diff -ru a/gettext-tools/gnulib-lib/canonicalize.c b/gettext-tools/gnulib-lib/canonicalize.c ---- a/gettext-tools/gnulib-lib/canonicalize.c 2020-07-05 23:46:46.000000000 +0200 -+++ b/gettext-tools/gnulib-lib/canonicalize.c 2020-11-07 17:40:00.000000000 +0100 -@@ -166,8 +166,34 @@ - *dest++ = '/'; - if (DOUBLE_SLASH_IS_DISTINCT_ROOT) - { -- if (ISSLASH (name[1]) && !ISSLASH (name[2]) && !prefix_len) -- *dest++ = '/'; -+ if (prefix_len == 0 /* implies ISSLASH (name[0]) */ -+ && ISSLASH (name[1]) && !ISSLASH (name[2])) -+ { -+ *dest++ = '/'; -+#if defined _WIN32 && !defined __CYGWIN__ -+ /* For UNC file names '\\server\path\to\file', extend the prefix -+ to include the server: '\\server\'. */ -+ { -+ size_t i; -+ for (i = 2; name[i] != '\0' && !ISSLASH (name[i]); ) -+ i++; -+ if (name[i] != '\0' /* implies ISSLASH (name[i]) */ -+ && i + 1 < rname_limit - rname) -+ { -+ prefix_len = i; -+ memcpy (dest, name + 2, i - 2 + 1); -+ dest += i - 2 + 1; -+ } -+ else -+ { -+ /* Either name = '\\server'; this is an invalid file name. -+ Or name = '\\server\...' and server is more than -+ PATH_MAX - 4 bytes long. In either case, stop the UNC -+ processing. */ -+ } -+ } -+#endif -+ } - *dest = '\0'; - } - start = name + prefix_len; From 04fe0dc26450a4c80f9dbfc8aadd18ea138d71cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Tue, 8 Nov 2022 19:04:09 +0100 Subject: [PATCH 2/6] Fail compilation if a patch doesn't apply --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ddcb4b3..8064e33 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ $(GETTEXT_COMPILE): $(GETTEXT_DOWNLOAD) $(LIBICONV_COMPILE) tar -C $(COMPILEDIR) -xzf $< cd $(COMPILEDIR)/gettext-$(GETTEXT_VERSION) && \ for p in $(GETTEXT_PATCHES) ; do \ - patch -p1 < $$p ; \ + patch -p1 < $$p || exit 1 ; \ done cd $(COMPILEDIR)/gettext-$(GETTEXT_VERSION) && \ ./configure $(GETTEXT_FLAGS) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" && \ From b38375a5529591bdf4a136a34eb637e3df310c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Tue, 8 Nov 2022 19:15:28 +0100 Subject: [PATCH 3/6] Remove no longer needed patch --- ...d-failure-on-mingw-formatstring_ruby.patch | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 patches/gettext-0.21-0001-build-Fix-build-failure-on-mingw-formatstring_ruby.patch diff --git a/patches/gettext-0.21-0001-build-Fix-build-failure-on-mingw-formatstring_ruby.patch b/patches/gettext-0.21-0001-build-Fix-build-failure-on-mingw-formatstring_ruby.patch deleted file mode 100644 index 1444d5f..0000000 --- a/patches/gettext-0.21-0001-build-Fix-build-failure-on-mingw-formatstring_ruby.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 296c70c182c93c78c59c751db45823012dad5b4e Mon Sep 17 00:00:00 2001 -From: Michele Locati -Date: Thu, 30 Jul 2020 18:58:02 +0200 -Subject: [PATCH] build: Fix build failure on mingw (formatstring_ruby) - ---- - gettext-tools/woe32dll/gettextsrc-exports.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/gettext-tools/woe32dll/gettextsrc-exports.c b/gettext-tools/woe32dll/gettextsrc-exports.c -index 4477ae8d4..6d7608959 100644 ---- a/gettext-tools/woe32dll/gettextsrc-exports.c -+++ b/gettext-tools/woe32dll/gettextsrc-exports.c -@@ -50,6 +50,7 @@ VARIABLE(formatstring_python) - VARIABLE(formatstring_python_brace) - VARIABLE(formatstring_qt) - VARIABLE(formatstring_qt_plural) -+VARIABLE(formatstring_ruby) - VARIABLE(formatstring_scheme) - VARIABLE(formatstring_sh) - VARIABLE(formatstring_smalltalk) --- -2.28.0.windows.1 - From a6eec4574680326a76daabea99031aa00337bfcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Mon, 7 Nov 2022 16:57:14 +0100 Subject: [PATCH 4/6] Compilation fix for missing close gnulib module The gnulib modifications of close() seem irrelevant to this code, so just #undef it and use regular CRT close(). --- ...-build-failure-on-mingw-close-module.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 patches/gettext-0.21-0001-build-failure-on-mingw-close-module.patch diff --git a/patches/gettext-0.21-0001-build-failure-on-mingw-close-module.patch b/patches/gettext-0.21-0001-build-failure-on-mingw-close-module.patch new file mode 100644 index 0000000..20ea58b --- /dev/null +++ b/patches/gettext-0.21-0001-build-failure-on-mingw-close-module.patch @@ -0,0 +1,51 @@ +diff --git a/gettext-tools/src/msgexec.c b/gettext-tools/src/msgexec.c +index fb7e2c8a0..bcb6ae354 100644 +--- a/gettext-tools/src/msgexec.c ++++ b/gettext-tools/src/msgexec.c +@@ -325,6 +325,8 @@ or by email to <%s>.\n"), + + #ifdef EINTR + ++#undef close ++ + /* EINTR handling for close(). + These functions can return -1/EINTR even though we don't have any + signal handlers set up, namely when we get interrupted via SIGSTOP. */ +diff --git a/gettext-tools/src/msggrep.c b/gettext-tools/src/msggrep.c +index e3b7a9ca4..a5fdbaa04 100644 +--- a/gettext-tools/src/msggrep.c ++++ b/gettext-tools/src/msggrep.c +@@ -658,6 +658,8 @@ filename_list_match (const string_list_ty *slp, const char *filename) + + #ifdef EINTR + ++#undef close ++ + /* EINTR handling for close(). + These functions can return -1/EINTR even though we don't have any + signal handlers set up, namely when we get interrupted via SIGSTOP. */ +diff --git a/gettext-tools/src/urlget.c b/gettext-tools/src/urlget.c +index ca3df36e7..0f2df9816 100644 +--- a/gettext-tools/src/urlget.c ++++ b/gettext-tools/src/urlget.c +@@ -50,6 +50,7 @@ + # define STDOUT_FILENO 1 + #endif + ++#undef close + + /* Only high-level toolkits, written in languages with exception handling, + have an URL datatype and operations to fetch an URL's contents. Such +diff --git a/gettext-tools/src/write-catalog.c b/gettext-tools/src/write-catalog.c +index c25916d1b..479a7efdb 100644 +--- a/gettext-tools/src/write-catalog.c ++++ b/gettext-tools/src/write-catalog.c +@@ -59,6 +59,8 @@ + + #endif + ++#undef close ++ + + /* =========== Some parameters for use by 'msgdomain_list_print'. ========== */ + From 4dbd82814b022940a4363fdd15a8d849d645b68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Wed, 16 Nov 2022 12:47:24 +0100 Subject: [PATCH 5/6] Revert "Workaround compilation problem with recent MinGW." Removing workaround for MinGW from 2014. This reverts commit d7a9ef00b64c88207ccaf93c888802f11d662a09. --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8064e33..97c6d41 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,7 @@ GETTEXT_FLAGS = --prefix=$(MSYS_PREFIX) \ --disable-csharp \ --disable-java \ --enable-threads=windows \ - --enable-relocatable \ - ac_cv_func__set_invalid_parameter_handler=no + --enable-relocatable CFLAGS := -O2 LDFLAGS := -Wl,--dynamicbase -Wl,--nxcompat -Wl,--no-seh From 11300cc38a70da4043122d22c1db0d2391241ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Wed, 16 Nov 2022 14:13:44 +0100 Subject: [PATCH 6/6] Use configure -C flag to speed up configure (sub)runs --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 97c6d41..65b31ab 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ $(GETTEXT_COMPILE): $(GETTEXT_DOWNLOAD) $(LIBICONV_COMPILE) patch -p1 < $$p || exit 1 ; \ done cd $(COMPILEDIR)/gettext-$(GETTEXT_VERSION) && \ - ./configure $(GETTEXT_FLAGS) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" && \ + ./configure -C $(GETTEXT_FLAGS) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" && \ $(MAKE) -C libtextstyle && \ $(MAKE) -C gettext-tools touch $@