2024-05-17 14:31:11 -07:00
|
|
|
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
message(WARNING "${PORT} currently requires the following programs from the system package manager:
|
|
|
|
autoconf automake autoconf-archive
|
|
|
|
On Debian and Ubuntu derivatives:
|
|
|
|
sudo apt-get install autoconf automake autoconf-archive
|
|
|
|
On recent Red Hat and Fedora derivatives:
|
|
|
|
sudo dnf install autoconf automake autoconf-archive
|
|
|
|
On Arch Linux and derivatives:
|
|
|
|
sudo pacman -S autoconf automake autoconf-archive
|
|
|
|
On Alpine:
|
|
|
|
apk add autoconf automake autoconf-archive
|
|
|
|
On macOS:
|
|
|
|
brew install autoconf automake autoconf-archive\n")
|
|
|
|
endif()
|
|
|
|
|
2023-01-09 10:14:24 +01:00
|
|
|
string(REGEX MATCH "^[0-9]*" ICU_VERSION_MAJOR "${VERSION}")
|
|
|
|
string(REPLACE "." "_" VERSION2 "${VERSION}")
|
|
|
|
string(REPLACE "." "-" VERSION3 "${VERSION}")
|
2020-11-18 23:09:34 +01:00
|
|
|
|
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
|
|
|
URLS "https://github.com/unicode-org/icu/releases/download/release-${VERSION3}/icu4c-${VERSION2}-src.tgz"
|
|
|
|
FILENAME "icu4c-${VERSION2}-src.tgz"
|
2024-03-18 23:36:20 +02:00
|
|
|
SHA512 e6c7876c0f3d756f3a6969cad9a8909e535eeaac352f3a721338b9cbd56864bf7414469d29ec843462997815d2ca9d0dab06d38c37cdd4d8feb28ad04d8781b0
|
2020-11-18 23:09:34 +01:00
|
|
|
)
|
2022-04-12 00:06:15 +08:00
|
|
|
|
2023-01-09 10:14:24 +01:00
|
|
|
vcpkg_extract_source_archive(SOURCE_PATH
|
|
|
|
ARCHIVE "${ARCHIVE}"
|
2020-11-18 23:09:34 +01:00
|
|
|
PATCHES
|
2021-09-24 02:45:11 +02:00
|
|
|
disable-escapestr-tool.patch
|
|
|
|
remove-MD-from-configure.patch
|
|
|
|
fix_parallel_build_on_windows.patch
|
|
|
|
fix-extra.patch
|
|
|
|
mingw-dll-install.patch
|
|
|
|
disable-static-prefix.patch # https://gitlab.kitware.com/cmake/cmake/-/issues/16617; also mingw.
|
2022-01-14 05:23:44 +08:00
|
|
|
fix-win-build.patch
|
2023-12-07 21:22:04 +01:00
|
|
|
vcpkg-cross-data.patch
|
2023-12-15 02:37:17 +01:00
|
|
|
darwin-rpath.patch
|
2024-07-08 16:15:55 +02:00
|
|
|
mingw-strict-ansi.diff # backport of https://github.com/unicode-org/icu/pull/3003
|
2020-11-18 23:09:34 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
|
|
set(ENV{PYTHON} "${PYTHON3}")
|
|
|
|
|
2023-12-07 21:22:04 +01:00
|
|
|
vcpkg_list(SET CONFIGURE_OPTIONS)
|
|
|
|
vcpkg_list(SET BUILD_OPTIONS)
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_IS_EMSCRIPTEN)
|
|
|
|
vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-extras)
|
|
|
|
vcpkg_list(APPEND BUILD_OPTIONS "PKGDATA_OPTS=--without-assembly -O ../data/icupkg.inc")
|
2023-12-15 02:37:17 +01:00
|
|
|
elseif(VCPKG_TARGET_IS_UWP)
|
|
|
|
vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-extras ac_cv_func_tzset=no ac_cv_func__tzset=no)
|
|
|
|
string(APPEND VCPKG_C_FLAGS " -DU_PLATFORM_HAS_WINUWP_API=1")
|
|
|
|
string(APPEND VCPKG_CXX_FLAGS " -DU_PLATFORM_HAS_WINUWP_API=1")
|
2024-01-23 22:27:46 +01:00
|
|
|
vcpkg_list(APPEND BUILD_OPTIONS "PKGDATA_OPTS=--windows-uwp-build -O ../data/icupkg.inc")
|
2023-12-15 02:37:17 +01:00
|
|
|
elseif(VCPKG_TARGET_IS_OSX AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
vcpkg_list(APPEND CONFIGURE_OPTIONS --enable-rpath)
|
|
|
|
if(DEFINED CMAKE_INSTALL_NAME_DIR)
|
|
|
|
vcpkg_list(APPEND BUILD_OPTIONS "ID_PREFIX=${CMAKE_INSTALL_NAME_DIR}")
|
|
|
|
endif()
|
2023-12-07 21:22:04 +01:00
|
|
|
endif()
|
|
|
|
|
2022-01-14 05:23:44 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
list(APPEND CONFIGURE_OPTIONS --enable-icu-build-win)
|
|
|
|
endif()
|
|
|
|
|
2023-01-27 06:40:42 +01:00
|
|
|
if("tools" IN_LIST FEATURES)
|
|
|
|
list(APPEND CONFIGURE_OPTIONS --enable-tools)
|
|
|
|
else()
|
|
|
|
list(APPEND CONFIGURE_OPTIONS --disable-tools)
|
|
|
|
endif()
|
2021-09-24 02:45:11 +02:00
|
|
|
if(CMAKE_HOST_WIN32 AND VCPKG_TARGET_IS_MINGW AND NOT HOST_TRIPLET MATCHES "mingw")
|
|
|
|
# Assuming no cross compiling because the host (windows) pkgdata tool doesn't
|
|
|
|
# use the '/' path separator when creating compiler commands for mingw bash.
|
|
|
|
elseif(VCPKG_CROSSCOMPILING)
|
2021-09-08 06:19:28 +08:00
|
|
|
set(TOOL_PATH "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}")
|
|
|
|
# convert to unix path
|
|
|
|
string(REGEX REPLACE "^([a-zA-Z]):/" "/\\1/" _VCPKG_TOOL_PATH "${TOOL_PATH}")
|
|
|
|
list(APPEND CONFIGURE_OPTIONS "--with-cross-build=${_VCPKG_TOOL_PATH}")
|
2021-05-01 20:16:52 +02:00
|
|
|
endif()
|
2020-11-18 23:09:34 +01:00
|
|
|
|
2021-05-01 20:16:52 +02:00
|
|
|
vcpkg_configure_make(
|
2021-11-10 19:49:18 +01:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2021-05-01 20:16:52 +02:00
|
|
|
PROJECT_SUBPATH source
|
2023-12-15 02:37:17 +01:00
|
|
|
AUTOCONFIG
|
2021-07-23 08:00:40 +03:00
|
|
|
DETERMINE_BUILD_TRIPLET
|
2023-12-15 02:37:17 +01:00
|
|
|
ADDITIONAL_MSYS_PACKAGES autoconf-archive
|
|
|
|
OPTIONS
|
|
|
|
${CONFIGURE_OPTIONS}
|
|
|
|
--disable-samples
|
|
|
|
--disable-tests
|
|
|
|
--disable-layoutex
|
|
|
|
OPTIONS_RELEASE
|
|
|
|
--disable-debug
|
|
|
|
--enable-release
|
|
|
|
OPTIONS_DEBUG
|
|
|
|
--enable-debug
|
|
|
|
--disable-release
|
2021-05-01 20:16:52 +02:00
|
|
|
)
|
2023-12-07 21:22:04 +01:00
|
|
|
vcpkg_install_make(OPTIONS ${BUILD_OPTIONS})
|
2021-09-03 17:42:38 -06:00
|
|
|
|
2020-11-18 23:09:34 +01:00
|
|
|
file(REMOVE_RECURSE
|
2021-11-10 19:49:18 +01:00
|
|
|
"${CURRENT_PACKAGES_DIR}/share"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/lib/icu"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/lib/icu"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/lib/icud")
|
2020-11-18 23:09:34 +01:00
|
|
|
|
|
|
|
file(GLOB TEST_LIBS
|
2021-11-10 19:49:18 +01:00
|
|
|
"${CURRENT_PACKAGES_DIR}/lib/*test*"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/lib/*test*")
|
2021-09-03 17:42:38 -06:00
|
|
|
if(TEST_LIBS)
|
|
|
|
file(REMOVE ${TEST_LIBS})
|
|
|
|
endif()
|
2020-11-18 23:09:34 +01:00
|
|
|
|
2021-05-01 20:16:52 +02:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2020-11-18 23:09:34 +01:00
|
|
|
# force U_STATIC_IMPLEMENTATION macro
|
|
|
|
foreach(HEADER utypes.h utf_old.h platform.h)
|
2021-11-10 19:49:18 +01:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/unicode/${HEADER}" "defined(U_STATIC_IMPLEMENTATION)" "1")
|
2020-11-18 23:09:34 +01:00
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2021-05-01 20:16:52 +02:00
|
|
|
# Install executables from /tools/icu/sbin to /tools/icu/bin on unix (/bin because icu require this for cross compiling)
|
2023-02-08 03:01:58 +04:00
|
|
|
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX AND "tools" IN_LIST FEATURES)
|
2021-05-01 20:16:52 +02:00
|
|
|
vcpkg_copy_tools(
|
|
|
|
TOOL_NAMES icupkg gennorm2 gencmn genccode gensprep
|
2021-11-10 19:49:18 +01:00
|
|
|
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/tools/icu/sbin"
|
|
|
|
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin"
|
2021-05-01 20:16:52 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE
|
2021-11-10 19:49:18 +01:00
|
|
|
"${CURRENT_PACKAGES_DIR}/tools/icu/sbin"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/tools/icu/debug")
|
2021-05-01 20:16:52 +02:00
|
|
|
|
|
|
|
# To cross compile, we need some files at specific positions. So lets copy them
|
2023-10-30 23:01:58 +01:00
|
|
|
file(GLOB CROSS_COMPILE_DEFS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config/icucross.*")
|
2021-11-10 19:49:18 +01:00
|
|
|
file(INSTALL ${CROSS_COMPILE_DEFS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/config")
|
2021-05-01 20:16:52 +02:00
|
|
|
|
2023-01-09 10:14:24 +01:00
|
|
|
file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*icu*${ICU_VERSION_MAJOR}.dll")
|
|
|
|
file(COPY ${RELEASE_DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
|
2021-05-01 20:16:52 +02:00
|
|
|
|
|
|
|
# copy dlls
|
2023-01-09 10:14:24 +01:00
|
|
|
file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*icu*${ICU_VERSION_MAJOR}.dll")
|
|
|
|
file(COPY ${RELEASE_DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
|
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
2021-11-10 19:49:18 +01:00
|
|
|
file(GLOB DEBUG_DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*icu*${ICU_VERSION_MAJOR}.dll")
|
|
|
|
file(COPY ${DEBUG_DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
|
2021-05-01 20:16:52 +02:00
|
|
|
endif()
|
2020-11-18 23:09:34 +01:00
|
|
|
|
|
|
|
# remove any remaining dlls in /lib
|
2021-11-10 19:49:18 +01:00
|
|
|
file(GLOB DUMMY_DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll" "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll")
|
2020-11-18 23:09:34 +01:00
|
|
|
if(DUMMY_DLLS)
|
|
|
|
file(REMOVE ${DUMMY_DLLS})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_copy_pdbs()
|
2023-01-09 10:14:24 +01:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2020-11-18 23:09:34 +01:00
|
|
|
|
2024-06-20 07:07:05 +10:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/icu/bin/icu-config" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../../" IGNORE_UNCHANGED)
|
2021-11-10 19:49:18 +01:00
|
|
|
|
2023-01-09 10:14:24 +01:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2023-06-22 13:58:38 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|