icu: export C API on MinGW

This commit is contained in:
Markus Mützel 2025-06-06 09:49:43 +02:00 committed by Christoph Reiter
parent cf52b88830
commit c5fcf93257
2 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,45 @@
From 0a92e43809209c210cf77a4d63a255e4093ea73f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <markus.muetzel@gmx.de>
Date: Fri, 6 Jun 2025 09:42:02 +0200
Subject: [PATCH] Add visibility attributes for MinGW.
---
source/common/unicode/platform.h | 4 ++++
source/config/icu.pc.in | 1 +
2 files changed, 5 insertions(+)
diff --git a/source/common/unicode/platform.h b/source/common/unicode/platform.h
index 45741a83deb..60be4987eb2 100644
--- a/source/common/unicode/platform.h
+++ b/source/common/unicode/platform.h
@@ -780,6 +780,8 @@
#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \
UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
# define U_EXPORT __declspec(dllexport)
+#elif defined (_WIN32) || defined (__CYGWIN__)
+# define U_EXPORT __attribute__ ((dllexport))
#elif defined(__GNUC__) || defined(__open_xl__)
# define U_EXPORT __attribute__((visibility("default")))
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
@@ -806,6 +808,8 @@
UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
/* Windows needs to export/import data. */
# define U_IMPORT __declspec(dllimport)
+#elif defined (_WIN32) || defined (__CYGWIN__)
+# define U_IMPORT __attribute__ ((dllimport))
#else
# define U_IMPORT
#endif
diff --git a/source/config/icu.pc.in b/source/config/icu.pc.in
index 4d8db206c2b..9adc2e208a1 100644
--- a/source/config/icu.pc.in
+++ b/source/config/icu.pc.in
@@ -33,4 +33,5 @@ ICUDESC=International Components for Unicode
Version: @VERSION@
Cflags: -I${includedir}
+Cflags.private: -DU_STATIC_IMPLEMENTATION
# end of icu.pc.in
--
2.47.1.windows.2

View File

@ -6,7 +6,7 @@ _realname=icu
pkgbase=mingw-w64-${_realname} pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=77.1 pkgver=77.1
pkgrel=1 pkgrel=2
arch=('any') arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
pkgdesc="International Components for Unicode library (mingw-w64)" pkgdesc="International Components for Unicode library (mingw-w64)"
@ -21,7 +21,8 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-autotools" "${MINGW_PACKAGE_PREFIX}-autotools"
"autoconf-archive") "autoconf-archive")
source=(https://github.com/unicode-org/icu/releases/download/release-${pkgver//./-}/icu4c-${pkgver//./_}-src.tgz source=(https://github.com/unicode-org/icu/releases/download/release-${pkgver//./-}/icu4c-${pkgver//./_}-src.tgz
https://sources.debian.org/data/main/i/icu/76.1-3/debian/patches/reverse_of_ICU-22610.patch https://sources.debian.org/data/main/i/icu/76.1-4/debian/patches/reverse_of_ICU-22610.patch
0001-Add-visibility-attributes-for-MinGW.patch
0011-sbin-dir.mingw.patch 0011-sbin-dir.mingw.patch
0012-libprefix.mingw.patch 0012-libprefix.mingw.patch
0014-mingwize-pkgdata.mingw.patch 0014-mingwize-pkgdata.mingw.patch
@ -31,6 +32,7 @@ source=(https://github.com/unicode-org/icu/releases/download/release-${pkgver//.
0023-fix-twice-include-platform_make_fragment.patch) 0023-fix-twice-include-platform_make_fragment.patch)
sha256sums=('588e431f77327c39031ffbb8843c0e3bc122c211374485fa87dc5f3faff24061' sha256sums=('588e431f77327c39031ffbb8843c0e3bc122c211374485fa87dc5f3faff24061'
'c515e2b37e230895080d36207dfe078eb638f974220baa487ede2593e820944c' 'c515e2b37e230895080d36207dfe078eb638f974220baa487ede2593e820944c'
'6537454d4f94bb25fb61aec2d9138d443cbba49122e64f0be154f92d739085f7'
'4f4787caeccf70607cf0cbde0c005f05f5c6de1543265a927839122405b4054f' '4f4787caeccf70607cf0cbde0c005f05f5c6de1543265a927839122405b4054f'
'e7ecdafe85e18a4a4b5f29bbfde38776521a848e5b65089a2379b90e59f1592d' 'e7ecdafe85e18a4a4b5f29bbfde38776521a848e5b65089a2379b90e59f1592d'
'd9f5f756443d7d14175aca06f4f1bb33237b58907e5db7a6ff7e38d2c4ea7957' 'd9f5f756443d7d14175aca06f4f1bb33237b58907e5db7a6ff7e38d2c4ea7957'
@ -54,6 +56,7 @@ prepare() {
apply_patch_with_msg \ apply_patch_with_msg \
reverse_of_ICU-22610.patch \ reverse_of_ICU-22610.patch \
0001-Add-visibility-attributes-for-MinGW.patch \
0011-sbin-dir.mingw.patch \ 0011-sbin-dir.mingw.patch \
0012-libprefix.mingw.patch \ 0012-libprefix.mingw.patch \
0014-mingwize-pkgdata.mingw.patch \ 0014-mingwize-pkgdata.mingw.patch \