[gettext] Split, fixes, faster build, checked-in config cache (#30429)

* [gettext] Preset more MSVC checks

* Modify configure to speed up windows builds

* Support checked-in config cache

* Collect config [skip actions]

* Add x64 config

* Collect config [skip actions]

* Re-use most of windows config.cache [skip actions]

* WIP [skip actions]

* WIP [skip actions]

* WIP [skip actions]

* WIP

* [mchehab-zbar] Update gettext dependencies

* Add missing patch

* Don't test find_package(Gettext)

* [vcpkg-autotools-cache] Script port for config caching

* Add missing file

* Remove vcpkg-autoconf-cache

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
This commit is contained in:
Kai Pastor 2023-05-22 02:56:14 +02:00 committed by GitHub
parent 892fd52dc4
commit 5b744ed753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 667 additions and 214 deletions

View File

@ -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

View File

@ -0,0 +1,12 @@
diff --color -ruN a/gettext-runtime/intl/dcigettext.c src/gettext-runtime/intl/dcigettext.c
--- a/gettext-runtime/intl/dcigettext.c 2021-05-26 16:27:55.420544597 +0200
+++ src/gettext-runtime/intl/dcigettext.c 2021-05-26 16:29:14.546516701 +0200
@@ -143,7 +143,7 @@
# else
# if VMS
# define getcwd(buf, max) (getcwd) (buf, max, 0)
-# else
+# elif !(defined(__clang__) && defined(__BIONIC_FORTIFY))
char *getcwd ();
# endif
# endif

View File

@ -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()

View File

@ -0,0 +1,123 @@
if(VCPKG_TARGET_IS_LINUX)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
if(NOT EXISTS "/usr/include/libintl.h")
message(FATAL_ERROR
"When targeting Linux, `libintl.h` is expected to come from the C Runtime Library (glibc). "
"Please use \"sudo apt-get install libc-dev\" or the equivalent to install development files."
)
endif()
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
return()
endif()
set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled)
vcpkg_download_distfile(ARCHIVE
URLS "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 ccd43a43fab3c90ed99b3e27628c9aeb7186398153b137a4997f8c7ddfd9729b0ba9d15348567e5206af50ac027673d2b8a3415bb3fc65f87ad778f85dc03a05
)
vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
# Shared with port gettext
android.patch
uwp.patch
0003-Fix-win-unicode-paths.patch
)
if(VCPKG_HOST_IS_WINDOWS)
message(STATUS "Modifying 'configure' to use fast bash variable expansion")
set(ENV{CONFIG_SHELL} "/usr/bin/bash")
vcpkg_execute_required_process(
COMMAND "${CMAKE_COMMAND}"
"-DSOURCE_DIRS=gettext-runtime"
-P "${CMAKE_CURRENT_LIST_DIR}/bashify.cmake"
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "bashify-${TARGET_TRIPLET}"
)
endif()
set(OPTIONS
--no-recursion
--enable-relocatable #symbol duplication with glib-init.c?
--enable-c++
--disable-acl
--disable-csharp
--disable-curses
--disable-java
--disable-libasprintf
--disable-openmp
--with-included-gettext
--without-libintl-prefix
--disable-dependency-tracking # Faster ?
ac_cv_path_DVIPS=:
ac_cv_path_GMSGFMT=:
ac_cv_path_MSGFMT=:
ac_cv_path_MSGMERGE=:
ac_cv_path_TEXI2PDF=:
ac_cv_path_XGETTEXT=:
ac_cv_prog_INTLBISON=:
)
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS
# Avoid unnecessary tests.
am_cv_func_iconv_works=yes
"--with-libiconv-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
)
if(NOT VCPKG_TARGET_IS_MINGW)
list(APPEND OPTIONS
# 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
# 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_mbrtowc_empty_input=no
# 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")
file(REMOVE "${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}-dbg.log")
vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}/gettext-runtime"
DETERMINE_BUILD_TRIPLET
USE_WRAPPERS
OPTIONS
${OPTIONS}
OPTIONS_RELEASE
"--cache-file=${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}-rel.log"
OPTIONS_DEBUG
"--cache-file=${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}-dbg.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}*/intl/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(SUBPATH intl)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/intl")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/gettext-runtime/intl/COPYING.LIB")

View File

@ -0,0 +1,4 @@
gettext-libintl is compatible with built-in CMake targets:
find_package(Intl REQUIRED)
target_link_libraries(main PRIVATE Intl::Intl) # since CMake 3.20

View File

@ -0,0 +1,72 @@
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/intl/langprefs.c b/gettext-runtime/intl/langprefs.c
index f774ba2..f488b7f 100644
--- a/gettext-runtime/intl/langprefs.c
+++ b/gettext-runtime/intl/langprefs.c
@@ -38,6 +38,11 @@ extern void _nl_locale_name_canonicalize (char *name);
#if defined _WIN32
# define WIN32_NATIVE
+# if defined(WINAPI_FAMILY_PARTITION)
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+# undef WIN32_NATIVE
+# endif
+# endif
#endif
#ifdef WIN32_NATIVE
diff --git a/gettext-runtime/intl/localcharset.c b/gettext-runtime/intl/localcharset.c
index ec75427..9e063e4 100644
--- a/gettext-runtime/intl/localcharset.c
+++ b/gettext-runtime/intl/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/intl/localename.c b/gettext-runtime/intl/localename.c
index d77bb81..3c6e055 100644
--- a/gettext-runtime/intl/localename.c
+++ b/gettext-runtime/intl/localename.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
# if !defined IN_LIBINTL
# include "glthread/lock.h"
# endif

View File

@ -0,0 +1,13 @@
{
"name": "gettext-libintl",
"version": "0.21.1",
"description": "The libintl C library from GNU gettext-runtime.",
"homepage": "https://www.gnu.org/software/gettext/",
"license": "LGPL-2.1-or-later",
"dependencies": [
{
"name": "libiconv",
"platform": "!linux"
}
]
}

View File

@ -1,70 +0,0 @@
all: build-gettext-runtime-intl build-gettext-runtime-po build-gettext-runtime-src
all: build-gettext-tools build-gettext-tools-gnulib build-gettext-tools-its build-gettext-tools-m4 build-gettext-tools-misc build-gettext-tools-po build-gettext-tools-projects build-gettext-tools-styles
all: build-libtextstyle
install: install-gettext-runtime-intl install-gettext-runtime-po install-gettext-runtime-src
install: install-gettext-tools install-gettext-tools-gnulib install-gettext-tools-its install-gettext-tools-m4 install-gettext-tools-misc install-gettext-tools-po install-gettext-tools-projects install-gettext-tools-styles
install: install-libtextstyle
build-intl:
$(MAKE) -C intl all
install-intl:
$(MAKE) -C intl install
build-gettext-runtime-gnulib: build-gettext-runtime-intl
$(MAKE) -C gettext-runtime/gnulib-lib all
build-gettext-runtime-intl:
$(MAKE) -C gettext-runtime/intl all
build-gettext-runtime-po:
$(MAKE) -C gettext-runtime/po all
build-gettext-runtime-src: build-gettext-runtime-intl build-gettext-runtime-gnulib
$(MAKE) -C gettext-runtime/src all
build-gettext-tools: build-gettext-runtime-intl build-libtextstyle build-gettext-tools-gnulib build-gettext-tools-intl build-gettext-tools-libgrep build-gnulib-local
$(MAKE) -C gettext-tools/src all
build-gettext-tools-gnulib: build-gettext-tools-intl
$(MAKE) -C gettext-tools/gnulib-lib all
build-gettext-tools-libgrep: build-gettext-tools-gnulib
$(MAKE) -C gettext-tools/libgrep all
build-gettext-tools-intl:
$(MAKE) -C gettext-tools/intl all
build-gettext-tools-its:
$(MAKE) -C gettext-tools/its all
build-gettext-tools-m4:
$(MAKE) -C gettext-tools/m4 all
build-gettext-tools-misc:
$(MAKE) -C gettext-tools/misc all
build-gettext-tools-po:
$(MAKE) -C gettext-tools/po all
build-gettext-tools-projects:
$(MAKE) -C gettext-tools/projects all
build-gettext-tools-styles:
$(MAKE) -C gettext-tools/styles all
build-gnulib-local:
$(MAKE) -C gnulib-local all
build-libtextstyle:
$(MAKE) -C libtextstyle/lib all
install-gettext-runtime-intl:
$(MAKE) -C gettext-runtime/intl install
install-gettext-runtime-po:
$(MAKE) -C gettext-runtime/po install
install-gettext-runtime-src:
$(MAKE) -C gettext-runtime/src install
install-gettext-tools:
$(MAKE) -C gettext-tools/src install
install-gettext-tools-gnulib:
$(MAKE) -C gettext-tools/gnulib-lib install
install-gettext-tools-its:
$(MAKE) -C gettext-tools/its install
install-gettext-tools-m4:
$(MAKE) -C gettext-tools/m4 install
install-gettext-tools-misc:
$(MAKE) -C gettext-tools/misc install
install-gettext-tools-po:
$(MAKE) -C gettext-tools/po install
install-gettext-tools-projects:
$(MAKE) -C gettext-tools/projects install
install-gettext-tools-styles:
$(MAKE) -C gettext-tools/styles install
install-libtextstyle:
$(MAKE) -C libtextstyle/lib install

View File

@ -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()

View File

@ -0,0 +1,13 @@
diff --git a/gettext-runtime/configure b/gettext-runtime/configure
index c21955a..902729a 100755
--- a/gettext-runtime/configure
+++ b/gettext-runtime/configure
@@ -26819,7 +26819,7 @@ else $as_nop
gt_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $INCINTL"
gt_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBINTL"
+ LIBS="$LIBS $LIBINTL $INTL_MACOSX_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

View File

@ -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.

View File

@ -1,10 +1,16 @@
if(VCPKG_TARGET_IS_LINUX AND NOT EXISTS "/usr/include/libintl.h")
message(FATAL_ERROR "When targeting Linux, `libintl.h` is expected to come from the C Runtime Library (glibc). "
"Please use \"sudo apt-get install libc-dev\" or the equivalent to install development files."
)
endif()
set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled)
# 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://ftp.gnu.org/pub/gnu/gettext/gettext-${VERSION}.tar.gz"
@ -16,137 +22,168 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
# shared with port gettext-libintl
android.patch
uwp.patch
win-gethostname.patch
0003-Fix-win-unicode-paths.patch
# unique to port gettext
win-gethostname.patch
rel_path.patch
subdirs.patch
parallel-gettext-tools.patch
macosx-libs.patch
)
vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_PATH "${BISON}" DIRECTORY)
vcpkg_add_to_path("${BISON_PATH}")
set(OPTIONS
--enable-relocatable #symbol duplication with glib-init.c?
--enable-c++
--disable-acl
--disable-csharp
--disable-curses
--disable-java
--disable-openmp
)
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS
# Avoid unnecessary test.
--with-included-glib
# 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
ac_cv_header_pthread_h=no
ac_cv_header_dirent_h=no
ac_cv_header_getopt_h=no
)
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}")
# These functions scope any changes to VCPKG_BUILD_TYPE
function(build_libintl_and_tools)
cmake_parse_arguments(arg "" "BUILD_TYPE" "" ${ARGN})
if(DEFINED arg_BUILD_TYPE)
set(VCPKG_BUILD_TYPE "${arg_BUILD_TYPE}")
vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_PATH "${BISON}" DIRECTORY)
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
)
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
ADD_BIN_TO_PATH # So configure can check for working iconv
ADDITIONAL_MSYS_PACKAGES gzip
OPTIONS
${OPTIONS}
OPTIONS_RELEASE
"--cache-file=${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}-rel.log"
)
vcpkg_install_make(MAKEFILE "${CMAKE_CURRENT_LIST_DIR}/Makefile")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/gettext/user-email" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../..")
endfunction()
function(build_libintl_only)
cmake_parse_arguments(arg "" "BUILD_TYPE" "" ${ARGN})
if(DEFINED arg_BUILD_TYPE)
set(VCPKG_BUILD_TYPE "${arg_BUILD_TYPE}")
endif()
vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}/gettext-runtime"
DETERMINE_BUILD_TRIPLET
USE_WRAPPERS
ADD_BIN_TO_PATH # So configure can check for working iconv
OPTIONS
${OPTIONS}
)
vcpkg_install_make(
MAKEFILE "${CMAKE_CURRENT_LIST_DIR}/Makefile"
BUILD_TARGET build-intl
INSTALL_TARGET install-intl
)
endfunction()
# 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 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)
# Minimization of gettext tools build time by:
# - building tools only for release configuration
# - custom top-level Makefile
# - configuration cache
list(APPEND OPTIONS "--cache-file=../config.cache-${TARGET_TRIPLET}")
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}")
build_libintl_and_tools(BUILD_TYPE "release")
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
file(GLOB tool_libs
LIST_DIRECTORIES false
"${CURRENT_PACKAGES_DIR}/bin/*"
"${CURRENT_PACKAGES_DIR}/lib/*"
)
list(FILTER tool_libs EXCLUDE REGEX "intl[^/\\\\]*$")
file(REMOVE ${tool_libs})
file(GLOB tool_includes
LIST_DIRECTORIES true
"${CURRENT_PACKAGES_DIR}/include/*"
)
list(FILTER tool_includes EXCLUDE REGEX "intl[^/\\\\]*$")
file(REMOVE_RECURSE ${tool_includes})
if(VCPKG_TARGET_IS_LINUX)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
elseif(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}.release")
file(RENAME "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}.release")
file(READ "${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}" config_cache)
string(REGEX REPLACE "\nac_cv_env[^\n]*" "" config_cache "${config_cache}") # Eliminate build type flags
file(WRITE "${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}" "${config_cache}")
build_libintl_only(BUILD_TYPE "debug")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug" "${CURRENT_PACKAGES_DIR}.release/debug")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}")
file(RENAME "${CURRENT_PACKAGES_DIR}.release" "${CURRENT_PACKAGES_DIR}")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/gettext/user-email" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../..")
else()
if(VCPKG_TARGET_IS_LINUX)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
else()
list(APPEND OPTIONS "--config-cache")
build_libintl_only()
endif()
# A fast installation of the autopoint tool and data, needed for autotools
# A fast installation of the autopoint tool and data, needed for autoconfig
include("${CMAKE_CURRENT_LIST_DIR}/install-autopoint.cmake")
install_autopoint()
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# 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/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"
)
vcpkg_copy_pdbs()
if(NOT VCPKG_TARGET_IS_LINUX)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/intl")
endif()
if("tools" IN_LIST FEATURES AND NOT VCPKG_CROSSCOMPILING)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
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")

115
ports/gettext/subdirs.patch Normal file
View File

@ -0,0 +1,115 @@
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 $VCPKG_GETTEXT_SUBDIRS"
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; }; then
gt_use_preinstalled_gnugettext=yes
else
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 = intl gnulib-lib libgrep src libgettextpo po its projects styles emacs misc man m4 tests system-tests gnulib-tests examples doc
+SUBDIRS = intl 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; }; then
+ && test "$PACKAGE" != pristine-gettext-tools; }; then
gt_use_preinstalled_gnugettext=yes
else
LIBINTL=
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/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".

View File

@ -1,16 +1,24 @@
{
"name": "gettext",
"version": "0.21.1",
"description": "GNU gettext provides libintl and a set of tools to help produce multi-lingual messages.",
"port-version": 1,
"description": "A GNU framework to help produce multi-lingual messages.",
"homepage": "https://www.gnu.org/software/gettext/",
"license": null,
"license": "GPL-3.0-only",
"dependencies": [
"libiconv"
"gettext-libintl"
],
"features": {
"runtime-tools": {
"description": "Build runtime tools for internationalization of scripts",
"supports": "!uwp"
},
"tools": {
"description": "Build gettext tools",
"supports": "!uwp"
"supports": "!uwp",
"dependencies": [
"libiconv"
]
}
}
}

View File

@ -17,29 +17,9 @@ if("nls" IN_LIST FEATURES)
else()
vcpkg_list(APPEND options "--disable-nls")
set(ENV{AUTOPOINT} true) # true, the program
# Simulate the relevant effects of (interactive) `gettextize`.
file(TOUCH "${SOURCE_PATH}/po/Makefile.in.in")
# Get missing build-time m4 files from gettext source
set(gettext_version 0.21.1)
vcpkg_download_distfile(gettext_archive
URLS "https://ftp.gnu.org/pub/gnu/gettext/gettext-${gettext_version}.tar.gz"
"https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gettext/gettext-${gettext_version}.tar.gz"
FILENAME "gettext-${gettext_version}.tar.gz"
SHA512 ccd43a43fab3c90ed99b3e27628c9aeb7186398153b137a4997f8c7ddfd9729b0ba9d15348567e5206af50ac027673d2b8a3415bb3fc65f87ad778f85dc03a05
)
file(ARCHIVE_EXTRACT INPUT "${gettext_archive}"
DESTINATION "${SOURCE_PATH}/gettext-autoconf"
PATTERNS "*/gettext-runtime/m4/gettext.m4"
"*/gettext-runtime/m4/iconv.m4"
"*/gettext-runtime/m4/intlmacosx.m4"
"*/gettext-runtime/m4/nls.m4"
"*/gettext-runtime/m4/po.m4"
"*/gettext-runtime/m4/progtest.m4"
"*/gettext-runtime/gnulib-m4/host-cpu-c-abi.m4"
"*/gettext-runtime/gnulib-m4/lib-ld.m4"
"*/gettext-runtime/gnulib-m4/lib-link.m4"
"*/gettext-runtime/gnulib-m4/lib-prefix.m4"
)
file(GLOB_RECURSE m4_files "${SOURCE_PATH}/gettext-autoconf/*/*.m4")
file(GLOB_RECURSE m4_files "${CURRENT_HOST_INSTALLED_DIR}/share/gettext/aclocal/*.m4")
file(INSTALL ${m4_files} DESTINATION "${SOURCE_PATH}/config")
endif()

View File

@ -1,26 +1,30 @@
{
"name": "mchehab-zbar",
"version": "0.23.90",
"port-version": 3,
"port-version": 4,
"description": "ZBar is an open source software suite for reading bar codes from various sources, including webcams. This fork is actively maintained.",
"homepage": "https://github.com/mchehab/zbar",
"license": "LGPL-2.1-or-later",
"supports": "!uwp",
"dependencies": [
{
"name": "gettext",
"host": true
},
"libiconv"
],
"features": {
"nls": {
"description": "Native Language Support",
"dependencies": [
"gettext",
{
"name": "gettext",
"host": true,
"features": [
"tools"
]
}
},
"gettext-libintl"
]
}
}

View File

@ -79,7 +79,7 @@
},
{
"$package": "Intl",
"name": "gettext"
"name": "gettext-libintl"
},
{
"$package": "GIF",

View File

@ -2765,6 +2765,10 @@
"port-version": 7
},
"gettext": {
"baseline": "0.21.1",
"port-version": 1
},
"gettext-libintl": {
"baseline": "0.21.1",
"port-version": 0
},
@ -5142,7 +5146,7 @@
},
"mchehab-zbar": {
"baseline": "0.23.90",
"port-version": 3
"port-version": 4
},
"mcpp": {
"baseline": "2.7.2.14",

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "783d7b1a2ddaf29b0f1a2d785ccfbb4a05615667",
"version": "0.21.1",
"port-version": 0
}
]
}

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "6cc01d324fb1fc9a461212e5577ec9897d7da345",
"version": "0.21.1",
"port-version": 1
},
{
"git-tree": "4c583e9adc3ab9a044b241466cebedf162cdc410",
"version": "0.21.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "34932d2a4b1c53aefeed99ef9133f8a307ad9958",
"version": "0.23.90",
"port-version": 4
},
{
"git-tree": "09371ba90d3c31d038bffd54a90203b5b4f7fdc8",
"version": "0.23.90",