Skip to content

Commit

Permalink
[gettext] Add "autopoint" tool to gettext[core] (#17317)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Aug 27, 2021
1 parent ab3095a commit c350a3b
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 15 deletions.
49 changes: 49 additions & 0 deletions ports/gettext/install-autopoint.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
function(install_autopoint)
# variables for configuring autopoint.in
set(PACKAGE "gettext-tools")
set(VERSION "${GETTEXT_VERSION}")
set(ARCHIVE_VERSION "${GETTEXT_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(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()
25 changes: 13 additions & 12 deletions ports/gettext/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
if(VCPKG_TARGET_IS_LINUX)
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()
if(NOT "tools" IN_LIST FEATURES)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
return()
endif()
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)
Expand Down Expand Up @@ -134,8 +128,15 @@ if("tools" IN_LIST FEATURES)
file(RENAME "${CURRENT_PACKAGES_DIR}.release" "${CURRENT_PACKAGES_DIR}")
endif()
else()
list(APPEND OPTIONS "--config-cache")
build_libintl_only()
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
include("${CMAKE_CURRENT_LIST_DIR}/install-autopoint.cmake")
install_autopoint()
endif()

# Handle copyright
Expand Down
4 changes: 2 additions & 2 deletions ports/gettext/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "gettext",
"version": "0.21",
"port-version": 4,
"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.",
"port-version": 5,
"description": "GNU gettext provides libintl and a set of tools to help produce multi-lingual messages.",
"homepage": "https://www.gnu.org/software/gettext/",
"dependencies": [
"libiconv"
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2286,7 +2286,7 @@
},
"gettext": {
"baseline": "0.21",
"port-version": 4
"port-version": 5
},
"gettimeofday": {
"baseline": "2017-10-14-3",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/gettext.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d1089dfcf335a94ca47c5b918c56a7ab6fc0ae92",
"version": "0.21",
"port-version": 5
},
{
"git-tree": "b6cde01ab4095a258993eaf85eb31c1e845c64a6",
"version": "0.21",
Expand Down

0 comments on commit c350a3b

Please sign in to comment.