aboutsummaryrefslogtreecommitdiff
path: root/ports/gettext
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2020-02-04 15:50:10 -0800
committerRobert Schumacher <roschuma@microsoft.com>2020-02-04 15:50:10 -0800
commit6f66ad14fe9da11d4bf50f5b25b4da86ed971c53 (patch)
tree0f5dbcd1719cd6a8e486c4058cfefd607d58aa6c /ports/gettext
parentd502f061bb3ee0258d6453acbf258b9e5d93d564 (diff)
parentd808514c9df44bb97d6eccff952bfe8ec4e156f7 (diff)
downloadvcpkg-6f66ad14fe9da11d4bf50f5b25b4da86ed971c53.tar.gz
vcpkg-6f66ad14fe9da11d4bf50f5b25b4da86ed971c53.zip
Merge remote-tracking branch 'origin/master' into HEAD
Diffstat (limited to 'ports/gettext')
-rw-r--r--ports/gettext/0003-Fix-win-unicode-paths.patch60
-rw-r--r--ports/gettext/CMakeLists.txt8
-rw-r--r--ports/gettext/CONTROL2
-rw-r--r--ports/gettext/portfile.cmake7
4 files changed, 69 insertions, 8 deletions
diff --git a/ports/gettext/0003-Fix-win-unicode-paths.patch b/ports/gettext/0003-Fix-win-unicode-paths.patch
new file mode 100644
index 000000000..f86c52c86
--- /dev/null
+++ b/ports/gettext/0003-Fix-win-unicode-paths.patch
@@ -0,0 +1,60 @@
+diff --git "a/gettext-runtime/intl/loadmsgcat.c" "b/gettext-runtime/intl/loadmsgcat.c"
+index 63351523..c078de3f 100644
+--- a/gettext-runtime/intl/loadmsgcat.c
++++ b/gettext-runtime/intl/loadmsgcat.c
+@@ -477,6 +477,55 @@ char *alloca ();
+ # define munmap(addr, len) __munmap (addr, len)
+ #endif
+
++#ifdef _WIN32
++/* 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
++# undef NOMINMAX
++# define NOMINMAX
++# 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;
++}
++# define open(name, flags) _open_utf8_windows_wrapper(name, flags)
++#endif // #ifdef _WIN32
++
+ /* For those losing systems which don't have `alloca' we have to add
+ some additional code emulating it. */
+ #ifdef HAVE_ALLOCA
diff --git a/ports/gettext/CMakeLists.txt b/ports/gettext/CMakeLists.txt
index 1ec9aa285..57d5a14e5 100644
--- a/ports/gettext/CMakeLists.txt
+++ b/ports/gettext/CMakeLists.txt
@@ -102,7 +102,7 @@ if(BUILD_SHARED_LIBS)
endif()
add_definitions("-DBUILDING_LIBINTL -DIN_LIBINTL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY")
-add_definitions("-DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -D_CRT_SECURE_NO_WARNINGS")
+add_definitions("-DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -DHAVE_ICONV -DHAVE_ICONV_H -DICONV_CONST=const -D_CRT_SECURE_NO_WARNINGS")
add_library(libintl ${SOURCES})
target_link_libraries(libintl PRIVATE unofficial::iconv::libcharset unofficial::iconv::libiconv)
@@ -120,13 +120,13 @@ if(NOT WIN32)
target_link_libraries(libintl PRIVATE Threads::Threads)
endif()
if (WIN32)
- target_link_libraries(libintl PRIVATE Advapi32.lib)
+ target_link_libraries(libintl PRIVATE kernel32.lib Advapi32.lib)
endif()
install(TARGETS libintl
EXPORT unofficial-gettext-targets
RUNTIME DESTINATION bin
- LIBRARY DESTINATION bin
+ LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
@@ -147,4 +147,4 @@ include(\${CMAKE_CURRENT_LIST_DIR}/unofficial-gettext-targets.cmake)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-gettext-config.cmake
DESTINATION share/unofficial-gettext
-) \ No newline at end of file
+)
diff --git a/ports/gettext/CONTROL b/ports/gettext/CONTROL
index 1816f8b76..5cfa7b0d7 100644
--- a/ports/gettext/CONTROL
+++ b/ports/gettext/CONTROL
@@ -1,5 +1,5 @@
Source: gettext
-Version: 0.19-11
+Version: 0.19-14
Homepage: https://www.gnu.org/software/gettext/
Description: The GNU gettext utilities are a set of tools that provides a framework to help other GNU packages produce multi-lingual messages. Provides libintl.
Build-Depends: libiconv
diff --git a/ports/gettext/portfile.cmake b/ports/gettext/portfile.cmake
index a9ab3d2e7..988c2f439 100644
--- a/ports/gettext/portfile.cmake
+++ b/ports/gettext/portfile.cmake
@@ -1,16 +1,16 @@
-if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+if(VCPKG_TARGET_IS_LINUX)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
if (NOT EXISTS "/usr/include/libintl.h")
message(FATAL_ERROR "Please use command \"sudo apt-get install gettext\" to install gettext on linux.")
endif()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-gettext-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/unofficial-gettext)
return()
+else()
+ set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled)
endif()
#Based on https://github.com/winlibs/gettext
-include(vcpkg_common_functions)
-
set(GETTEXT_VERSION 0.19)
vcpkg_download_distfile(ARCHIVE
@@ -25,6 +25,7 @@ vcpkg_extract_source_archive_ex(
PATCHES
0001-Fix-macro-definitions.patch
0002-Fix-uwp-build.patch
+ 0003-Fix-win-unicode-paths.patch
)
file(COPY