From 32664e733b8b3eeeb74bd47e364eb80b6c98fc95 Mon Sep 17 00:00:00 2001 From: Max Khon Date: Wed, 12 Jan 2022 04:55:07 +0700 Subject: [PATCH] [gettext] Fix uwp "tools" build --- ports/gettext/0004-Fix-uwp-tools-build.patch | 116 +++++++++++++++++++ ports/gettext/portfile.cmake | 1 + ports/gettext/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/g-/gettext.json | 5 + 5 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 ports/gettext/0004-Fix-uwp-tools-build.patch diff --git a/ports/gettext/0004-Fix-uwp-tools-build.patch b/ports/gettext/0004-Fix-uwp-tools-build.patch new file mode 100644 index 00000000000000..65dfce570d9ab0 --- /dev/null +++ b/ports/gettext/0004-Fix-uwp-tools-build.patch @@ -0,0 +1,116 @@ +--- a/gettext-runtime/gnulib-lib/fcntl.c 2022-01-11 11:11:28.406622100 +0700 ++++ b/gettext-runtime/gnulib-lib/fcntl.c 2022-01-11 11:11:03.406190800 +0700 +@@ -38,6 +38,10 @@ + # define WIN32_LEAN_AND_MEAN + # include + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) ++#define HANDLE_FLAG_INHERIT 0 ++#endif ++ + /* Get _get_osfhandle. */ + # if GNULIB_MSVC_NOTHROW + # include "msvc-nothrow.h" +--- a/gettext-tools/gnulib-lib/fcntl.c 2022-01-11 11:11:28.406622100 +0700 ++++ b/gettext-tools/gnulib-lib/fcntl.c 2022-01-11 11:11:03.406190800 +0700 +@@ -38,6 +38,10 @@ + # define WIN32_LEAN_AND_MEAN + # include + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) ++#define HANDLE_FLAG_INHERIT 0 ++#endif ++ + /* Get _get_osfhandle. */ + # if GNULIB_MSVC_NOTHROW + # include "msvc-nothrow.h" +--- a/gettext-tools/src/hostname.c 2022-01-12 01:41:13.725124300 +0700 ++++ b/gettext-tools/src/hostname.c 2022-01-12 01:47:39.384274300 +0700 +@@ -35,15 +35,15 @@ + /* Get gethostname(). */ + #include + ++#if !HAVE_GETHOSTNAME + #ifdef WIN32_NATIVE + /* Native Woe32 API lacks gethostname() but has GetComputerName() instead. */ + # include + #else + /* Some systems, like early Solaris versions, lack gethostname() but + have uname() instead. */ +-# if !HAVE_GETHOSTNAME +-# include +-# endif ++# include ++#endif + #endif + + /* Get MAXHOSTNAMELEN. */ +@@ -56,6 +56,9 @@ + + /* Support for using gethostbyname(). */ + #if HAVE_GETHOSTBYNAME ++#if HAVE_WINSOCK2_H ++# include ++#else + # include + # include /* defines AF_INET, AF_INET6 */ + # include /* declares ntohs(), defines struct sockaddr_in */ +@@ -77,6 +80,7 @@ + # endif + # include /* defines struct hostent, declares gethostbyname() */ + #endif ++#endif + + /* Include this after , to avoid a syntax error on BeOS. */ + #include +@@ -250,7 +254,7 @@ + static char * + xgethostname () + { +-#ifdef WIN32_NATIVE ++#ifdef WIN32_NATIVE && !HAVE_GETHOSTNAME + char hostname[MAX_COMPUTERNAME_LENGTH+1]; + DWORD size = sizeof (hostname); + +--- a/libtextstyle/lib/fcntl.c 2020-06-27 03:00:38.000000000 +0700 ++++ b/libtextstyle/lib/fcntl.c 2022-01-11 11:10:29.936269800 +0700 +@@ -38,6 +38,10 @@ + # define WIN32_LEAN_AND_MEAN + # include + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) ++#define HANDLE_FLAG_INHERIT 0 ++#endif ++ + /* Get _get_osfhandle. */ + # if GNULIB_MSVC_NOTHROW + # include "msvc-nothrow.h" +--- a/libtextstyle/lib/isatty.c 2020-06-27 03:00:40.000000000 +0700 ++++ b/libtextstyle/lib/isatty.c 2022-01-11 11:19:04.852685700 +0700 +@@ -99,6 +99,7 @@ + BOOL result = FALSE; + ULONG processId; + ++#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_APP) + #if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA) + if (!initialized) + initialize (); +@@ -137,6 +138,7 @@ + CloseHandle (processHandle); + } + } ++#endif // !WINAPI_FAMILY_APP + return result; + } + +--- a/libtextstyle/lib/unistd.in.h 2020-07-08 08:33:18.000000000 +0700 ++++ b/libtextstyle/lib/unistd.in.h 2022-01-11 22:11:46.402435600 +0700 +@@ -828,7 +828,7 @@ + Null terminate it if the name is shorter than LEN. + If the host name is longer than LEN, set errno = EINVAL and return -1. + Return 0 if successful, otherwise set errno and return -1. */ +-# if @UNISTD_H_HAVE_WINSOCK2_H@ ++# if !@HAVE_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef gethostname + # define gethostname rpl_gethostname diff --git a/ports/gettext/portfile.cmake b/ports/gettext/portfile.cmake index 8fafa80800b679..bd46f930b4c331 100644 --- a/ports/gettext/portfile.cmake +++ b/ports/gettext/portfile.cmake @@ -26,6 +26,7 @@ vcpkg_extract_source_archive_ex( PATCHES 0002-Fix-uwp-build.patch 0003-Fix-win-unicode-paths.patch + 0004-Fix-uwp-tools-build.patch rel_path.patch android.patch gettext-tools_woe32dll_gettextsrc-exports.c.patch diff --git a/ports/gettext/vcpkg.json b/ports/gettext/vcpkg.json index e1aec428b03354..aa6ebb5f3d15f5 100644 --- a/ports/gettext/vcpkg.json +++ b/ports/gettext/vcpkg.json @@ -1,7 +1,7 @@ { "name": "gettext", "version": "0.21", - "port-version": 8, + "port-version": 9, "description": "GNU gettext provides libintl and a set of tools to help produce multi-lingual messages.", "homepage": "https://www.gnu.org/software/gettext/", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index 8e9a13b5bdda03..2433a17ae0a520 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2422,7 +2422,7 @@ }, "gettext": { "baseline": "0.21", - "port-version": 8 + "port-version": 9 }, "gettimeofday": { "baseline": "2017-10-14", diff --git a/versions/g-/gettext.json b/versions/g-/gettext.json index de3e43d52c6f51..22712c19d602ff 100644 --- a/versions/g-/gettext.json +++ b/versions/g-/gettext.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "5bf45743516e2ae999eb14017370828e237ad533", + "version": "0.21", + "port-version": 9 + }, { "git-tree": "d1dc6ee2684911bfcb6f63c498413a118c235ba5", "version": "0.21",