[icu] Fix mingw builds (#20253)

* Fix mingw dll installation

* Patch static lib naming

* Update icu homepage

* Fix mingw builds on windows triplet host

* Update versions

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Kai Pastor 2021-09-24 02:45:11 +02:00 committed by GitHub
parent c00ce5ca23
commit d60da45f54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 44 deletions

View File

@ -0,0 +1,20 @@
diff --git a/source/icudefs.mk.in b/source/icudefs.mk.in
index 24bd97a..33169de 100644
--- a/source/icudefs.mk.in
+++ b/source/icudefs.mk.in
@@ -213,13 +213,13 @@ LIBICU = $(LIBPREFIX)$(ICUPREFIX)
## If we can't use the shared libraries, use the static libraries
ifneq ($(ENABLE_SHARED),YES)
-STATIC_PREFIX_WHEN_USED = s
+STATIC_PREFIX_WHEN_USED =
else
STATIC_PREFIX_WHEN_USED =
endif
# Static library prefix and file extension
-STATIC_PREFIX = s
+STATIC_PREFIX =
LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
A = a
SOBJ = $(SO)

View File

@ -0,0 +1,13 @@
diff --git a/source/config/mh-mingw64 b/source/config/mh-mingw64
index fb64c56..a43cc4d 100644
--- a/source/config/mh-mingw64
+++ b/source/config/mh-mingw64
@@ -10,7 +10,7 @@
# On Windows we generally have the DLLs in the bin directory rather than the lib directory.
# This setting moves the ICU DLLs into the bin folder for MinGW/MSYS2 when "make install" is run.
# If you prefer to have the DLLs in the lib folder, then set this to NO instead.
-MINGW_MOVEDLLSTOBINDIR = YES
+MINGW_MOVEDLLSTOBINDIR = NO
# This file is similar to mh-mingw
# Any changes made here may also need to be made in mh-mingw

View File

@ -16,10 +16,12 @@ vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/disable-escapestr-tool.patch
${CMAKE_CURRENT_LIST_DIR}/remove-MD-from-configure.patch
${CMAKE_CURRENT_LIST_DIR}/fix_parallel_build_on_windows.patch
${CMAKE_CURRENT_LIST_DIR}/fix-extra.patch
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.
)
vcpkg_find_acquire_program(PYTHON3)
@ -33,8 +35,10 @@ list(APPEND CONFIGURE_OPTIONS_DEBUG --enable-debug --disable-release)
set(RELEASE_TRIPLET ${TARGET_TRIPLET}-rel)
set(DEBUG_TRIPLET ${TARGET_TRIPLET}-dbg)
if(NOT "${TARGET_TRIPLET}" STREQUAL "${HOST_TRIPLET}")
# cross compiling
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)
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}")
@ -123,15 +127,6 @@ endif()
vcpkg_install_make()
if(VCPKG_TARGET_IS_MINGW)
file(GLOB ICU_TOOLS
${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_HOST_EXECUTABLE_SUFFIX}
${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_HOST_EXECUTABLE_SUFFIX}
${CURRENT_PACKAGES_DIR}/bin/icu-config
${CURRENT_PACKAGES_DIR}/debug/bin/icu-config)
file(REMOVE ${ICU_TOOLS})
endif()
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/share
${CURRENT_PACKAGES_DIR}/debug/share
@ -147,29 +142,6 @@ if(TEST_LIBS)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
if(VCPKG_TARGET_IS_WINDOWS)
# rename static libraries to match import libs
# see https://gitlab.kitware.com/cmake/cmake/issues/16617
foreach(MODULE dt in io tu uc)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/sicu${MODULE}${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX} ${CURRENT_PACKAGES_DIR}/lib/icu${MODULE}${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX})
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/sicu${MODULE}d${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX} ${CURRENT_PACKAGES_DIR}/debug/lib/icu${MODULE}d${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX})
endif()
endforeach()
file(GLOB_RECURSE pkg_files LIST_DIRECTORIES false ${CURRENT_PACKAGES_DIR}/*.pc)
message(STATUS "${pkg_files}")
foreach(pkg_file IN LISTS pkg_files)
message(STATUS "${pkg_file}")
file(READ ${pkg_file} PKG_FILE)
string(REGEX REPLACE "-ls([^ \\t\\n]+)" "-l\\1" PKG_FILE "${PKG_FILE}" )
file(WRITE ${pkg_file} "${PKG_FILE}")
endforeach()
endif()
# force U_STATIC_IMPLEMENTATION macro
foreach(HEADER utypes.h utf_old.h platform.h)
file(READ ${CURRENT_PACKAGES_DIR}/include/unicode/${HEADER} HEADER_CONTENTS)
@ -196,17 +168,17 @@ file(GLOB CROSS_COMPILE_DEFS ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}/config
file(INSTALL ${CROSS_COMPILE_DEFS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}/config)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/icu*${ICU_VERSION_MAJOR}.dll)
file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/*icu*${ICU_VERSION_MAJOR}.dll)
file(COPY ${RELEASE_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin)
endif()
# copy dlls
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/icu*${ICU_VERSION_MAJOR}.dll)
file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/*icu*${ICU_VERSION_MAJOR}.dll)
file(COPY ${RELEASE_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(GLOB DEBUG_DLLS ${CURRENT_PACKAGES_DIR}/debug/lib/icu*${ICU_VERSION_MAJOR}.dll)
file(GLOB DEBUG_DLLS ${CURRENT_PACKAGES_DIR}/debug/lib/*icu*${ICU_VERSION_MAJOR}.dll)
file(COPY ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()

View File

@ -1,9 +1,9 @@
{
"name": "icu",
"version": "69.1",
"port-version": 14,
"port-version": 15,
"description": "Mature and widely used Unicode and localization library.",
"homepage": "http://icu-project.org/apiref/icu4c/",
"homepage": "https://icu.unicode.org/home",
"supports": "!uwp",
"dependencies": [
{

View File

@ -2654,7 +2654,7 @@
},
"icu": {
"baseline": "69.1",
"port-version": 14
"port-version": 15
},
"ideviceinstaller": {
"baseline": "1.1.2.23",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2d08c0ceb1777074f3b31fe51e386c9ece0ca8cd",
"version": "69.1",
"port-version": 15
},
{
"git-tree": "2632dd55c20f6830027ae1e167524817b1a9d7ec",
"version": "69.1",