diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-03-01 17:13:57 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-03-02 09:25:29 -0800 |
| commit | 01ba04e9a737a2b68993e196b7980ce56b8fde00 (patch) | |
| tree | f71c879d22bc5b8b4f256a85c5e43b13951dbee2 | |
| parent | 5a83ee13619762afd495e7ffb0dd2e775843ecff (diff) | |
| download | vcpkg-01ba04e9a737a2b68993e196b7980ce56b8fde00.tar.gz vcpkg-01ba04e9a737a2b68993e196b7980ce56b8fde00.zip | |
[gettext] Improve and simplify port
| -rw-r--r-- | ports/gettext/0002-Fix-uwp-build.patch | 18 | ||||
| -rw-r--r-- | ports/gettext/CMakeLists.txt | 66 | ||||
| -rw-r--r-- | ports/gettext/CMakeLists_libintl.txt | 54 | ||||
| -rw-r--r-- | ports/gettext/CONTROL | 1 | ||||
| -rw-r--r-- | ports/gettext/config.h | 12 | ||||
| -rw-r--r-- | ports/gettext/libgnuintl.h | 2 | ||||
| -rw-r--r-- | ports/gettext/portfile.cmake | 9 |
7 files changed, 90 insertions, 72 deletions
diff --git a/ports/gettext/0002-Fix-uwp-build.patch b/ports/gettext/0002-Fix-uwp-build.patch index 4e21ef1ed..154131544 100644 --- a/ports/gettext/0002-Fix-uwp-build.patch +++ b/ports/gettext/0002-Fix-uwp-build.patch @@ -1,7 +1,7 @@ -diff --git "a/gettext-0.19/gettext-runtime/intl/langprefs.c" "b/gettext-0.19/gettext-runtime/intl/langprefs.c" +diff --git "a/gettext-runtime/intl/langprefs.c" "b/gettext-runtime/intl/langprefs.c" index aeb1c4e9..2ac531be 100644 ---- "a/gettext-0.19/gettext-runtime/intl/langprefs.c" -+++ "b/gettext-0.19/gettext-runtime/intl/langprefs.c" +--- "a/gettext-runtime/intl/langprefs.c" ++++ "b/gettext-runtime/intl/langprefs.c" @@ -33,7 +33,13 @@ extern void _nl_locale_name_canonicalize (char *name); #endif @@ -17,10 +17,10 @@ index aeb1c4e9..2ac531be 100644 #endif #ifdef WIN32_NATIVE -diff --git "a/gettext-0.19/gettext-runtime/intl/localcharset.c" "b/gettext-0.19/gettext-runtime/intl/localcharset.c" +diff --git "a/gettext-runtime/intl/localcharset.c" "b/gettext-runtime/intl/localcharset.c" index 670b8e6c..035a96bd 100644 ---- "a/gettext-0.19/gettext-runtime/intl/localcharset.c" -+++ "b/gettext-0.19/gettext-runtime/intl/localcharset.c" +--- "a/gettext-runtime/intl/localcharset.c" ++++ "b/gettext-runtime/intl/localcharset.c" @@ -36,6 +36,16 @@ # define WINDOWS_NATIVE #endif @@ -56,10 +56,10 @@ index 670b8e6c..035a96bd 100644 static char buf[2 + 10 + 1]; -diff --git "a/gettext-0.19/gettext-runtime/intl/localename.c" "b/gettext-0.19/gettext-runtime/intl/localename.c" +diff --git "a/gettext-runtime/intl/localename.c" "b/gettext-runtime/intl/localename.c" index 108dd6f1..ace3aa88 100644 ---- "a/gettext-0.19/gettext-runtime/intl/localename.c" -+++ "b/gettext-0.19/gettext-runtime/intl/localename.c" +--- "a/gettext-runtime/intl/localename.c" ++++ "b/gettext-runtime/intl/localename.c" @@ -54,7 +54,13 @@ #endif diff --git a/ports/gettext/CMakeLists.txt b/ports/gettext/CMakeLists.txt index 410ff9c0a..ac6e37c81 100644 --- a/ports/gettext/CMakeLists.txt +++ b/ports/gettext/CMakeLists.txt @@ -1 +1,65 @@ -add_subdirectory(gettext-runtime)
\ No newline at end of file +cmake_minimum_required(VERSION 3.5)
+project(libintl C)
+
+find_library(ICONV_LIB NAMES iconv libiconv)
+find_path(ICONV_PATH iconv.h)
+
+find_library(CHARSET_LIB NAMES charset libcharset)
+find_path(CHARSET_PATH localcharset.h)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR} . ${ICONV_PATH} ${CHARSET_PATH})
+link_libraries(${CHARSET_LIB} ${ICONV_LIB})
+
+file(READ config.h _contents)
+if(NOT WIN32)
+ string(REPLACE "/* #undef HAVE_STPCPY */" "#define HAVE_STPCPY 1" _contents "${_contents}")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "${_contents}")
+
+FILE(GLOB SOURCES
+"intl/bindtextdom.c"
+"intl/dcgettext.c"
+"intl/dcigettext.c"
+"intl/dcngettext.c"
+"intl/dgettext.c"
+"intl/dngettext.c"
+"intl/explodename.c"
+"intl/finddomain.c"
+"intl/gettext.c"
+"intl/hash-string.c"
+"intl/intl-compat.c"
+"intl/l10nflist.c"
+"intl/langprefs.c"
+"intl/loadmsgcat.c"
+"intl/localealias.c"
+"intl/localename.c"
+"intl/lock.c"
+"intl/log.c"
+"intl/ngettext.c"
+"intl/osdep.c"
+"intl/plural-exp.c"
+"intl/plural.c"
+"intl/printf.c"
+"intl/relocatable.c"
+"intl/textdomain.c"
+"intl/version.c"
+)
+
+set(LOCALDIR "c:/gettext")
+
+add_definitions(-DLOCALEDIR=\"${LOCALDIR}\")
+add_definitions(-DLOCALE_ALIAS_PATH=\"${LOCALDIR}\")
+add_definitions(-DLIBDIR=\"${LOCALDIR}\")
+add_definitions(-DINSTALLDIR=\"${LOCALDIR}\")
+add_definitions("-DBUILDING_LIBINTL -DBUILDING_DLL -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_library(libintl ${SOURCES})
+
+install(TARGETS libintl
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION bin
+ ARCHIVE DESTINATION lib
+)
+
diff --git a/ports/gettext/CMakeLists_libintl.txt b/ports/gettext/CMakeLists_libintl.txt deleted file mode 100644 index f01cf632c..000000000 --- a/ports/gettext/CMakeLists_libintl.txt +++ /dev/null @@ -1,54 +0,0 @@ -cmake_policy(SET CMP0005 OLD) - -project(libintl) - -include_directories(".") - -FILE(GLOB SOURCES -"intl/bindtextdom.c" -"intl/dcgettext.c" -"intl/dcigettext.c" -"intl/dcngettext.c" -"intl/dgettext.c" -"intl/dngettext.c" -"intl/explodename.c" -"intl/finddomain.c" -"intl/gettext.c" -"intl/hash-string.c" -"intl/intl-compat.c" -"intl/l10nflist.c" -"intl/langprefs.c" -"intl/loadmsgcat.c" -"intl/localcharset.c" -"intl/localealias.c" -"intl/localename.c" -"intl/lock.c" -"intl/log.c" -"intl/ngettext.c" -"intl/osdep.c" -"intl/plural-exp.c" -"intl/plural.c" -"intl/printf.c" -"intl/relocatable.c" -"intl/textdomain.c" -"intl/version.c" -) - -set(LOCALDIR "c:\\gettext") - -add_definitions(-DLOCALEDIR=\\\"${LOCALDIR}\\\") -add_definitions(-DLOCALE_ALIAS_PATH=\\\"${LOCALDIR}\\\") -add_definitions(-DLIBDIR=\\\"${LOCALDIR}\\\") -add_definitions(-DINSTALLDIR=\\\"${LOCALDIR}\\\") -add_definitions("-DBUILDING_LIBINTL -DBUILDING_DLL -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_library(libintl ${SOURCES}) - -install(TARGETS libintl - RUNTIME DESTINATION bin - LIBRARY DESTINATION bin - ARCHIVE DESTINATION lib -) - diff --git a/ports/gettext/CONTROL b/ports/gettext/CONTROL index 882eb725f..ccb6f5aa4 100644 --- a/ports/gettext/CONTROL +++ b/ports/gettext/CONTROL @@ -1,3 +1,4 @@ Source: gettext Version: 0.19-2 Description: The GNU gettext utilities are a set of tools that provides a framework to help other GNU packages produce multi-lingual messages +Build-Depends: libiconv diff --git a/ports/gettext/config.h b/ports/gettext/config.h index 81811e937..bde4dfeeb 100644 --- a/ports/gettext/config.h +++ b/ports/gettext/config.h @@ -1,6 +1,12 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ +#ifndef WIN32 +# define _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_END +# define _GL_INLINE static inline +#endif + /* Disable function deprecated warnings */ #define _CRT_NONSTDC_NO_WARNINGS @@ -471,7 +477,9 @@ /* Define as the maximum value of type 'size_t', if the system doesn't define it. */ +#if defined(_WIN32) #define SIZE_MAX (((1UL << 31) - 1) * 2 + 1) +#endif /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'size_t'. */ @@ -607,7 +615,7 @@ /* Define as a signed type of the same size as size_t. */ #ifdef _WIN64 #define ssize_t __int64 -#else +#elif _WIN32 #define ssize_t __int32 #endif @@ -618,7 +626,7 @@ <inttypes.h> don't define. */ #ifdef _WIN64 #define uintmax_t unsigned __int64 -#else +#elif _WIN32 #define uintmax_t unsigned __int32 #endif diff --git a/ports/gettext/libgnuintl.h b/ports/gettext/libgnuintl.h index eac6c8c25..440da4d59 100644 --- a/ports/gettext/libgnuintl.h +++ b/ports/gettext/libgnuintl.h @@ -19,7 +19,7 @@ USA. */ #ifndef _LIBINTL_H #define _LIBINTL_H 1 -#ifdef BUILDING_LIBINTL +#if defined(_WIN32) && defined(libintl_EXPORTS) #define LIBINTL_DLL_EXPORTED __declspec(dllexport) #else #define LIBINTL_DLL_EXPORTED diff --git a/ports/gettext/portfile.cmake b/ports/gettext/portfile.cmake index baf4babf2..ef9f52563 100644 --- a/ports/gettext/portfile.cmake +++ b/ports/gettext/portfile.cmake @@ -17,20 +17,19 @@ vcpkg_download_distfile(ARCHIVE ) vcpkg_extract_source_archive(${ARCHIVE}) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_libintl.txt DESTINATION ${SOURCE_PATH}/gettext-runtime) -file(RENAME ${SOURCE_PATH}/gettext-runtime/CMakeLists_libintl.txt ${SOURCE_PATH}/gettext-runtime/CMakeLists.txt) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/gettext-runtime) file(COPY ${CMAKE_CURRENT_LIST_DIR}/libgnuintl.h DESTINATION ${SOURCE_PATH}/gettext-runtime/intl) file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h DESTINATION ${SOURCE_PATH}/gettext-runtime) vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ + SOURCE_PATH ${SOURCE_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-Fix-macro-definitions.patch" "${CMAKE_CURRENT_LIST_DIR}/0002-Fix-uwp-build.patch" ) vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH ${SOURCE_PATH}/gettext-runtime + PREFER_NINJA ) vcpkg_install_cmake() |
