221 lines
8.6 KiB
Diff
221 lines
8.6 KiB
Diff
From d68380a502ef3fa40f8f900f7005417007f57166 Mon Sep 17 00:00:00 2001
|
|
From: "L. E. Segovia" <amy@amyspark.me>
|
|
Date: Mon, 14 Nov 2022 21:33:49 -0300
|
|
Subject: [PATCH 2/9] MinGW support from MSYS
|
|
|
|
See: https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-icu
|
|
|
|
Co-authored-by: Alexey Pavlov <alexpux@gmail.com>
|
|
Co-authored-by: Andrew Sun <adsun701@gmail.com>
|
|
---
|
|
source/config/mh-mingw | 8 +++-----
|
|
source/config/mh-mingw64 | 8 +++-----
|
|
source/configure.ac | 2 +-
|
|
source/icudefs.mk.in | 15 ++++++++-------
|
|
source/samples/Makefile.in | 3 ---
|
|
source/samples/layout/Makefile.in | 3 ---
|
|
source/tools/pkgdata/pkgdata.cpp | 24 ++++++++++++------------
|
|
source/tools/pkgdata/pkgtypes.h | 2 ++
|
|
source/tools/toolutil/pkg_genc.h | 2 +-
|
|
9 files changed, 30 insertions(+), 37 deletions(-)
|
|
|
|
diff --git a/source/config/mh-mingw b/source/config/mh-mingw
|
|
index 30f6e5b..850f077 100644
|
|
--- a/source/config/mh-mingw
|
|
+++ b/source/config/mh-mingw
|
|
@@ -15,11 +15,6 @@
|
|
# If you prefer to have the DLLs in the lib folder, then set this to NO instead.
|
|
MINGW_MOVEDLLSTOBINDIR = YES
|
|
|
|
-# We install sbin tools into the same bin directory because
|
|
-# pkgdata needs some of the tools in sbin, and we can't always depend on
|
|
-# icu-config working on Windows.
|
|
-sbindir=$(bindir)
|
|
-
|
|
## Commands to generate dependency files
|
|
GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS)
|
|
GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
|
|
@@ -81,6 +76,9 @@ else
|
|
SO_TARGET_VERSION_SUFFIX =
|
|
endif
|
|
|
|
+STATIC_PREFIX_WHEN_USED =
|
|
+STATIC_PREFIX =
|
|
+
|
|
# Static library prefix and file extension
|
|
LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
|
|
A = a
|
|
diff --git a/source/config/mh-mingw64 b/source/config/mh-mingw64
|
|
index fb64c56..d7544a4 100644
|
|
--- a/source/config/mh-mingw64
|
|
+++ b/source/config/mh-mingw64
|
|
@@ -15,11 +15,6 @@ MINGW_MOVEDLLSTOBINDIR = YES
|
|
# This file is similar to mh-mingw
|
|
# Any changes made here may also need to be made in mh-mingw
|
|
|
|
-# We install sbin tools into the same bin directory because
|
|
-# pkgdata needs some of the tools in sbin, and we can't always depend on
|
|
-# icu-config working on Windows.
|
|
-sbindir=$(bindir)
|
|
-
|
|
## Commands to generate dependency files
|
|
GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS)
|
|
GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
|
|
@@ -81,6 +76,9 @@ else
|
|
SO_TARGET_VERSION_SUFFIX =
|
|
endif
|
|
|
|
+STATIC_PREFIX_WHEN_USED =
|
|
+STATIC_PREFIX =
|
|
+
|
|
# Static library prefix and file extension
|
|
LIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
|
|
A = a
|
|
diff --git a/source/configure.ac b/source/configure.ac
|
|
index 6a40312..5014e35 100644
|
|
--- a/source/configure.ac
|
|
+++ b/source/configure.ac
|
|
@@ -1238,7 +1238,7 @@ AC_SUBST(ICULIBSUFFIX)
|
|
if test "$ICULIBSUFFIX" != ""
|
|
then
|
|
U_HAVE_LIB_SUFFIX=1
|
|
- ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
|
|
+ ICULIBSUFFIXCNAME=`echo $ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
|
|
UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_HAVE_LIB_SUFFIX=1 -DU_LIB_SUFFIX_C_NAME=${ICULIBSUFFIXCNAME} "
|
|
else
|
|
U_HAVE_LIB_SUFFIX=0
|
|
diff --git a/source/icudefs.mk.in b/source/icudefs.mk.in
|
|
index 2c35816..dca71f2 100644
|
|
--- a/source/icudefs.mk.in
|
|
+++ b/source/icudefs.mk.in
|
|
@@ -266,6 +266,7 @@ USING_ICULEHB=yes
|
|
ICULEHB_TRUE=
|
|
ICULEHB_FALSE=#
|
|
ICULIBS_LE=$(ICULEHB_LIBS)
|
|
+ICULIBS_LE=$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX)
|
|
ICULE_CFLAGS=$(ICULEHB_CFLAGS) -DUSING_ICULEHB
|
|
else
|
|
USING_ICULEHB=no
|
|
@@ -274,13 +275,13 @@ ICULEHB_FALSE=
|
|
endif
|
|
|
|
# Just the libs.
|
|
-ICULIBS_DT = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
|
|
-ICULIBS_UC = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
|
|
-ICULIBS_I18N = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
|
|
-ICULIBS_LX = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
|
|
-ICULIBS_IO = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
|
|
-ICULIBS_CTESTFW = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
|
|
-ICULIBS_TOOLUTIL = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
|
|
+ICULIBS_DT = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
|
|
+ICULIBS_UC = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)
|
|
+ICULIBS_I18N = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)
|
|
+ICULIBS_LX = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)
|
|
+ICULIBS_IO = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)
|
|
+ICULIBS_CTESTFW = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)
|
|
+ICULIBS_TOOLUTIL = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX)
|
|
# Link commands to link to ICU libs
|
|
LLIBDIR = -L$(LIBDIR)
|
|
LSTUBDIR = -L$(top_builddir)/stubdata
|
|
diff --git a/source/samples/Makefile.in b/source/samples/Makefile.in
|
|
index 8f2514b..c16cf5c 100644
|
|
--- a/source/samples/Makefile.in
|
|
+++ b/source/samples/Makefile.in
|
|
@@ -16,9 +16,6 @@ include $(top_builddir)/icudefs.mk
|
|
## Build directory information
|
|
subdir = samples
|
|
|
|
-## Platform-specific setup
|
|
-include @platform_make_fragment@
|
|
-
|
|
## Files to remove for 'make clean'
|
|
CLEANFILES = *~
|
|
|
|
diff --git a/source/samples/layout/Makefile.in b/source/samples/layout/Makefile.in
|
|
index a8c4a24..5dc9831 100644
|
|
--- a/source/samples/layout/Makefile.in
|
|
+++ b/source/samples/layout/Makefile.in
|
|
@@ -13,9 +13,6 @@ top_builddir = ../..
|
|
|
|
include $(top_builddir)/icudefs.mk
|
|
|
|
-## Platform-specific setup
|
|
-include @platform_make_fragment@
|
|
-
|
|
## Build directory information
|
|
subdir = samples/layout
|
|
|
|
diff --git a/source/tools/pkgdata/pkgdata.cpp b/source/tools/pkgdata/pkgdata.cpp
|
|
index e1edcd3..e2c2b07 100644
|
|
--- a/source/tools/pkgdata/pkgdata.cpp
|
|
+++ b/source/tools/pkgdata/pkgdata.cpp
|
|
@@ -923,21 +923,9 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version
|
|
const char* FILE_EXTENSION_SEP = uprv_strlen(pkgDataFlags[SO_EXT]) == 0 ? "" : ".";
|
|
const char* FILE_SUFFIX = pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "";
|
|
|
|
-#if U_PLATFORM == U_PF_MINGW
|
|
- /* MinGW does not need the library prefix when building in dll mode. */
|
|
- if (IN_DLL_MODE(mode)) {
|
|
- sprintf(libFileNames[LIB_FILE], "%s", libName);
|
|
- } else {
|
|
- sprintf(libFileNames[LIB_FILE], "%s%s%s",
|
|
- (strstr(libName, "icudt") ? "lib" : ""),
|
|
- pkgDataFlags[LIBPREFIX],
|
|
- libName);
|
|
- }
|
|
-#else
|
|
sprintf(libFileNames[LIB_FILE], "%s%s",
|
|
pkgDataFlags[LIBPREFIX],
|
|
libName);
|
|
-#endif
|
|
|
|
if(o->verbose) {
|
|
fprintf(stdout, "# libFileName[LIB_FILE] = %s\n", libFileNames[LIB_FILE]);
|
|
@@ -1424,6 +1412,18 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
|
|
freeCmd = true;
|
|
}
|
|
#if U_PLATFORM == U_PF_MINGW
|
|
+ fprintf(stderr, "genlib=%s targetdir=%s libfilenames=%s -o pkgdataflags=%s targetdir=%s libfilenames=%s objectfileandeverythingelse=%s %s%s %s %s",
|
|
+ pkgDataFlags[GENLIB],
|
|
+ targetDir,
|
|
+ libFileNames[LIB_FILE_MINGW],
|
|
+ pkgDataFlags[LDICUDTFLAGS],
|
|
+ targetDir,
|
|
+ libFileNames[LIB_FILE_VERSION_TMP],
|
|
+ objectFile,
|
|
+ pkgDataFlags[LD_SONAME],
|
|
+ pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_VERSION_MAJOR],
|
|
+ pkgDataFlags[RPATH_FLAGS],
|
|
+ pkgDataFlags[BIR_FLAGS]);
|
|
sprintf(cmd, "%s%s%s %s -o %s%s %s %s%s %s %s",
|
|
pkgDataFlags[GENLIB],
|
|
targetDir,
|
|
diff --git a/source/tools/pkgdata/pkgtypes.h b/source/tools/pkgdata/pkgtypes.h
|
|
index 8ae1ec4..7d92b71 100644
|
|
--- a/source/tools/pkgdata/pkgtypes.h
|
|
+++ b/source/tools/pkgdata/pkgtypes.h
|
|
@@ -140,6 +140,8 @@ char * convertToNativePathSeparators(char *path);
|
|
# ifndef UDATA_SO_SUFFIX
|
|
# define UDATA_SO_SUFFIX ".dll"
|
|
# endif
|
|
+#endif
|
|
+#ifdef WINDOWS_WITH_MSVC
|
|
# define LIB_PREFIX ""
|
|
# define LIB_STATIC_PREFIX ""
|
|
# define OBJ_SUFFIX ".obj"
|
|
diff --git a/source/tools/toolutil/pkg_genc.h b/source/tools/toolutil/pkg_genc.h
|
|
index 72d9687..652601c 100644
|
|
--- a/source/tools/toolutil/pkg_genc.h
|
|
+++ b/source/tools/toolutil/pkg_genc.h
|
|
@@ -17,7 +17,7 @@
|
|
|
|
/*** Platform #defines move here ***/
|
|
#if U_PLATFORM_HAS_WIN32_API
|
|
-#ifdef __GNUC__
|
|
+#if defined(__GNUC__) || defined(__clang__)
|
|
#define WINDOWS_WITH_GNUC
|
|
#else
|
|
#define WINDOWS_WITH_MSVC
|
|
--
|
|
2.37.1.windows.1
|
|
|