vcpkg/ports/gettext/portfile.cmake

211 lines
8.7 KiB
CMake
Raw Normal View History

# 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)
2016-11-02 03:12:26 +08:00
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 d8b22d7fba10052a2045f477f0a5b684d932513bdb3b295c22fbd9dfc2a9d8fccd9aefd90692136c62897149aa2f7d1145ce6618aa1f0be787cb88eba5bc09be
2016-11-02 03:12:26 +08:00
)
vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
2023-12-23 16:45:21 +08:00
assume-modern-darwin.patch
uwp.patch
rel_path.patch
subdirs.patch
parallel-gettext-tools.patch
2023-12-19 05:09:44 +08:00
config-step-order.patch
)
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}")
2016-11-02 03:12:26 +08:00
vcpkg_find_acquire_program(BISON)
2023-12-19 05:09:44 +08:00
cmake_path(GET BISON FILENAME BISON_NAME)
cmake_path(GET BISON PARENT_PATH BISON_PATH)
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
2023-12-19 05:09:44 +08:00
"INTLBISON=${BISON_NAME}"
"TOOLS_BISON=${BISON_NAME}"
)
2023-12-19 05:09:44 +08:00
if("nls" IN_LIST FEATURES)
vcpkg_list(APPEND options "--enable-nls")
else()
vcpkg_list(APPEND options "--disable-nls")
endif()
if(VCPKG_TARGET_IS_LINUX)
# Cannot use gettext-libintl, empty port on linux
set(ENV{VCPKG_INTL} intl)
else()
# Relying on gettext-libintl
list(APPEND OPTIONS --with-included-gettext=no)
endif()
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
ADDITIONAL_MSYS_PACKAGES gzip
OPTIONS
${OPTIONS}
OPTIONS_RELEASE
"--cache-file=${CURRENT_BUILDTREES_DIR}/config.cache-${TARGET_TRIPLET}-rel.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}*/*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 unix_runtime LIST_DIRECTORIES false
"${CURRENT_PACKAGES_DIR}/lib/libgettext*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}*"
"${CURRENT_PACKAGES_DIR}/lib/libtextstyle*${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}*"
)
if(unix_runtime)
file(INSTALL ${unix_runtime} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
endif()
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)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/gettext/user-email" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../..")
else()
# A fast installation of the autopoint tool and data, needed for autoconfig
include("${CMAKE_CURRENT_LIST_DIR}/install-autopoint.cmake")
install_autopoint()
endif()
# 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
2023-12-19 05:09:44 +08:00
"${SOURCE_PATH}/gettext-runtime/m4/build-to-host.m4"
"${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"
)
[intl/gettext/fontconfig] update to native build system (#11776) * [fontconfig] update fontconfig * [libiconv] update to make * [gettext] update to make * [vcpkg_configure_make] Changes considering pure configure ports without the requirement to run autoconfig * [fontconfig] make it work on windows * Remove install of unofficial cmake config * add function get_cmake_vars * fine tuning. * apply to make based ports. * add log suffix on not windows platforms * fix c&p error * add previous LINK env * setup env on windows and extract cpp flags correctly. * update glib and libxml2 * fix windows regressions * Apply suggestions from code review * add windres wrapper to invoke RC. * remove wrong fi * fix libintl. * try fixing uwp * other things to update * exiv2 fix * libtool does not like -RTC1 * pass the /RTC<x> flag directly to the compiler * trust cmake instead of adding extra flags * fix expat * fix iconv wrapper install * change fontconfig intl linkage. * add appcontainer back in which is required for UWP. Why is this not in the cmake flags? * fix pkg-config in vcpkg_configure_make * fix json-c pkg-config installation * remove remnoved config * comment out debug messages + bit of tuning * finally fontconfig * comment debug messages * expat apply extra patches. * Switch back to -E instead of -EP in cpp * commit changes from fontconfig PR * [expat] fix expat details * Apply suggestions from code review Co-authored-by: nicole mazzuca <mazzucan@outlook.com> * cleanup docs * update osx pipeline so that fontconfig actually builds * fix expat the lazy way by using a higher commit than release * fix a barage of regressions due to the use of unofficial targets * [expat] use a higher commit hash with a better stabilized cmake build * forgot freexl regression * more unofficial fixes * fix downstream expat usage * fix wxwidgets * fix gcdm regression * [vtk] fix the regression due to expat * add uwp cl flags back in. Somehow those are not set by cmake * add a few other configure options for full gettext build * fix cmake regression * fix a few regressions * fix static gettext build * fix gettext static * fix libxml2 wrapper for cmake * some more regressions fixes * add conversion from somelib.lib to -lsomelib * add a few option to libiconv. * get logs from CI * add missing ar-lib wrapper * add missing ar-lib wrapper * add fatal error to gettext * remove uuid from the list of LIBS since it seems to not exist in CI? * small but important regex correction * fix regex and add debug message for libs * remove error and only build libintl. * add uuid dependency to fontconfig in qt5-base * osx install gettext for autopoint * fix io2d regression by saying the port is broken ..... (which it is; upstream needs to learn proper cmake) * restore the old libxml2 wrapper with minor modifications * fix xmlsec regression * install wrapper correctly * try actual fixing io2d * improve iconv wrapper * add latest changes from update_fontconfig PR * Apply suggestions from code review first set which don't need special attention Co-authored-by: ras0219 <533828+ras0219@users.noreply.github.com> * Apply suggestions from code review one more simple change Co-authored-by: ras0219 <533828+ras0219@users.noreply.github.com> * [x264] set env AS * fix bugs due to refactor * use subpath everywhere * apply changes from CR * fix fontconfig build. * only change libs in static builds * remove unnecessary lines 41 & 44 * remove flag transformation * reintroduce the flag / to - transformation for MSVC * trying to figure out autopoint issue. using wrong (windows) find.exe instead of msys * add correct working_dir to subpath * escape stupid env paths. * fix typo * add findutils remove debug messages * add error if libtool chokes * add file to msys * pass lt_cv_deplibs_check_method=pass_all on windows (couldn't get file.exe to work so that libtool correctly ids the passed libs) * add bzip2 to msys * reenable libtool check. Lets see if CI agrees * unbreak linux try to figure out where uuid should be on windows. * add -L flag and help libtool ? * try to get ci to find uuid. * try to use cygpath * update controls * cleanup merge mistakes * correct merge issues * determine cmake vars if not done before. * move adding of -l earlier * more merge cleanup * fix uwp builds by not transforming libs * fix patches in io2d * fix xz download error * apply code review changes manually * fix the typos left behind in CR Co-authored-by: nicole mazzuca <mazzucan@outlook.com> Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com> Co-authored-by: ras0219 <533828+ras0219@users.noreply.github.com>
2020-11-18 01:18:59 +08:00
if(NOT VCPKG_CROSSCOMPILING)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/gettext")
endif()
2021-11-18 04:30:15 +08:00
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/gettext-runtime/COPYING" "${SOURCE_PATH}/COPYING")