| 1 |
if(NOT VCPKG_TARGET_IS_WINDOWS) |
| 2 |
message(WARNING "${PORT} currently requires the following programs from the system package manager: |
| 3 |
autoconf automake autoconf-archive |
| 4 |
On Debian and Ubuntu derivatives: |
| 5 |
sudo apt-get install autoconf automake autoconf-archive |
| 6 |
On recent Red Hat and Fedora derivatives: |
| 7 |
sudo dnf install autoconf automake autoconf-archive |
| 8 |
On Arch Linux and derivatives: |
| 9 |
sudo pacman -S autoconf automake autoconf-archive |
| 10 |
On Alpine: |
| 11 |
apk add autoconf automake autoconf-archive |
| 12 |
On macOS: |
| 13 |
brew install autoconf automake autoconf-archive\n") |
| 14 |
endif() |
| 15 |
|
| 16 |
string(REGEX MATCH "^[0-9]*" ICU_VERSION_MAJOR "${VERSION}") |
| 17 |
string(REPLACE "." "_" VERSION2 "${VERSION}") |
| 18 |
string(REPLACE "." "-" VERSION3 "${VERSION}") |
| 19 |
|
| 20 |
vcpkg_download_distfile( |
| 21 |
ARCHIVE |
| 22 |
URLS "https://github.com/unicode-org/icu/releases/download/release-${VERSION3}/icu4c-${VERSION2}-src.tgz" |
| 23 |
FILENAME "icu4c-${VERSION2}-src.tgz" |
| 24 |
SHA512 e6c7876c0f3d756f3a6969cad9a8909e535eeaac352f3a721338b9cbd56864bf7414469d29ec843462997815d2ca9d0dab06d38c37cdd4d8feb28ad04d8781b0 |
| 25 |
) |
| 26 |
|
| 27 |
vcpkg_extract_source_archive(SOURCE_PATH |
| 28 |
ARCHIVE "${ARCHIVE}" |
| 29 |
PATCHES |
| 30 |
disable-escapestr-tool.patch |
| 31 |
remove-MD-from-configure.patch |
| 32 |
fix_parallel_build_on_windows.patch |
| 33 |
fix-extra.patch |
| 34 |
mingw-dll-install.patch |
| 35 |
disable-static-prefix.patch # https://gitlab.kitware.com/cmake/cmake/-/issues/16617; also mingw. |
| 36 |
fix-win-build.patch |
| 37 |
vcpkg-cross-data.patch |
| 38 |
darwin-rpath.patch |
| 39 |
mingw-strict-ansi.diff # backport of https://github.com/unicode-org/icu/pull/3003 |
| 40 |
uconfig.h.patch |
| 41 |
plurrule.cpp.patch |
| 42 |
) |
| 43 |
|
| 44 |
vcpkg_download_distfile( |
| 45 |
ICUDATA |
| 46 |
URLS "https://github.com/unicode-org/icu/releases/download/release-${VERSION3}/icu4c-${VERSION2}-data.zip" |
| 47 |
FILENAME "icu4c-${VERSION2}-data.zip" |
| 48 |
SHA512 f9dbd303f78de1bf9089262211f3b618f1ec915e57877855d0bc6496332620f4ea92eabe1dff9fa721600e9a6ce56885f79361bbcdf97d0cfedd18e4a2d58ad0 |
| 49 |
) |
| 50 |
|
| 51 |
vcpkg_extract_archive( |
| 52 |
ARCHIVE "${ICUDATA}" |
| 53 |
DESTINATION "${SOURCE_PATH}.temp" |
| 54 |
) |
| 55 |
|
| 56 |
file(REMOVE_RECURSE "${SOURCE_PATH}/source/data") |
| 57 |
file(COPY "${SOURCE_PATH}.temp/" DESTINATION "${SOURCE_PATH}/source/") |
| 58 |
file(REMOVE_RECURSE "${SOURCE_PATH}.temp") |
| 59 |
|
| 60 |
vcpkg_find_acquire_program(PYTHON3) |
| 61 |
set(ENV{PYTHON} "${PYTHON3}") |
| 62 |
|
| 63 |
vcpkg_list(SET CONFIGURE_OPTIONS) |
| 64 |
vcpkg_list(SET BUILD_OPTIONS) |
| 65 |
|
| 66 |
if(VCPKG_TARGET_IS_EMSCRIPTEN) |
| 67 |
vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-extras) |
| 68 |
vcpkg_list(APPEND BUILD_OPTIONS "PKGDATA_OPTS=--without-assembly -O ../data/icupkg.inc") |
| 69 |
elseif(VCPKG_TARGET_IS_UWP) |
| 70 |
vcpkg_list(APPEND CONFIGURE_OPTIONS --disable-extras ac_cv_func_tzset=no ac_cv_func__tzset=no) |
| 71 |
string(APPEND VCPKG_C_FLAGS " -DU_PLATFORM_HAS_WINUWP_API=1") |
| 72 |
string(APPEND VCPKG_CXX_FLAGS " -DU_PLATFORM_HAS_WINUWP_API=1") |
| 73 |
vcpkg_list(APPEND BUILD_OPTIONS "PKGDATA_OPTS=--windows-uwp-build -O ../data/icupkg.inc") |
| 74 |
elseif(VCPKG_TARGET_IS_OSX AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") |
| 75 |
vcpkg_list(APPEND CONFIGURE_OPTIONS --enable-rpath) |
| 76 |
if(DEFINED CMAKE_INSTALL_NAME_DIR) |
| 77 |
vcpkg_list(APPEND BUILD_OPTIONS "ID_PREFIX=${CMAKE_INSTALL_NAME_DIR}") |
| 78 |
endif() |
| 79 |
endif() |
| 80 |
|
| 81 |
if(VCPKG_TARGET_IS_WINDOWS) |
| 82 |
list(APPEND CONFIGURE_OPTIONS --enable-icu-build-win) |
| 83 |
endif() |
| 84 |
|
| 85 |
if("tools" IN_LIST FEATURES) |
| 86 |
list(APPEND CONFIGURE_OPTIONS --enable-tools) |
| 87 |
else() |
| 88 |
list(APPEND CONFIGURE_OPTIONS --disable-tools) |
| 89 |
endif() |
| 90 |
if(CMAKE_HOST_WIN32 AND VCPKG_TARGET_IS_MINGW AND NOT HOST_TRIPLET MATCHES "mingw") |
| 91 |
# Assuming no cross compiling because the host (windows) pkgdata tool doesn't |
| 92 |
# use the '/' path separator when creating compiler commands for mingw bash. |
| 93 |
elseif(VCPKG_CROSSCOMPILING) |
| 94 |
set(TOOL_PATH "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}") |
| 95 |
# convert to unix path |
| 96 |
string(REGEX REPLACE "^([a-zA-Z]):/" "/\\1/" _VCPKG_TOOL_PATH "${TOOL_PATH}") |
| 97 |
list(APPEND CONFIGURE_OPTIONS "--with-cross-build=${_VCPKG_TOOL_PATH}") |
| 98 |
endif() |
| 99 |
|
| 100 |
file(COPY ${CURRENT_PORT_DIR}/filter.json DESTINATION ${SOURCE_PATH}/) |
| 101 |
|
| 102 |
set(ENV{ICU_DATA_FILTER_FILE} "${SOURCE_PATH}/filter.json") |
| 103 |
|
| 104 |
vcpkg_configure_make( |
| 105 |
SOURCE_PATH "${SOURCE_PATH}" |
| 106 |
PROJECT_SUBPATH source |
| 107 |
AUTOCONFIG |
| 108 |
DETERMINE_BUILD_TRIPLET |
| 109 |
ADDITIONAL_MSYS_PACKAGES autoconf-archive |
| 110 |
OPTIONS |
| 111 |
${CONFIGURE_OPTIONS} |
| 112 |
--disable-samples |
| 113 |
--disable-tests |
| 114 |
--disable-layoutex |
| 115 |
OPTIONS_RELEASE |
| 116 |
--disable-debug |
| 117 |
--enable-release |
| 118 |
OPTIONS_DEBUG |
| 119 |
--enable-debug |
| 120 |
--disable-release |
| 121 |
) |
| 122 |
vcpkg_install_make(OPTIONS ${BUILD_OPTIONS}) |
| 123 |
|
| 124 |
file(REMOVE_RECURSE |
| 125 |
"${CURRENT_PACKAGES_DIR}/share" |
| 126 |
"${CURRENT_PACKAGES_DIR}/debug/share" |
| 127 |
"${CURRENT_PACKAGES_DIR}/lib/icu" |
| 128 |
"${CURRENT_PACKAGES_DIR}/debug/lib/icu" |
| 129 |
"${CURRENT_PACKAGES_DIR}/debug/lib/icud") |
| 130 |
|
| 131 |
file(GLOB TEST_LIBS |
| 132 |
"${CURRENT_PACKAGES_DIR}/lib/*test*" |
| 133 |
"${CURRENT_PACKAGES_DIR}/debug/lib/*test*") |
| 134 |
if(TEST_LIBS) |
| 135 |
file(REMOVE ${TEST_LIBS}) |
| 136 |
endif() |
| 137 |
|
| 138 |
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") |
| 139 |
# force U_STATIC_IMPLEMENTATION macro |
| 140 |
foreach(HEADER utypes.h utf_old.h platform.h) |
| 141 |
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/unicode/${HEADER}" "defined(U_STATIC_IMPLEMENTATION)" "1") |
| 142 |
endforeach() |
| 143 |
endif() |
| 144 |
|
| 145 |
# Install executables from /tools/icu/sbin to /tools/icu/bin on unix (/bin because icu require this for cross compiling) |
| 146 |
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX AND "tools" IN_LIST FEATURES) |
| 147 |
vcpkg_copy_tools( |
| 148 |
TOOL_NAMES icupkg gennorm2 gencmn genccode gensprep |
| 149 |
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/tools/icu/sbin" |
| 150 |
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin" |
| 151 |
) |
| 152 |
endif() |
| 153 |
|
| 154 |
file(REMOVE_RECURSE |
| 155 |
"${CURRENT_PACKAGES_DIR}/tools/icu/sbin" |
| 156 |
"${CURRENT_PACKAGES_DIR}/tools/icu/debug") |
| 157 |
|
| 158 |
# To cross compile, we need some files at specific positions. So lets copy them |
| 159 |
file(GLOB CROSS_COMPILE_DEFS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config/icucross.*") |
| 160 |
file(INSTALL ${CROSS_COMPILE_DEFS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/config") |
| 161 |
|
| 162 |
file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*icu*${ICU_VERSION_MAJOR}.dll") |
| 163 |
file(COPY ${RELEASE_DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin") |
| 164 |
|
| 165 |
# copy dlls |
| 166 |
file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/lib/*icu*${ICU_VERSION_MAJOR}.dll") |
| 167 |
file(COPY ${RELEASE_DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/bin") |
| 168 |
if(NOT VCPKG_BUILD_TYPE) |
| 169 |
file(GLOB DEBUG_DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*icu*${ICU_VERSION_MAJOR}.dll") |
| 170 |
file(COPY ${DEBUG_DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") |
| 171 |
endif() |
| 172 |
|
| 173 |
# remove any remaining dlls in /lib |
| 174 |
file(GLOB DUMMY_DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll" "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll") |
| 175 |
if(DUMMY_DLLS) |
| 176 |
file(REMOVE ${DUMMY_DLLS}) |
| 177 |
endif() |
| 178 |
|
| 179 |
vcpkg_copy_pdbs() |
| 180 |
vcpkg_fixup_pkgconfig() |
| 181 |
|
| 182 |
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/icu/bin/icu-config" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../../" IGNORE_UNCHANGED) |
| 183 |
|
| 184 |
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") |
| 185 |
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |