ICU-20322 On MinGW, move the DLLs to the "bin" directory.
This change builds on Vincent Torri's changes.
This installs the ICU DLL files in $prefix/bin instead of $prefix/lib.
Note: In order to disable this change in behavior you can edit
the "mh-mingw*" file(s). If you set the variable MINGW_MOVEDLLSTOBINDIR
to NO instead of YES, then it will retain the previous behavior of
installing the DLLs into the bin folder.
diff --git a/icu4c/source/common/Makefile.in b/icu4c/source/common/Makefile.in
index 9e7fa22..7d149eb 100644
--- a/icu4c/source/common/Makefile.in
+++ b/icu4c/source/common/Makefile.in
@@ -12,7 +12,6 @@
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-platform = @platform@
top_builddir = ..
@@ -160,8 +159,9 @@
$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
endif
ifneq ($(ENABLE_SHARED),)
-ifeq ($(platform), U_MINGW)
- @$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
else
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
diff --git a/icu4c/source/config/icu-config-bottom b/icu4c/source/config/icu-config-bottom
index 20d0cdd..ddba5b3 100644
--- a/icu4c/source/config/icu-config-bottom
+++ b/icu4c/source/config/icu-config-bottom
@@ -5,7 +5,13 @@
## Copyright (c) 2002-2013, International Business Machines Corporation and
## others. All Rights Reserved.
-ICUUC_FILE="${libdir}/${ICULIBS_COMMON_LIB_NAME}"
+# For MinGW do we want the common DLL to go into the bin location?
+if [ "$MINGW_MOVEDLLSTOBINDIR" = "YES" ]; then
+ ICUUC_FILE="${bindir}/${ICULIBS_COMMON_LIB_NAME}"
+else
+ ICUUC_FILE="${libdir}/${ICULIBS_COMMON_LIB_NAME}"
+fi
+
ICUUC_FILE_A="${libdir}/${ICULIBS_COMMON_LIB_NAME_A}"
# echo ENABLE RPATH $ENABLE_RPATH and RPATHLDFLAGS=${RPATH_LDFLAGS}
diff --git a/icu4c/source/config/mh-mingw b/icu4c/source/config/mh-mingw
index 7dac12f..2a87919 100644
--- a/icu4c/source/config/mh-mingw
+++ b/icu4c/source/config/mh-mingw
@@ -10,6 +10,11 @@
# This file is similar to mh-mingw64
# Any changes made here may also need to be made in mh-mingw64
+# 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
+
# 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.
@@ -163,8 +168,6 @@
## Special pkgdata information that is needed
PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
-#ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M#
-#ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M#
## Versioned libraries rules
#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
diff --git a/icu4c/source/config/mh-mingw64 b/icu4c/source/config/mh-mingw64
index 456997a..5f3c282 100644
--- a/icu4c/source/config/mh-mingw64
+++ b/icu4c/source/config/mh-mingw64
@@ -7,6 +7,11 @@
# TODO: Finish the rest of this port. This platform port is incomplete.
+# 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
+
# This file is similar to mh-mingw
# Any changes made here may also need to be made in mh-mingw
@@ -163,8 +168,6 @@
## Special pkgdata information that is needed
PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
-#ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M#
-#ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M#
## Versioned libraries rules
#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
diff --git a/icu4c/source/data/Makefile.in b/icu4c/source/data/Makefile.in
index e817ba4..cf2c74d 100644
--- a/icu4c/source/data/Makefile.in
+++ b/icu4c/source/data/Makefile.in
@@ -195,11 +195,21 @@
endif
ifneq ($(ENABLE_STATIC),)
ifeq ($(PKGDATA_MODE),dll)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir)
+else
$(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_LIBDIR)
endif
endif
+endif
ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir)
+else
$(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR)
+endif
else
$(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(DESTDIR)$(ICUPKGDATA_DIR)
endif
diff --git a/icu4c/source/i18n/Makefile.in b/icu4c/source/i18n/Makefile.in
index 2f27261..b72f79b 100644
--- a/icu4c/source/i18n/Makefile.in
+++ b/icu4c/source/i18n/Makefile.in
@@ -12,7 +12,6 @@
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-platform = @platform@
top_builddir = ..
@@ -154,8 +153,9 @@
$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
endif
ifneq ($(ENABLE_SHARED),)
-ifeq ($(platform), U_MINGW)
- @$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
else
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
diff --git a/icu4c/source/icudefs.mk.in b/icu4c/source/icudefs.mk.in
index 59d8205..24bd97a 100644
--- a/icu4c/source/icudefs.mk.in
+++ b/icu4c/source/icudefs.mk.in
@@ -240,6 +240,10 @@
# Location of the executables before "make install" is used
BINDIR=$(top_builddir)/bin
+# Defined here so that it can be overriden by mh-mingw*.
+# For MinGW/MSYS2 we want the DLLs to go into the bin location.
+MINGW_MOVEDLLSTOBINDIR = NO
+
# overridden by icucross.mk
TOOLBINDIR=$(BINDIR)
TOOLLIBDIR=$(LIBDIR)
diff --git a/icu4c/source/io/Makefile.in b/icu4c/source/io/Makefile.in
index a8629fd..ef2c2a6 100644
--- a/icu4c/source/io/Makefile.in
+++ b/icu4c/source/io/Makefile.in
@@ -12,7 +12,6 @@
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-platform = @platform@
top_builddir = ..
@@ -102,8 +101,9 @@
$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
endif
ifneq ($(ENABLE_SHARED),)
-ifeq ($(platform), U_MINGW)
- @$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
else
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
diff --git a/icu4c/source/layoutex/Makefile.in b/icu4c/source/layoutex/Makefile.in
index b9cabac..d456ef4 100644
--- a/icu4c/source/layoutex/Makefile.in
+++ b/icu4c/source/layoutex/Makefile.in
@@ -114,6 +114,11 @@
$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
endif
ifneq ($(ENABLE_SHARED),)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+ $(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
+else
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
ifneq ($(FINAL_SO_TARGET),$(SO_TARGET))
cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(SO_TARGET)) && ln -s $(notdir $(FINAL_SO_TARGET)) $(notdir $(SO_TARGET))
@@ -121,6 +126,7 @@
cd $(DESTDIR)$(libdir) && $(RM) $(notdir $(MIDDLE_SO_TARGET)) && ln -s $(notdir $(FINAL_SO_TARGET)) $(notdir $(MIDDLE_SO_TARGET))
endif
endif
+endif
ifneq ($(IMPORT_LIB_EXT),)
$(INSTALL-L) $(FINAL_IMPORT_LIB) $(DESTDIR)$(libdir)
ifneq ($(IMPORT_LIB),$(FINAL_IMPORT_LIB))
diff --git a/icu4c/source/stubdata/Makefile.in b/icu4c/source/stubdata/Makefile.in
index 03c7ade..162c63a 100644
--- a/icu4c/source/stubdata/Makefile.in
+++ b/icu4c/source/stubdata/Makefile.in
@@ -12,7 +12,6 @@
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-platform = @platform@
top_builddir = ..
@@ -88,8 +87,9 @@
$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
endif
ifneq ($(ENABLE_SHARED),)
-ifeq ($(platform), U_MINGW)
- @$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
else
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
diff --git a/icu4c/source/tools/ctestfw/Makefile.in b/icu4c/source/tools/ctestfw/Makefile.in
index 50aae13..845fdc9 100644
--- a/icu4c/source/tools/ctestfw/Makefile.in
+++ b/icu4c/source/tools/ctestfw/Makefile.in
@@ -12,7 +12,6 @@
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-platform = @platform@
top_builddir = ../..
@@ -84,8 +83,9 @@
$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
endif
ifneq ($(ENABLE_SHARED),)
-ifeq ($(platform), U_MINGW)
- @$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
else
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)
diff --git a/icu4c/source/tools/genren/Makefile b/icu4c/source/tools/genren/Makefile
index 082c74f..f0ab666 100644
--- a/icu4c/source/tools/genren/Makefile
+++ b/icu4c/source/tools/genren/Makefile
@@ -32,11 +32,18 @@
include $(BUILDDIR)/icudefs.mk
endif
-COM=$(ICUDIR)/lib/libicuuc.$(SO)
-I18=$(ICUDIR)/lib/libicui18n.$(SO)
-LEX=$(ICUDIR)/lib/libiculx.$(SO)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+installdir = bin
+else
+installdir = lib
+endif
+
+COM=$(ICUDIR)/$(installdir)/libicuuc.$(SO)
+I18=$(ICUDIR)/$(installdir)/libicui18n.$(SO)
+LEX=$(ICUDIR)/$(installdir)/libiculx.$(SO)
DAT=$(ICUDIR)/stubdata/libicudata.$(SO)
-UIO=$(ICUDIR)/lib/libicuio.$(SO)
+UIO=$(ICUDIR)/$(installdir)/libicuio.$(SO)
LIBS=$(COM) $(I18) $(LEX) $(UIO)
diff --git a/icu4c/source/tools/toolutil/Makefile.in b/icu4c/source/tools/toolutil/Makefile.in
index 923be3c..0a6dc7d 100644
--- a/icu4c/source/tools/toolutil/Makefile.in
+++ b/icu4c/source/tools/toolutil/Makefile.in
@@ -12,7 +12,6 @@
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-platform = @platform@
top_builddir = ../..
@@ -95,8 +94,9 @@
$(INSTALL-L) $(TARGET) $(DESTDIR)$(libdir)
endif
ifneq ($(ENABLE_SHARED),)
-ifeq ($(platform), U_MINGW)
- @$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+# For MinGW, do we want the DLL to go in the bin location?
+ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(bindir)
else
$(INSTALL-L) $(FINAL_SO_TARGET) $(DESTDIR)$(libdir)