aboutsummaryrefslogtreecommitdiff
path: root/ports/gettext
diff options
context:
space:
mode:
Diffstat (limited to 'ports/gettext')
-rw-r--r--ports/gettext/CMakeLists.txt84
-rw-r--r--ports/gettext/CONTROL4
-rw-r--r--ports/gettext/portfile.cmake26
-rw-r--r--ports/gettext/unofficial-gettext-config.cmake1
4 files changed, 73 insertions, 42 deletions
diff --git a/ports/gettext/CMakeLists.txt b/ports/gettext/CMakeLists.txt
index c94ab4c13..cfd460e20 100644
--- a/ports/gettext/CMakeLists.txt
+++ b/ports/gettext/CMakeLists.txt
@@ -3,8 +3,6 @@ project(libintl C)
find_package(unofficial-iconv REQUIRED)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/config .)
-
set(CMAKE_STATIC_LIBRARY_PREFIX)
set(CMAKE_SHARED_LIBRARY_PREFIX)
@@ -23,27 +21,28 @@ else()
set(HAVE_ASPRINTF 1)
set(HAVE_WPRINTF 1)
set(HAVE_NEWLOCALE 1)
- add_definitions(-DHAVE_NEWLOCALE=1)
-
- set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
- set(THREADS_PREFER_PTHREAD_FLAG TRUE)
- find_package(Threads REQUIRED)
- if(NOT CMAKE_USE_PTHREADS_INIT)
- message(FATAL_ERROR "Error: Only pthreads is currently supported.")
- endif()
-
- include(CheckFunctionExists)
- include(CheckIncludeFiles)
-
- if(APPLE)
- set(HAVE_CFLOCALECOPYCURRENT 1)
- set(HAVE_CFPREFERENCESCOPYAPPVALUE 1)
- endif()
- check_function_exists(dcgettext HAVE_DCGETTEXT)
- check_include_files(features.h HAVE_FEATURES_H)
- check_function_exists(gettext HAVE_GETTEXT)
- check_include_files(mach-o/dyld.h HAVE_MACH_O_DYLD_H)
- check_function_exists(mempcpy HAVE_MEMPCPY)
+ add_definitions(-DHAVE_NEWLOCALE=1)
+ add_definitions(-DHAVE_NEWLOCALE=1)
+
+ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
+ find_package(Threads REQUIRED)
+ if(NOT CMAKE_USE_PTHREADS_INIT)
+ message(FATAL_ERROR "Error: Only pthreads is currently supported.")
+ endif()
+
+ include(CheckFunctionExists)
+ include(CheckIncludeFiles)
+
+ if(APPLE)
+ set(HAVE_CFLOCALECOPYCURRENT 1)
+ set(HAVE_CFPREFERENCESCOPYAPPVALUE 1)
+ endif()
+ check_function_exists(dcgettext HAVE_DCGETTEXT)
+ check_include_files(features.h HAVE_FEATURES_H)
+ check_function_exists(gettext HAVE_GETTEXT)
+ check_include_files(mach-o/dyld.h HAVE_MACH_O_DYLD_H)
+ check_function_exists(mempcpy HAVE_MEMPCPY)
check_include_files(xlocale.h HAVE_XLOCALE_H)
configure_file(intl/libgnuintl.in.h config/libgnuintl.h @ONLY)
@@ -106,18 +105,43 @@ add_definitions("-DBUILDING_LIBINTL -DIN_LIBINTL -DENABLE_RELOCATABLE=1 -DIN_LIB
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})
-target_link_libraries(libintl PRIVATE unofficial::iconv::libcharset unofficial::iconv::libiconv)
-if(APPLE)
- find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
- target_link_libraries(libintl PRIVATE ${COREFOUNDATION_LIBRARY})
-endif()
-if(NOT WIN32)
- target_link_libraries(libintl PRIVATE Threads::Threads)
+target_link_libraries(libintl PRIVATE unofficial::iconv::libcharset unofficial::iconv::libiconv)
+
+target_include_directories(libintl PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/config>
+ $<INSTALL_INTERFACE:include>
+)
+
+if(APPLE)
+ find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
+ target_link_libraries(libintl PRIVATE ${COREFOUNDATION_LIBRARY})
+endif()
+if(NOT WIN32)
+ target_link_libraries(libintl PRIVATE Threads::Threads)
endif()
install(TARGETS libintl
+ EXPORT unofficial-gettext-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
ARCHIVE DESTINATION lib
)
+install(
+ EXPORT unofficial-gettext-targets
+ FILE unofficial-gettext-targets.cmake
+ NAMESPACE unofficial::gettext::
+ DESTINATION share/unofficial-gettext
+)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-gettext-config.cmake" "
+include(CMakeFindDependencyMacro)
+find_dependency(unofficial-iconv)
+find_dependency(Threads)
+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 76e1d22d4..386fbd09c 100644
--- a/ports/gettext/CONTROL
+++ b/ports/gettext/CONTROL
@@ -1,4 +1,4 @@
Source: gettext
-Version: 0.19-5
-Description: The GNU gettext utilities are a set of tools that provides a framework to help other GNU packages produce multi-lingual messages
+Version: 0.19-8
+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 2a26817d7..d7283cc90 100644
--- a/ports/gettext/portfile.cmake
+++ b/ports/gettext/portfile.cmake
@@ -1,18 +1,28 @@
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+ file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-gettext-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/unofficial-gettext)
return()
endif()
#Based on https://github.com/winlibs/gettext
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gettext-0.19)
+
+set(GETTEXT_VERSION 0.19)
+
vcpkg_download_distfile(ARCHIVE
- URLS "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.tar.gz" "https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gettext/gettext-0.19.tar.gz"
- FILENAME "gettext-0.19.tar.gz"
+ 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 a5db035c582ff49d45ee6eab9466b2bef918e413a882019c204a9d8903cb3770ddfecd32c971ea7c7b037c7b69476cf7c56dcabc8b498b94ab99f132516c9922
)
-vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE ${ARCHIVE}
+ REF ${GETTEXT_VERSION}
+ PATCHES
+ 0001-Fix-macro-definitions.patch
+ 0002-Fix-uwp-build.patch
+)
file(COPY
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
@@ -24,12 +34,6 @@ file(REMOVE ${SOURCE_PATH}/gettext-runtime/intl/libgnuintl.h ${SOURCE_PATH}/gett
file(COPY ${CMAKE_CURRENT_LIST_DIR}/libgnuintl.win32.h DESTINATION ${SOURCE_PATH}/gettext-runtime/intl)
-vcpkg_apply_patches(
- 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}/gettext-runtime
PREFER_NINJA
@@ -38,6 +42,8 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-gettext TARGET_PATH share/unofficial-gettext)
+
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gettext)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/gettext/COPYING ${CURRENT_PACKAGES_DIR}/share/gettext/copyright)
diff --git a/ports/gettext/unofficial-gettext-config.cmake b/ports/gettext/unofficial-gettext-config.cmake
new file mode 100644
index 000000000..3b872142a
--- /dev/null
+++ b/ports/gettext/unofficial-gettext-config.cmake
@@ -0,0 +1 @@
+add_library(unofficial::gettext::libintl INTERFACE IMPORTED)