--- icu/source/tools/pkgdata/pkgdata.cpp.orig	2023-07-01 08:26:35.587402300 +0200
+++ icu/source/tools/pkgdata/pkgdata.cpp	2023-07-01 08:29:32.345353000 +0200
@@ -950,11 +950,19 @@
         // Name the import library lib*.dll.a
         snprintf(libFileNames[LIB_FILE_MINGW], sizeof(libFileNames[LIB_FILE_MINGW]), "lib%s.dll.a", libName);
 #elif U_PLATFORM == U_PF_CYGWIN
+#ifdef __MSYS__
+        snprintf(libFileNames[LIB_FILE_CYGWIN], sizeof(libFileNames[LIB_FILE_CYGWIN]), "msys-%s%s%s",
+#else
         snprintf(libFileNames[LIB_FILE_CYGWIN], sizeof(libFileNames[LIB_FILE_CYGWIN]), "cyg%s%s%s",
+#endif
                 libName,
                 FILE_EXTENSION_SEP,
                 pkgDataFlags[SO_EXT]);
+#ifdef __MSYS__
+        snprintf(libFileNames[LIB_FILE_CYGWIN_VERSION], sizeof(libFileNames[LIB_FILE_CYGWIN_VERSION]), "msys-%s%s%s%s",
+#else
         snprintf(libFileNames[LIB_FILE_CYGWIN_VERSION], sizeof(libFileNames[LIB_FILE_CYGWIN_VERSION]), "cyg%s%s%s%s",
+#endif
                 libName,
                 version_major,
                 FILE_EXTENSION_SEP,
diff -durN icu.orig/source/tools/pkgdata/pkgtypes.h icu/source/tools/pkgdata/pkgtypes.h
--- icu.orig/source/tools/pkgdata/pkgtypes.h	2017-01-20 08:20:31.000000000 +0800
+++ icu/source/tools/pkgdata/pkgtypes.h	2017-05-17 14:14:13.671875000 +0800
@@ -146,7 +146,11 @@
 # define UDATA_LIB_SUFFIX ".lib"
 
 #elif U_PLATFORM == U_PF_CYGWIN
-# define LIB_PREFIX "cyg"
+# ifdef __MSYS__
+#  define LIB_PREFIX "msys-"
+# else
+#  define LIB_PREFIX "cyg"
+# endif
 # define LIB_STATIC_PREFIX "lib"
 # define OBJ_SUFFIX ".o"
 # define UDATA_LIB_SUFFIX ".a"
--- icu/source/config/mh-cygwin64.orig	2021-10-28 18:04:57.000000000 +0200
+++ icu/source/config/mh-cygwin64	2022-05-12 07:50:24.169385700 +0200
@@ -5,6 +5,11 @@
 ## Copyright (c) 2014, International Business Machines Corporation and
 ## others. All Rights Reserved.
 
+# 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
+
 ## Commands to generate dependency files
 GEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
 GEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
@@ -41,8 +46,8 @@
 ## Commands to make a shared library
 # $(subst) won't work in shell script.  #M# at the end omits these
 # lines from the shell script (Make only)
-SHLIB.c=	$(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M#
-SHLIB.cc=	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M#
+SHLIB.c=	$(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst msys-,lib,$@).$(A)#M#
+SHLIB.cc=	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst msys-,lib,$@).$(A)#M#
 # the #SH# lines don't go through further postprocessing. 
 # so, they must be valid shell script starting from column 4
 #SH#SHLIB_c="$(CC) $(CFLAGS) $(LDFLAGS) -shared "
@@ -60,7 +65,7 @@
 SO = dll
 ## Non-shared intermediate object suffix
 STATIC_O = ao
-LIBICU = cyg$(ICUPREFIX)
+LIBICU = msys-$(ICUPREFIX)
 ## To have an import library is better on Cygwin
 IMPORT_LIB_EXT = .dll.a
 
@@ -94,8 +99,8 @@
 FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
 MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
 
-IMPORT_LIB = $(subst cyg,lib,$(FINAL_SO_TARGET)).$(A)#M#
-MIDDLE_IMPORT_LIB = $(subst cyg,lib,$(basename $(SO_TARGET)))$(SO_TARGET_VERSION_MAJOR).$(SO).$(A)#M#
+IMPORT_LIB = $(subst msys-,lib,$(FINAL_SO_TARGET)).$(A)#M#
+MIDDLE_IMPORT_LIB = $(subst msys-,lib,$(basename $(SO_TARGET)))$(SO_TARGET_VERSION_MAJOR).$(SO).$(A)#M#
 FINAL_IMPORT_LIB = $(IMPORT_LIB)#M#
 
 # The following is for Makefile.inc's use.
@@ -105,7 +110,7 @@
 #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
 #	$(RM) $@ && cp ${<F} $@
 %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
-	ln -fs $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A)
+	ln -fs $(subst msys-,lib,${<F}).$(A) $(subst msys-,lib,$@).$(A)
 
 ## Install libraries as executable
 INSTALL-L=$(INSTALL_PROGRAM)
--- icu/source/config/mh-cygwin.orig	2021-10-28 18:04:57.000000000 +0200
+++ icu/source/config/mh-cygwin	2022-05-12 09:09:19.521071800 +0200
@@ -5,6 +5,11 @@
 ## Copyright (c) 2001-2010, International Business Machines Corporation and
 ## others. All Rights Reserved.
 
+# 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
+
 ## Commands to generate dependency files
 GEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
 GEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
@@ -41,8 +46,8 @@
 ## Commands to make a shared library
 # $(subst) won't work in shell script.  #M# at the end omits these
 # lines from the shell script (Make only)
-SHLIB.c=	$(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M#
-SHLIB.cc=	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M#
+SHLIB.c=	$(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst msys-,lib,$@).$(A)#M#
+SHLIB.cc=	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst msys-,lib,$@).$(A)#M#
 # the #SH# lines don't go through further postprocessing. 
 # so, they must be valid shell script starting from column 4
 #SH#SHLIB_c="$(CC) $(CFLAGS) $(LDFLAGS) -shared "
@@ -60,7 +65,7 @@
 SO = dll
 ## Non-shared intermediate object suffix
 STATIC_O = ao
-LIBICU = cyg$(ICUPREFIX)
+LIBICU = msys-$(ICUPREFIX)
 ## To have an import library is better on Cygwin
 IMPORT_LIB_EXT = .dll.a
 
@@ -94,8 +99,8 @@
 FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
 MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
 
-IMPORT_LIB = $(subst cyg,lib,$(FINAL_SO_TARGET)).$(A)#M#
-MIDDLE_IMPORT_LIB = $(subst cyg,lib,$(basename $(SO_TARGET)))$(SO_TARGET_VERSION_MAJOR).$(SO).$(A)#M#
+IMPORT_LIB = $(subst msys-,lib,$(FINAL_SO_TARGET)).$(A)#M#
+MIDDLE_IMPORT_LIB = $(subst msys-,lib,$(basename $(SO_TARGET)))$(SO_TARGET_VERSION_MAJOR).$(SO).$(A)#M#
 FINAL_IMPORT_LIB = $(IMPORT_LIB)#M#
 
 # The following is for Makefile.inc's use.
@@ -105,7 +110,7 @@
 #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
 #	$(RM) $@ && cp ${<F} $@
 %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
-	ln -fs $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A)
+	ln -fs $(subst msys-,lib,${<F}).$(A) $(subst msys-,lib,$@).$(A)
 
 ## Install libraries as executable
 INSTALL-L=$(INSTALL_PROGRAM)
