Warning, /graphics/krita/3rdparty/ext_icu/0001-MinGW-support-from-MSYS.patch is written in an unsupported language. File is not indexed.

0001 From bfcbaa5b01f0c4c647bda28e4e8597a36d453981 Mon Sep 17 00:00:00 2001
0002 From: "L. E. Segovia" <amy@amyspark.me>
0003 Date: Mon, 14 Nov 2022 21:33:49 -0300
0004 Subject: [PATCH 1/3] MinGW support from MSYS
0005 
0006 See: https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-icu
0007 
0008 Co-authored-by: Alexey Pavlov <alexpux@gmail.com>
0009 Co-authored-by: Andrew Sun <adsun701@gmail.com>
0010 ---
0011  icu4c/source/config/mh-mingw            |  8 +++-----
0012  icu4c/source/config/mh-mingw64          |  8 +++-----
0013  icu4c/source/configure.ac               |  2 +-
0014  icu4c/source/icudefs.mk.in              | 15 ++++++++-------
0015  icu4c/source/samples/Makefile.in        |  3 ---
0016  icu4c/source/samples/layout/Makefile.in |  3 ---
0017  icu4c/source/tools/pkgdata/pkgdata.cpp  | 15 +++++++++++++--
0018  icu4c/source/tools/pkgdata/pkgtypes.h   |  2 ++
0019  icu4c/source/tools/toolutil/pkg_genc.h  |  2 +-
0020  9 files changed, 31 insertions(+), 27 deletions(-)
0021 
0022 diff --git a/icu4c/source/config/mh-mingw b/icu4c/source/config/mh-mingw
0023 index 30f6e5be81a..850f0773866 100644
0024 --- a/icu4c/source/config/mh-mingw
0025 +++ b/icu4c/source/config/mh-mingw
0026 @@ -15,11 +15,6 @@
0027  # If you prefer to have the DLLs in the lib folder, then set this to NO instead.
0028  MINGW_MOVEDLLSTOBINDIR = YES
0029  
0030 -# We install sbin tools into the same bin directory because
0031 -# pkgdata needs some of the tools in sbin, and we can't always depend on
0032 -# icu-config working on Windows.
0033 -sbindir=$(bindir)
0034 -
0035  ## Commands to generate dependency files
0036  GEN_DEPS.c=    $(CC) -E -MM $(DEFS) $(CPPFLAGS)
0037  GEN_DEPS.cc=   $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
0038 @@ -81,6 +76,9 @@ else
0039  SO_TARGET_VERSION_SUFFIX = 
0040  endif
0041  
0042 +STATIC_PREFIX_WHEN_USED = 
0043 +STATIC_PREFIX = 
0044 +
0045  # Static library prefix and file extension
0046  LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
0047  A = a
0048 diff --git a/icu4c/source/config/mh-mingw64 b/icu4c/source/config/mh-mingw64
0049 index fb64c562604..d7544a49a0a 100644
0050 --- a/icu4c/source/config/mh-mingw64
0051 +++ b/icu4c/source/config/mh-mingw64
0052 @@ -15,11 +15,6 @@ MINGW_MOVEDLLSTOBINDIR = YES
0053  # This file is similar to mh-mingw
0054  # Any changes made here may also need to be made in mh-mingw
0055  
0056 -# We install sbin tools into the same bin directory because
0057 -# pkgdata needs some of the tools in sbin, and we can't always depend on
0058 -# icu-config working on Windows.
0059 -sbindir=$(bindir)
0060 -
0061  ## Commands to generate dependency files
0062  GEN_DEPS.c=    $(CC) -E -MM $(DEFS) $(CPPFLAGS)
0063  GEN_DEPS.cc=   $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
0064 @@ -81,6 +76,9 @@ else
0065  SO_TARGET_VERSION_SUFFIX = 
0066  endif
0067  
0068 +STATIC_PREFIX_WHEN_USED = 
0069 +STATIC_PREFIX = 
0070 +
0071  # Static library prefix and file extension
0072  LIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
0073  A = a
0074 diff --git a/icu4c/source/configure.ac b/icu4c/source/configure.ac
0075 index 2d7eb300173..9c4ee110863 100644
0076 --- a/icu4c/source/configure.ac
0077 +++ b/icu4c/source/configure.ac
0078 @@ -1238,7 +1238,7 @@ AC_SUBST(ICULIBSUFFIX)
0079  if test "$ICULIBSUFFIX" != ""
0080  then
0081      U_HAVE_LIB_SUFFIX=1
0082 -    ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
0083 +    ICULIBSUFFIXCNAME=`echo $ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
0084      UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_HAVE_LIB_SUFFIX=1 -DU_LIB_SUFFIX_C_NAME=${ICULIBSUFFIXCNAME} "
0085  else
0086      U_HAVE_LIB_SUFFIX=0
0087 diff --git a/icu4c/source/icudefs.mk.in b/icu4c/source/icudefs.mk.in
0088 index 2c358167a83..dca71f2a7c4 100644
0089 --- a/icu4c/source/icudefs.mk.in
0090 +++ b/icu4c/source/icudefs.mk.in
0091 @@ -266,6 +266,7 @@ USING_ICULEHB=yes
0092  ICULEHB_TRUE=
0093  ICULEHB_FALSE=#
0094  ICULIBS_LE=$(ICULEHB_LIBS)
0095 +ICULIBS_LE=$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX)
0096  ICULE_CFLAGS=$(ICULEHB_CFLAGS) -DUSING_ICULEHB
0097  else
0098  USING_ICULEHB=no
0099 @@ -274,13 +275,13 @@ ICULEHB_FALSE=
0100  endif
0101  
0102  # Just the libs.
0103 -ICULIBS_DT     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
0104 -ICULIBS_UC     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
0105 -ICULIBS_I18N   = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
0106 -ICULIBS_LX     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
0107 -ICULIBS_IO     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
0108 -ICULIBS_CTESTFW        = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
0109 -ICULIBS_TOOLUTIL = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
0110 +ICULIBS_DT     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
0111 +ICULIBS_UC     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)
0112 +ICULIBS_I18N   = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)
0113 +ICULIBS_LX     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)
0114 +ICULIBS_IO     = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)
0115 +ICULIBS_CTESTFW        = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)
0116 +ICULIBS_TOOLUTIL = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX)
0117  # Link commands to link to ICU libs
0118  LLIBDIR                = -L$(LIBDIR)
0119  LSTUBDIR       = -L$(top_builddir)/stubdata
0120 diff --git a/icu4c/source/samples/Makefile.in b/icu4c/source/samples/Makefile.in
0121 index 8f2514bfd00..c16cf5c4428 100644
0122 --- a/icu4c/source/samples/Makefile.in
0123 +++ b/icu4c/source/samples/Makefile.in
0124 @@ -16,9 +16,6 @@ include $(top_builddir)/icudefs.mk
0125  ## Build directory information
0126  subdir = samples
0127  
0128 -## Platform-specific setup
0129 -include @platform_make_fragment@
0130 -
0131  ## Files to remove for 'make clean'
0132  CLEANFILES = *~
0133  
0134 diff --git a/icu4c/source/samples/layout/Makefile.in b/icu4c/source/samples/layout/Makefile.in
0135 index a8c4a244764..5dc9831b9ce 100644
0136 --- a/icu4c/source/samples/layout/Makefile.in
0137 +++ b/icu4c/source/samples/layout/Makefile.in
0138 @@ -13,9 +13,6 @@ top_builddir = ../..
0139  
0140  include $(top_builddir)/icudefs.mk
0141  
0142 -## Platform-specific setup
0143 -include @platform_make_fragment@
0144 -
0145  ## Build directory information
0146  subdir = samples/layout
0147  
0148 diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp
0149 index c2ac112f6ef..2d0983cbb1c 100644
0150 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp
0151 +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp
0152 @@ -926,21 +926,9 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version
0153      const char* FILE_EXTENSION_SEP = uprv_strlen(pkgDataFlags[SO_EXT]) == 0 ? "" : ".";
0154      const char* FILE_SUFFIX = pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "";
0155 
0156 -#if U_PLATFORM == U_PF_MINGW
0157 -        /* MinGW does not need the library prefix when building in dll mode. */
0158 -        if (IN_DLL_MODE(mode)) {
0159 -            snprintf(libFileNames[LIB_FILE], sizeof(libFileNames[LIB_FILE]), "%s", libName);
0160 -        } else {
0161 -            snprintf(libFileNames[LIB_FILE], sizeof(libFileNames[LIB_FILE]), "%s%s%s",
0162 -                    (strstr(libName, "icudt") ? "lib" : ""),
0163 -                    pkgDataFlags[LIBPREFIX],
0164 -                    libName);
0165 -        }
0166 -#else
0167          snprintf(libFileNames[LIB_FILE], sizeof(libFileNames[LIB_FILE]), "%s%s",
0168                  pkgDataFlags[LIBPREFIX],
0169                  libName);
0170 -#endif
0171 
0172          if(o->verbose) {
0173            fprintf(stdout, "# libFileName[LIB_FILE] = %s\n", libFileNames[LIB_FILE]);
0174 @@ -1427,6 +1415,18 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
0175              freeCmd = true;
0176          }
0177  #if U_PLATFORM == U_PF_MINGW
0178 +        fprintf(stderr, "genlib=%s targetdir=%s libfilenames=%s -o pkgdataflags=%s targetdir=%s libfilenames=%s objectfileandeverythingelse=%s %s%s %s %s",
0179 +                pkgDataFlags[GENLIB],
0180 +                targetDir,
0181 +                libFileNames[LIB_FILE_MINGW],
0182 +                pkgDataFlags[LDICUDTFLAGS],
0183 +                targetDir,
0184 +                libFileNames[LIB_FILE_VERSION_TMP],
0185 +                objectFile,
0186 +                pkgDataFlags[LD_SONAME],
0187 +                pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_VERSION_MAJOR],
0188 +                pkgDataFlags[RPATH_FLAGS],
0189 +                pkgDataFlags[BIR_FLAGS]);
0190          sprintf(cmd, "%s%s%s %s -o %s%s %s %s%s %s %s",
0191                  pkgDataFlags[GENLIB],
0192                  targetDir,
0193 diff --git a/icu4c/source/tools/pkgdata/pkgtypes.h b/icu4c/source/tools/pkgdata/pkgtypes.h
0194 index 51c11e0a14d..50c5f88a667 100644
0195 --- a/icu4c/source/tools/pkgdata/pkgtypes.h
0196 +++ b/icu4c/source/tools/pkgdata/pkgtypes.h
0197 @@ -140,6 +140,8 @@ char * convertToNativePathSeparators(char *path);
0198  # ifndef UDATA_SO_SUFFIX
0199  #  define UDATA_SO_SUFFIX ".dll"
0200  # endif
0201 +#endif
0202 +#ifdef WINDOWS_WITH_MSVC
0203  # define LIB_PREFIX ""
0204  # define LIB_STATIC_PREFIX ""
0205  # define OBJ_SUFFIX ".obj"
0206 diff --git a/icu4c/source/tools/toolutil/pkg_genc.h b/icu4c/source/tools/toolutil/pkg_genc.h
0207 index 2dd1b45cde9..65604436fd6 100644
0208 --- a/icu4c/source/tools/toolutil/pkg_genc.h
0209 +++ b/icu4c/source/tools/toolutil/pkg_genc.h
0210 @@ -17,7 +17,7 @@
0211  
0212  /*** Platform #defines move here ***/
0213  #if U_PLATFORM_HAS_WIN32_API
0214 -#ifdef __GNUC__
0215 +#if defined(__GNUC__) || defined(__clang__)
0216  #define WINDOWS_WITH_GNUC
0217  #else
0218  #define WINDOWS_WITH_MSVC
0219 -- 
0220 2.24.1.windows.2
0221