aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/gettext
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/gettext')
-rw-r--r--vcpkg/ports/gettext/0001-xgettext-Fix-some-test-failures-on-MSVC.patch93
-rw-r--r--vcpkg/ports/gettext/0003-Fix-win-unicode-paths.patch62
-rw-r--r--vcpkg/ports/gettext/assume-modern-darwin.patch26
-rw-r--r--vcpkg/ports/gettext/bashify.cmake16
-rw-r--r--vcpkg/ports/gettext/config-step-order.patch76
-rw-r--r--vcpkg/ports/gettext/install-autopoint.cmake48
-rw-r--r--vcpkg/ports/gettext/parallel-gettext-tools.patch25
-rw-r--r--vcpkg/ports/gettext/portfile.cmake212
-rw-r--r--vcpkg/ports/gettext/rel_path.patch31
-rw-r--r--vcpkg/ports/gettext/subdirs.patch127
-rw-r--r--vcpkg/ports/gettext/uwp.patch56
-rw-r--r--vcpkg/ports/gettext/vcpkg-port-config.cmake6
-rw-r--r--vcpkg/ports/gettext/vcpkg.json31
13 files changed, 809 insertions, 0 deletions
diff --git a/vcpkg/ports/gettext/0001-xgettext-Fix-some-test-failures-on-MSVC.patch b/vcpkg/ports/gettext/0001-xgettext-Fix-some-test-failures-on-MSVC.patch
new file mode 100644
index 0000000..088c692
--- /dev/null
+++ b/vcpkg/ports/gettext/0001-xgettext-Fix-some-test-failures-on-MSVC.patch
@@ -0,0 +1,93 @@
+From e5cf655767413f38e8a308f6e0440d7d283ef841 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= <daschuer@mixxx.org>
+Date: Wed, 12 Mar 2025 00:55:16 +0100
+Subject: [PATCH] xgettext: Fix some test failures on MSVC.
+
+* gettext-tools/src/locating-rule.c: Include <dirent.h> always.
+(HAVE_DIR): Remove macro.
+(locating_rule_list_add_from_directory): Don't test HAVE_DIR.
+* gettext-tools/src/msginit.c: Include <dirent.h> always.
+(HAVE_DIR): Remove macro.
+(find_pot): Don't test HAVE_DIR.
+---
+ gettext-tools/src/locating-rule.c | 12 +-----------
+ gettext-tools/src/msginit.c | 12 +-----------
+ 2 files changed, 2 insertions(+), 22 deletions(-)
+
+diff --git a/gettext-tools/src/locating-rule.c b/gettext-tools/src/locating-rule.c
+index c6f4b1b..d38bb15 100644
+--- a/gettext-tools/src/locating-rule.c
++++ b/gettext-tools/src/locating-rule.c
+@@ -27,15 +27,7 @@
+ #include "concat-filename.h"
+ #include "c-strcase.h"
+
+-#if HAVE_DIRENT_H
+-# include <dirent.h>
+-#endif
+-
+-#if HAVE_DIRENT_H
+-# define HAVE_DIR 1
+-#else
+-# define HAVE_DIR 0
+-#endif
++#include <dirent.h>
+
+ #include "dir-list.h"
+ #include <errno.h>
+@@ -411,7 +403,6 @@ bool
+ locating_rule_list_add_from_directory (struct locating_rule_list_ty *rules,
+ const char *directory)
+ {
+-#if HAVE_DIR
+ DIR *dirp;
+
+ dirp = opendir (directory);
+@@ -445,7 +436,6 @@ locating_rule_list_add_from_directory (struct locating_rule_list_ty *rules,
+ if (closedir (dirp))
+ return false;
+
+-#endif
+ return true;
+ }
+
+diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c
+index 9ff75e7..736c671 100644
+--- a/gettext-tools/src/msginit.c
++++ b/gettext-tools/src/msginit.c
+@@ -39,15 +39,7 @@
+
+ #include <unistd.h>
+
+-#if HAVE_DIRENT_H
+-# include <dirent.h>
+-#endif
+-
+-#if HAVE_DIRENT_H
+-# define HAVE_DIR 1
+-#else
+-# define HAVE_DIR 0
+-#endif
++#include <dirent.h>
+
+ #include <textstyle.h>
+
+@@ -491,7 +483,6 @@ or by email to <%s>.\n"),
+ static const char *
+ find_pot ()
+ {
+-#if HAVE_DIR
+ DIR *dirp;
+ char *found = NULL;
+
+@@ -534,7 +525,6 @@ Please specify the input .pot file through the --input option.\n")));
+ if (found != NULL)
+ return found;
+ }
+-#endif
+
+ multiline_error (xstrdup (""),
+ xstrdup (_("\
+--
+2.34.1
+
diff --git a/vcpkg/ports/gettext/0003-Fix-win-unicode-paths.patch b/vcpkg/ports/gettext/0003-Fix-win-unicode-paths.patch
new file mode 100644
index 0000000..e15e087
--- /dev/null
+++ b/vcpkg/ports/gettext/0003-Fix-win-unicode-paths.patch
@@ -0,0 +1,62 @@
+diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c
+index d5a5fe1..5c47f48 100644
+--- a/gettext-runtime/intl/loadmsgcat.c
++++ b/gettext-runtime/intl/loadmsgcat.c
+@@ -390,9 +390,56 @@ char *alloca ();
+ # define munmap(addr, len) __munmap (addr, len)
+ #elif defined _WIN32 && !defined __CYGWIN__
+ /* On native Windows, don't require linking with '-loldnames'. */
+-# define open _open
++# define open(name, flags) _open_utf8_windows_wrapper(name, flags)
+ # define read _read
+ # define close _close
++
++/* Provide wrapper of "open" for Windows that supports UTF-8 filenames. */
++# ifndef WIN32_LEAN_AND_MEAN
++# define WIN32_LEAN_AND_MEAN
++# endif
++# ifndef WIN32_EXTRA_LEAN
++# define WIN32_EXTRA_LEAN
++# endif
++# ifndef NOMINMAX
++# define NOMINMAX
++# endif
++# include <windows.h> // For: MultiByteToWideChar
++# include <io.h>
++# include <wchar.h>
++
++int _open_utf8_windows_wrapper(
++ const char *filename,
++ int flags
++)
++{
++ int wstr_len = -1;
++ wchar_t* pUtf16FileName = NULL;
++ int fh = -1;
++
++ // on Windows, convert the filename from UTF-8 to UTF-16
++ wstr_len = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
++ if (wstr_len <= 0)
++ {
++ // MultiByteToWideChar failed
++ errno = ENOENT;
++ return -1;
++ }
++ pUtf16FileName = malloc(wstr_len * sizeof(wchar_t));
++ if (MultiByteToWideChar(CP_UTF8, 0, filename, -1, pUtf16FileName, wstr_len) == 0)
++ {
++ // MultiByteToWideChar failed
++ free(pUtf16FileName);
++ errno = ENOENT;
++ return -1;
++ }
++
++ // and call _wopen
++ fh = _wopen(pUtf16FileName, flags);
++
++ free(pUtf16FileName);
++ return fh;
++}
+ #endif
+
+ /* For those losing systems which don't have `alloca' we have to add
diff --git a/vcpkg/ports/gettext/assume-modern-darwin.patch b/vcpkg/ports/gettext/assume-modern-darwin.patch
new file mode 100644
index 0000000..b59f434
--- /dev/null
+++ b/vcpkg/ports/gettext/assume-modern-darwin.patch
@@ -0,0 +1,26 @@
+diff --git a/gettext-runtime/configure b/gettext-runtime/configure
+index a984774..f436a19 100755
+--- a/gettext-runtime/configure
++++ b/gettext-runtime/configure
+@@ -35448,7 +35448,7 @@ fi
+ haiku*) use_elf_origin_trick=yes ;;
+ # On Mac OS X 10.4 or newer, use Mac OS X tools. See
+ # <https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath>.
+- darwin | darwin[1-7].*) ;;
++ darwin[1-7].*) ;;
+ darwin*) use_macos_tools=yes ;;
+ esac
+ if test $is_noop = yes; then
+diff --git a/gettext-tools/configure b/gettext-tools/configure
+index ee64b69..2dde1f5 100755
+--- a/gettext-tools/configure
++++ b/gettext-tools/configure
+@@ -48606,7 +48606,7 @@ fi
+ haiku*) use_elf_origin_trick=yes ;;
+ # On Mac OS X 10.4 or newer, use Mac OS X tools. See
+ # <https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath>.
+- darwin | darwin[1-7].*) ;;
++ darwin[1-7].*) ;;
+ darwin*) use_macos_tools=yes ;;
+ esac
+ if test $is_noop = yes; then
diff --git a/vcpkg/ports/gettext/bashify.cmake b/vcpkg/ports/gettext/bashify.cmake
new file mode 100644
index 0000000..8b3d87e
--- /dev/null
+++ b/vcpkg/ports/gettext/bashify.cmake
@@ -0,0 +1,16 @@
+# By using bash builtin expansion, we can avoid
+# expensively spawing three sub-processes (bash, echo, sed).
+foreach(dir IN LISTS SOURCE_DIRS)
+ file(READ "${dir}/configure" script)
+ string(REGEX REPLACE
+ "(\n[a-zA-Z0-9_]*)='`[\$]ECHO \"[\$]([^\"]*)\" \\| [\$]SED \"[\$]delay_single_quote_subst\"`'"
+ [[\1='${\2//\\'/\\'\\\\\\'\\'}']]
+ script "${script}"
+ )
+ string(REPLACE
+ [[ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in]]
+ [[ case "\${!var}" in]]
+ script "${script}"
+ )
+ file(WRITE "${dir}/configure" "${script}")
+endforeach()
diff --git a/vcpkg/ports/gettext/config-step-order.patch b/vcpkg/ports/gettext/config-step-order.patch
new file mode 100644
index 0000000..da247c6
--- /dev/null
+++ b/vcpkg/ports/gettext/config-step-order.patch
@@ -0,0 +1,76 @@
+diff --git a/gettext-runtime/configure b/gettext-runtime/configure
+index 2a376c6..a984774 100755
+--- a/gettext-runtime/configure
++++ b/gettext-runtime/configure
+@@ -22346,6 +22346,12 @@ printf "%s\n" "$acl_cv_libdirstems" >&6; }
+
+
+
++### Configuration step reordering
++### Similar to AM_GNU_GETTEXT(external,...), cf. gettext-runtime/m4/gettext.m4
++### Pull (include_next and) iconv lookup before actual GNU gettext lookup.
++for configuration_step in gettext-independent gettext-main ; do
++case "$configuration_step" in
++gettext-main)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5
+ printf %s "checking for CFPreferencesCopyAppValue... " >&6; }
+ if test ${gt_cv_func_CFPreferencesCopyAppValue+y}
+@@ -23288,6 +23294,9 @@ printf "%s\n" "#define HAVE_DCGETTEXT 1" >>confdefs.h
+
+
+
++### Configuration step reordering
++;;
++gettext-independent)
+ # Check whether --enable-cross-guesses was given.
+ if test ${enable_cross_guesses+y}
+ then :
+@@ -30464,6 +30473,10 @@ printf "%s\n" "$gl_cv_next_iconv_h" >&6; }
+ gl_next_as_first_directive=$gl_cv_next_iconv_h
+ fi
+ NEXT_AS_FIRST_DIRECTIVE_ICONV_H=$gl_next_as_first_directive
++### Configuration step reordering
++;;
++esac
++done
+
+
+
+diff --git a/gettext-tools/configure b/gettext-tools/configure
+index 5ce6cf1..ee64b69 100755
+--- a/gettext-tools/configure
++++ b/gettext-tools/configure
+@@ -25735,6 +25735,12 @@ printf "%s\n" "$acl_cv_libdirstems" >&6; }
+
+
+
++### Configuration step reordering
++### Similar to AM_GNU_GETTEXT(external,...), cf. gettext-runtime/m4/gettext.m4
++### Pull (include_next and) iconv lookup before actual GNU gettext lookup.
++for configuration_step in gettext-independent gettext-main; do
++case "$configuration_step" in
++gettext-main)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5
+ printf %s "checking for CFPreferencesCopyAppValue... " >&6; }
+ if test ${gt_cv_func_CFPreferencesCopyAppValue+y}
+@@ -27588,6 +27594,9 @@ fi
+
+
+
++### Configuration step reordering
++;;
++gettext-independent)
+ # Check whether --enable-cross-guesses was given.
+ if test ${enable_cross_guesses+y}
+ then :
+@@ -38458,6 +38467,10 @@ printf "%s\n" "$gl_cv_next_iconv_h" >&6; }
+ gl_next_as_first_directive=$gl_cv_next_iconv_h
+ fi
+ NEXT_AS_FIRST_DIRECTIVE_ICONV_H=$gl_next_as_first_directive
++### Configuration step reordering
++;;
++esac
++done
+
+
+
diff --git a/vcpkg/ports/gettext/install-autopoint.cmake b/vcpkg/ports/gettext/install-autopoint.cmake
new file mode 100644
index 0000000..59e383b
--- /dev/null
+++ b/vcpkg/ports/gettext/install-autopoint.cmake
@@ -0,0 +1,48 @@
+function(install_autopoint)
+ # variables for configuring autopoint.in
+ set(PACKAGE "gettext-tools")
+ set(ARCHIVE_VERSION "${VERSION}")
+ set(ARCHIVE_FORMAT "dirgz")
+ set(bindir [[${prefix}/tools/gettext/bin]])
+ set(datadir [[${datarootdir}]])
+ set(exec_prefix [[${prefix}]])
+ set(PATH_SEPARATOR ":")
+ set(RELOCATABLE "yes")
+
+ file(STRINGS "${SOURCE_PATH}/gettext-tools/configure"
+ VERSIONS_FROM_CONFIGURE
+ REGEX "^ *(ARCHIVE_VERSION|VERSION)=.*$"
+ )
+ foreach(LINE IN LISTS VERSIONS_FROM_CONFIGURE)
+ if(LINE MATCHES "^ *(ARCHIVE_VERSION|VERSION)='?([0-9.]+)'?$")
+ set(${CMAKE_MATCH_1} "${CMAKE_MATCH_2}")
+ endif()
+ endforeach()
+
+ set(WORKING_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
+ file(MAKE_DIRECTORY "${WORKING_DIR}")
+
+ # autopoint script
+ configure_file("${SOURCE_PATH}/gettext-tools/misc/autopoint.in" "${WORKING_DIR}/autopoint" @ONLY)
+
+ # data tarball
+ if(CMAKE_HOST_WIN32)
+ vcpkg_acquire_msys(MSYS_ROOT PACKAGES gzip)
+ vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
+ endif()
+ file(COPY "${SOURCE_PATH}/gettext-tools/misc/archive.dir.tar" DESTINATION "${WORKING_DIR}")
+ vcpkg_execute_required_process(
+ COMMAND gzip -f archive.dir.tar
+ WORKING_DIRECTORY "${WORKING_DIR}"
+ LOGNAME gzip-${TARGET_TRIPLET}
+ )
+
+ # installation
+ file(INSTALL "${WORKING_DIR}/autopoint" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin"
+ FILE_PERMISSIONS
+ OWNER_WRITE OWNER_READ OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+ )
+ file(INSTALL "${WORKING_DIR}/archive.dir.tar.gz" DESTINATION "${CURRENT_PACKAGES_DIR}/share/gettext/gettext")
+endfunction()
diff --git a/vcpkg/ports/gettext/parallel-gettext-tools.patch b/vcpkg/ports/gettext/parallel-gettext-tools.patch
new file mode 100644
index 0000000..65199bc
--- /dev/null
+++ b/vcpkg/ports/gettext/parallel-gettext-tools.patch
@@ -0,0 +1,25 @@
+diff --git a/gettext-tools/src/Makefile.in b/gettext-tools/src/Makefile.in
+index 5d60b99..d86232d 100644
+--- a/gettext-tools/src/Makefile.in
++++ b/gettext-tools/src/Makefile.in
+@@ -3625,7 +3625,10 @@ USEJAVA_no = 0
+
+ # Version information according to Woe32 conventions.
+ @WOE32_TRUE@WOE32_LDADD = gettext.res
+-all: $(BUILT_SOURCES)
++@USE_INSTALLED_LIBTEXTSTYLE_FALSE@all: textstyle.h
++all:
++ $(MAKE) $(AM_MAKEFLAGS) all-parallel
++all-parallel: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+ .SUFFIXES:
+@@ -5045,7 +5048,7 @@ uninstall-tcl:
+ # namely those which build textstyle.h, po-gram-gen.c, cldr-plural.c.
+ # See <https://lists.gnu.org/archive/html/bug-make/2019-05/msg00011.html>.
+ # So, turn off parallel execution in this Makefile.
+-.NOTPARALLEL:
++# .NOTPARALLEL:
+
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/vcpkg/ports/gettext/portfile.cmake b/vcpkg/ports/gettext/portfile.cmake
new file mode 100644
index 0000000..86b1f56
--- /dev/null
+++ b/vcpkg/ports/gettext/portfile.cmake
@@ -0,0 +1,212 @@
+# This port is just to provide gettext tools and build data, not libs.
+# The "core" feature depends on port gettext-libintl which provides libintl.
+# The "core" feature also installs enough for running autoreconf.
+# The actual tools are only enabled by opt-in features.
+# These features are typically used as a host dependency.
+# For fast builds in particular on Windows, the following choices are made:
+# - only release build type
+# - namespacing disabled (windows only)
+# - configuration cache
+# - using preinstalled gettext-libintl
+# - skipping some subdirs
+set(VCPKG_BUILD_TYPE release)
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://ftpmirror.gnu.org/gnu/gettext/gettext-${VERSION}.tar.gz"
+ "https://ftp.gnu.org/pub/gnu/gettext/gettext-${VERSION}.tar.gz"
+ "https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gettext/gettext-${VERSION}.tar.gz"
+ FILENAME "gettext-${VERSION}.tar.gz"
+ SHA512 d8b22d7fba10052a2045f477f0a5b684d932513bdb3b295c22fbd9dfc2a9d8fccd9aefd90692136c62897149aa2f7d1145ce6618aa1f0be787cb88eba5bc09be
+)
+
+vcpkg_extract_source_archive(SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES
+ assume-modern-darwin.patch
+ uwp.patch
+ rel_path.patch
+ subdirs.patch
+ parallel-gettext-tools.patch
+ config-step-order.patch
+ 0001-xgettext-Fix-some-test-failures-on-MSVC.patch
+)
+
+set(subdirs "")
+if("runtime-tools" IN_LIST FEATURES)
+ string(APPEND subdirs " gettext-runtime")
+endif()
+if("tools" IN_LIST FEATURES)
+ string(APPEND subdirs " libtextstyle gettext-tools")
+endif()
+if(subdirs)
+ set(ENV{VCPKG_GETTEXT_SUBDIRS} "${subdirs}")
+
+ vcpkg_find_acquire_program(BISON)
+ cmake_path(GET BISON FILENAME BISON_NAME)
+ cmake_path(GET BISON PARENT_PATH BISON_PATH)
+ vcpkg_add_to_path("${BISON_PATH}")
+
+ if(VCPKG_HOST_IS_WINDOWS)
+ message(STATUS "Modifying build system for less forks")
+ set(ENV{CONFIG_SHELL} "/usr/bin/bash")
+ vcpkg_execute_required_process(
+ COMMAND "${CMAKE_COMMAND}"
+ "-DSOURCE_DIRS=.;gettext-runtime;libtextstyle;gettext-tools"
+ -P "${CMAKE_CURRENT_LIST_DIR}/bashify.cmake"
+ WORKING_DIRECTORY "${SOURCE_PATH}"
+ LOGNAME "bashify-${TARGET_TRIPLET}"
+ )
+ endif()
+
+ set(OPTIONS
+ --enable-relocatable #symbol duplication with glib-init.c?
+ --enable-c++
+ --disable-acl
+ --disable-csharp
+ --disable-curses
+ --disable-java
+ --disable-openmp
+ --disable-dependency-tracking
+ # Avoiding system dependencies and unnecessary tests
+ --with-included-glib
+ --with-included-libxml # libtextstyle won't use external libxml
+ --with-included-libunistring
+ --with-installed-libtextstyle=no
+ --without-cvs
+ --without-emacs
+ --without-git
+ --without-libcurses-prefix
+ --without-libncurses-prefix
+ --without-libtermcap-prefix
+ --without-libxcurses-prefix
+ "INTLBISON=${BISON_NAME}"
+ "TOOLS_BISON=${BISON_NAME}"
+ )
+
+ if("nls" IN_LIST FEATURES)
+ vcpkg_list(APPEND options "--enable-nls")
+ else()
+ vcpkg_list(APPEND options "--disable-nls")
+ endif()
+
+ if(VCPKG_TARGET_IS_LINUX)
+ # Cannot use gettext-libintl, empty port on linux
+ set(ENV{VCPKG_INTL} intl)
+ else()
+ # Relying on gettext-libintl
+ list(APPEND OPTIONS --with-included-gettext=no)
+ endif()
+ if(VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND OPTIONS
+ # Faster, but not for export
+ --disable-namespacing
+ # Avoid unnecessary tests.
+ am_cv_func_iconv_works=yes
+ "--with-libiconv-prefix=${CURRENT_INSTALLED_DIR}"
+ "--with-libintl-prefix=${CURRENT_INSTALLED_DIR}"
+ # This is required. For some reason these do not get correctly identified for release builds.
+ ac_cv_func_wcslen=yes
+ ac_cv_func_memmove=yes
+ # The following are required for a full gettext built (libintl and tools).
+ gl_cv_func_printf_directive_n=no # segfaults otherwise with popup window
+ ac_cv_func_memset=yes # not detected in release builds
+ )
+ if(NOT VCPKG_TARGET_IS_MINGW)
+ list(APPEND OPTIONS
+ # Don't take from port dirent
+ ac_cv_header_dirent_h=no
+ # Don't take from port getopt-win32
+ ac_cv_header_getopt_h=no
+ # Don't take from port pthreads
+ ac_cv_header_pthread_h=no
+ ac_cv_header_sched_h=no
+ ac_cv_header_semaphore_h=no
+ # Detected 'no' everywhere except x64-windows-static
+ ac_cv_func_snprintf=no
+ # Detected x64 values for gnulib, overriding guesses for cross builds
+ gl_cv_func_fopen_mode_x=yes
+ gl_cv_func_frexpl_works=yes
+ gl_cv_func_getcwd_null=yes
+ gl_cv_func_mbrtowc_empty_input=no
+ gl_cv_func_mbsrtowcs_works=yes
+ gl_cv_func_printf_flag_zero=yes
+ gl_cv_func_printf_infinite_long_double=yes
+ gl_cv_func_printf_precision=yes
+ gl_cv_func_snprintf_truncation_c99=yes
+ # Detected x64 values for gettext, overriding guesses for x86 & x64-uwp
+ gt_cv_int_divbyzero_sigfpe=no
+ )
+ endif()
+ endif()
+
+ file(REMOVE "${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}-rel.log")
+ vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}"
+ DETERMINE_BUILD_TRIPLET
+ USE_WRAPPERS
+ ADDITIONAL_MSYS_PACKAGES gzip
+ OPTIONS
+ ${OPTIONS}
+ OPTIONS_RELEASE
+ "--cache-file=${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}-rel.log"
+ )
+
+ # This helps with Windows build times, but should work everywhere in vcpkg.
+ # - Avoid an extra command to move a temporary file, we are building out of source.
+ # - Avoid a subshell just to add comments, the build dir is temporary.
+ # - Avoid cygpath -w when other tools handle this for us.
+ file(GLOB_RECURSE makefiles "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}*/*Makefile")
+ foreach(file IN LISTS makefiles)
+ file(READ "${file}" rules)
+ string(REGEX REPLACE "(\n\ttest -d [^ ]* [|][|] [\$][(]MKDIR_P[)][^\n;]*)(\n\t)" "\\1 || exit 1 ; \\\\\\2" rules "${rules}")
+ string(REGEX REPLACE "(\n\t){ echo '/[*] [^*]* [*]/'; \\\\\n\t cat ([^;\n]*); \\\\\n\t[}] > [\$]@-t\n\tmv -f [\$]@-t ([\$]@\n)" "\\1cp \\2 \\3" rules "${rules}")
+ string(REGEX REPLACE " > [\$]@-t\n\t[\$][(]AM_V_at[)]mv [\$]@-t ([\$]@\n)" "> \\1" rules "${rules}")
+ string(REGEX REPLACE "([\$}[(]COMPILE[)] -c -o [\$]@) `[\$][(]CYGPATH_W[)] '[\$]<'`" "\\1 \$<" rules "${rules}")
+ file(WRITE "${file}" "${rules}")
+ endforeach()
+
+ vcpkg_install_make()
+ vcpkg_copy_pdbs()
+ vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
+ file(GLOB unix_runtime LIST_DIRECTORIES false
+ "${CURRENT_PACKAGES_DIR}/lib/libgettext*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}*"
+ "${CURRENT_PACKAGES_DIR}/lib/libtextstyle*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}*"
+ )
+ if(unix_runtime)
+ file(INSTALL ${unix_runtime} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
+ endif()
+ file(GLOB link_libs LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/lib/*" "${CURRENT_PACKAGES_DIR}/bin/*.dll")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include" ${link_libs})
+endif()
+
+if("tools" IN_LIST FEATURES)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/gettext/user-email" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../.." IGNORE_UNCHANGED)
+else()
+ # A fast installation of the autopoint tool and data, needed for autoconfig
+ include("${CMAKE_CURRENT_LIST_DIR}/install-autopoint.cmake")
+ install_autopoint()
+endif()
+
+# These files can be needed to run `autoreconf`.
+# We want to install these files also for fast "core" builds without "tools".
+# Cf. PACKAGING for the file list.
+file(INSTALL
+ "${SOURCE_PATH}/gettext-runtime/m4/build-to-host.m4"
+ "${SOURCE_PATH}/gettext-runtime/m4/gettext.m4"
+ "${SOURCE_PATH}/gettext-runtime/m4/iconv.m4"
+ "${SOURCE_PATH}/gettext-runtime/m4/intlmacosx.m4"
+ "${SOURCE_PATH}/gettext-runtime/m4/nls.m4"
+ "${SOURCE_PATH}/gettext-runtime/m4/po.m4"
+ "${SOURCE_PATH}/gettext-runtime/m4/progtest.m4"
+ "${SOURCE_PATH}/gettext-runtime/gnulib-m4/host-cpu-c-abi.m4"
+ "${SOURCE_PATH}/gettext-runtime/gnulib-m4/lib-ld.m4"
+ "${SOURCE_PATH}/gettext-runtime/gnulib-m4/lib-link.m4"
+ "${SOURCE_PATH}/gettext-runtime/gnulib-m4/lib-prefix.m4"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/share/gettext/aclocal"
+)
+
+if(NOT VCPKG_CROSSCOMPILING)
+ file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/gettext")
+endif()
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/gettext-runtime/COPYING" "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/gettext/rel_path.patch b/vcpkg/ports/gettext/rel_path.patch
new file mode 100644
index 0000000..c0301cc
--- /dev/null
+++ b/vcpkg/ports/gettext/rel_path.patch
@@ -0,0 +1,31 @@
+diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in
+index 3a24eee5d..56b36d5ff 100644
+--- a/gettext-tools/misc/autopoint.in
++++ b/gettext-tools/misc/autopoint.in
+@@ -27,8 +27,9 @@ archive_version=@ARCHIVE_VERSION@
+
+ # Set variables
+ # - gettext_datadir directory where the data files are stored.
+-prefix="@prefix@"
+-datarootdir="@datarootdir@"
++
++prefix="$(dirname "$0")/../../../"
++datarootdir="${prefix}/share/gettext"
+ : ${gettext_datadir="@datadir@/gettext"}
+ : ${AUTOM4TE=autom4te}
+
+diff --git a/gettext-tools/misc/gettextize.in b/gettext-tools/misc/gettextize.in
+index c78c308bf..175ad57e7 100644
+--- a/gettext-tools/misc/gettextize.in
++++ b/gettext-tools/misc/gettextize.in
+@@ -27,8 +27,8 @@ archive_version=@ARCHIVE_VERSION@
+
+ # Set variables
+ # - gettext_datadir directory where the data files are stored.
+-prefix="@prefix@"
+-datarootdir="@datarootdir@"
++prefix="$(dirname "$0")/../../../"
++datarootdir="${prefix}/share/gettext"
+ : ${gettext_datadir="@datadir@/gettext"}
+ : ${AUTOM4TE=autom4te}
+
diff --git a/vcpkg/ports/gettext/subdirs.patch b/vcpkg/ports/gettext/subdirs.patch
new file mode 100644
index 0000000..9931fed
--- /dev/null
+++ b/vcpkg/ports/gettext/subdirs.patch
@@ -0,0 +1,127 @@
+diff --git a/configure b/configure
+index 904bdf5..e751ffc 100755
+--- a/configure
++++ b/configure
+@@ -2797,7 +2797,7 @@ am__tar='${AMTAR} chf - --format=ustar --owner=root --group=root "$$tardir"'
+
+
+
+-subdirs="$subdirs gettext-runtime libtextstyle gettext-tools"
++subdirs="$subdirs gettext-runtime $(echo ${VCPKG_GETTEXT_SUBDIRS} | sed 's/gettext-runtime//')"
+
+
+
+diff --git a/Makefile.in b/Makefile.in
+index a287d38..075ddc5 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -311,7 +311,7 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
+ ACLOCAL_AMFLAGS = -I m4
+-SUBDIRS = gnulib-local gettext-runtime libtextstyle gettext-tools
++SUBDIRS = $(VCPKG_GETTEXT_SUBDIRS)
+ changelog_etc = \
+ gettext-runtime/ChangeLog.0 \
+ gettext-runtime/doc/ChangeLog.0 \
+diff --git a/gettext-runtime/Makefile.in b/gettext-runtime/Makefile.in
+index 8b8b5bc..bb75447 100644
+--- a/gettext-runtime/Makefile.in
++++ b/gettext-runtime/Makefile.in
+@@ -1487,7 +1487,7 @@ ACLOCAL_AMFLAGS = -I m4 -I ../m4 -I gnulib-m4
+ # The list of subdirectories depends on whether --disable-libasprintf was
+ # specified.
+ @ENABLE_LIBASPRINTF_TRUE@SUBDIR_libasprintf = libasprintf
+-SUBDIRS = doc intl intl-java intl-csharp gnulib-lib $(SUBDIR_libasprintf) src po man m4 tests
++SUBDIRS = $(VCPKG_INTL) gnulib-lib src po
+
+ # Allow users to use "gnulib-tool --update".
+
+diff --git a/gettext-runtime/configure b/gettext-runtime/configure
+index a7594ed..296f3b7 100644
+--- a/gettext-runtime/configure
++++ b/gettext-runtime/configure
+@@ -26906,7 +26906,7 @@ printf "%s\n" "$ac_res" >&6; }
+
+ if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
+ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+- && test "$PACKAGE" != gettext-runtime \
++ && test "$PACKAGE" != pristine-gettext-runtime \
+ && test "$PACKAGE" != gettext-tools \
+ && test "$PACKAGE" != libintl; }; then
+ gt_use_preinstalled_gnugettext=yes
+diff --git a/gettext-runtime/libasprintf/configure b/gettext-runtime/libasprintf/configure
+--- a/gettext-runtime/libasprintf/configure
++++ b/gettext-runtime/libasprintf/configure
+index ff1c212..0c0dbcd 100644
+@@ -11,6 +11,7 @@
+ #
+ # This configure script is free software; the Free Software Foundation
+ # gives unlimited permission to copy, distribute and modify it.
++exit 0;
+ ## -------------------- ##
+ ## M4sh Initialization. ##
+ ## -------------------- ##
+diff --git a/gettext-tools/Makefile.in b/gettext-tools/Makefile.in
+index 59e81a8..107856d 100644
+--- a/gettext-tools/Makefile.in
++++ b/gettext-tools/Makefile.in
+@@ -2872,7 +2872,7 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
+ ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
+-SUBDIRS = gnulib-lib libgrep src libgettextpo po its projects styles emacs misc man m4 tests system-tests gnulib-tests examples doc
++SUBDIRS = gnulib-lib libgrep src po its projects styles misc
+
+ # Allow users to use "gnulib-tool --update".
+
+diff --git a/gettext-tools/configure b/gettext-tools/configure
+index 056a830..9abca7e 100644
+--- a/gettext-tools/configure
++++ b/gettext-tools/configure
+@@ -29661,7 +29661,7 @@ printf "%s\n" "$ac_res" >&6; }
+ if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
+ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+ && test "$PACKAGE" != gettext-runtime \
+- && test "$PACKAGE" != gettext-tools \
++ && test "$PACKAGE" != pristine-gettext-tools \
+ && test "$PACKAGE" != libintl; }; then
+ gt_use_preinstalled_gnugettext=yes
+ else
+diff --git a/gettext-tools/examples/configure b/gettext-tools/examples/configure
+--- a/gettext-tools/examples/configure
++++ b/gettext-tools/examples/configure
+index ff1c212..0c0dbcd 100644
+@@ -11,6 +11,7 @@
+ #
+ # This configure script is free software; the Free Software Foundation
+ # gives unlimited permission to copy, distribute and modify it.
++exit 0;
+ ## -------------------- ##
+ ## M4sh Initialization. ##
+ ## -------------------- ##
+diff --git a/gettext-tools/src/Makefile.in b/gettext-tools/src/Makefile.in
+--- a/gettext-tools/src/Makefile.in
++++ b/gettext-tools/src/Makefile.in
+index ff1c212..0c0dbcd 100644
+@@ -4381,6 +4381,7 @@
+ $(AM_V_GEN)$(msgfilter_LINK) $(msgfilter_OBJECTS) $(msgfilter_LDADD) $(LIBS)
+ ../../gettext-runtime/intl/$(am__dirstamp):
+ @$(MKDIR_P) ../../gettext-runtime/intl
++ @$(MAKE) -C ../../gettext-runtime/intl libgnuintl.h
+ @: > ../../gettext-runtime/intl/$(am__dirstamp)
+ ../../gettext-runtime/intl/msgfmt-hash-string.$(OBJEXT): \
+ ../../gettext-runtime/intl/$(am__dirstamp)
+diff --git a/libtextstyle/Makefile.in b/libtextstyle/Makefile.in
+index ff1c212..0c0dbcd 100644
+--- a/libtextstyle/Makefile.in
++++ b/libtextstyle/Makefile.in
+@@ -1667,7 +1667,7 @@ AUTOMAKE_OPTIONS = 1.13 gnu no-dependencies
+ ACLOCAL_AMFLAGS = -I m4 -I gnulib-m4
+
+ # The list of subdirectories containing Makefiles.
+-SUBDIRS = lib tests adhoc-tests doc
++SUBDIRS = lib
+
+ # Allow users to use "gnulib-tool --update".
+
diff --git a/vcpkg/ports/gettext/uwp.patch b/vcpkg/ports/gettext/uwp.patch
new file mode 100644
index 0000000..6fb61e5
--- /dev/null
+++ b/vcpkg/ports/gettext/uwp.patch
@@ -0,0 +1,56 @@
+diff --git a/gettext-runtime/gnulib-lib/fcntl.c b/gettext-runtime/gnulib-lib/fcntl.c
+index f9753c4..3a3caee 100644
+--- a/gettext-runtime/gnulib-lib/fcntl.c
++++ b/gettext-runtime/gnulib-lib/fcntl.c
+@@ -38,6 +38,12 @@
+ # define WIN32_LEAN_AND_MEAN
+ # include <windows.h>
+
++# if defined(WINAPI_FAMILY_PARTITION)
++# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
++# define HANDLE_FLAG_INHERIT 0
++# endif
++# endif
++
+ /* Get _get_osfhandle. */
+ # if GNULIB_MSVC_NOTHROW
+ # include "msvc-nothrow.h"
+diff --git a/gettext-runtime/gnulib-lib/localcharset.c b/gettext-runtime/gnulib-lib/localcharset.c
+index ec75427..9e063e4 100644
+--- a/gettext-runtime/gnulib-lib/localcharset.c
++++ b/gettext-runtime/gnulib-lib/localcharset.c
+@@ -34,6 +34,9 @@
+ #if defined _WIN32 && !defined __CYGWIN__
+ # define WINDOWS_NATIVE
+ # include <locale.h>
++# if !defined(WINAPI_FAMILY_PARTITION)
++# define WINAPI_FAMILY_PARTITION(x) (0)
++# endif
+ #endif
+
+ #if defined __EMX__
+@@ -912,6 +915,8 @@ locale_charset (void)
+ /* The canonical name cannot be determined. */
+ codeset = "";
+
++# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
++ codeset = "";
+ # elif defined WINDOWS_NATIVE
+
+ char buf[2 + 10 + 1];
+diff --git a/gettext-runtime/gnulib-lib/localename-unsafe.c b/gettext-runtime/gnulib-lib/localename-unsafe.c
+index d77bb81..3c6e055 100644
+--- a/gettext-runtime/gnulib-lib/localename-unsafe.c
++++ b/gettext-runtime/gnulib-lib/localename-unsafe.c
+@@ -69,6 +69,11 @@ extern char * getlocalename_l(int, locale_t);
+
+ #if defined _WIN32 && !defined __CYGWIN__
+ # define WINDOWS_NATIVE
++# if defined(WINAPI_FAMILY_PARTITION)
++# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
++# undef WIN32_NATIVE
++# endif
++# endif
+ # include "glthread/lock.h"
+ #endif
+
diff --git a/vcpkg/ports/gettext/vcpkg-port-config.cmake b/vcpkg/ports/gettext/vcpkg-port-config.cmake
new file mode 100644
index 0000000..67a636b
--- /dev/null
+++ b/vcpkg/ports/gettext/vcpkg-port-config.cmake
@@ -0,0 +1,6 @@
+get_filename_component(gettext_tools_dir "${CMAKE_CURRENT_LIST_DIR}/../../tools/gettext/bin" ABSOLUTE)
+if(CMAKE_HOST_WIN32)
+ set(ENV{PATH} "$ENV{PATH};${gettext_tools_dir}")
+else()
+ set(ENV{PATH} "$ENV{PATH}:${gettext_tools_dir}")
+endif()
diff --git a/vcpkg/ports/gettext/vcpkg.json b/vcpkg/ports/gettext/vcpkg.json
new file mode 100644
index 0000000..522b2b2
--- /dev/null
+++ b/vcpkg/ports/gettext/vcpkg.json
@@ -0,0 +1,31 @@
+{
+ "name": "gettext",
+ "version": "0.22.5",
+ "port-version": 3,
+ "description": "A GNU framework to help produce multi-lingual messages.",
+ "homepage": "https://www.gnu.org/software/gettext/",
+ "license": "GPL-3.0-only",
+ "supports": "!xbox",
+ "dependencies": [
+ "gettext-libintl"
+ ],
+ "features": {
+ "nls": {
+ "description": "Enable native language support"
+ },
+ "runtime-tools": {
+ "description": "Build runtime tools for internationalization of scripts",
+ "supports": "!uwp",
+ "dependencies": [
+ "libiconv"
+ ]
+ },
+ "tools": {
+ "description": "Build gettext tools",
+ "supports": "!uwp",
+ "dependencies": [
+ "libiconv"
+ ]
+ }
+ }
+}