gecko-dev/intl/icu-patches/bug-724533

304 lines
11 KiB
Plaintext

# HG changeset patch
# Parent a7f3631893c30ca7f1ccf5a36674786566e48103
# User Jeff Walden <jwalden@mit.edu>
Bug 724533 - Make ICU build with Mozilla build for Windows. r=gps
diff --git a/intl/icu/source/acinclude.m4 b/intl/icu/source/acinclude.m4
--- a/intl/icu/source/acinclude.m4
+++ b/intl/icu/source/acinclude.m4
@@ -42,7 +42,10 @@ powerpc*-*-linux*)
#error This is not MinGW64
#endif], [], icu_cv_host_frag=mh-mingw64, icu_cv_host_frag=mh-mingw), icu_cv_host_frag=mh-cygwin)
else
- icu_cv_host_frag=mh-cygwin-msvc
+ case "${host}" in
+ *-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;;
+ *-*-mingw32|*-*-mingw64) icu_cv_host_frag=mh-msys-msvc ;;
+ esac
fi ;;
*-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;;
*-*-aix*)
@@ -474,7 +477,9 @@ AC_DEFUN([AC_CHECK_STRICT_COMPILE],
if test "`$CC /help 2>&1 | head -c9`" = "Microsoft"
then
CFLAGS="$CFLAGS /W4"
- fi
+ fi ;;
+ *-*-mingw32|*-*-mingw64)
+ CFLAGS="$CFLAGS -W4" ;;
esac
fi
if test "$GXX" = yes
@@ -486,7 +491,9 @@ AC_DEFUN([AC_CHECK_STRICT_COMPILE],
if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft"
then
CXXFLAGS="$CXXFLAGS /W4"
- fi
+ fi ;;
+ *-*-mingw32|*-*-mingw64)
+ CFLAGS="$CFLAGS -W4" ;;
esac
fi
fi
diff --git a/intl/icu/source/config/mh-cygwin-msvc b/intl/icu/source/config/mh-msys-msvc
copy from intl/icu/source/config/mh-cygwin-msvc
copy to intl/icu/source/config/mh-msys-msvc
--- a/intl/icu/source/config/mh-cygwin-msvc
+++ b/intl/icu/source/config/mh-msys-msvc
@@ -1,4 +1,4 @@
-## Cygwin with Microsoft Visual C++ compiler specific setup
+## MSYS with Microsoft Visual C++ compiler specific setup
## Copyright (c) 2001-2013, International Business Machines Corporation and
## others. All Rights Reserved.
@@ -10,8 +10,8 @@ sbindir=$(bindir)
## Commands to generate dependency files
GEN_DEPS.c= :
GEN_DEPS.cc= :
-#GEN_DEPS.c= $(COMPILE.c) /E
-#GEN_DEPS.cc= $(COMPILE.cc) /E
+#GEN_DEPS.c= $(COMPILE.c) -E
+#GEN_DEPS.cc= $(COMPILE.cc) -E
## Flags to create/use a static library
ifneq ($(ENABLE_SHARED),YES)
@@ -41,41 +41,41 @@ CPPFLAGS+=-D_DEBUG=1#M#
ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M#
endif
-# /GF pools strings and places them into read-only memory
-# /EHsc enables exception handling
-# /Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility.
+# -GF pools strings and places them into read-only memory
+# -EHsc enables exception handling
+# -Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility.
# -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions.
-CFLAGS+=/GF /nologo
-CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t
+CFLAGS+=-GF -nologo
+CXXFLAGS+=-GF -nologo -EHsc -Zc:wchar_t
CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE
DEFS+=-DWIN32 -DCYGWINMSVC
-LDFLAGS+=/nologo
+LDFLAGS+=-nologo
# Commands to compile
-COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) /c
-COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) /c
+COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c
+COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c
# Commands to link
-LINK.c= LINK.EXE /subsystem:console $(LDFLAGS)
-LINK.cc= LINK.EXE /subsystem:console $(LDFLAGS)
+LINK.c= LINK.EXE -subsystem:console $(LDFLAGS)
+LINK.cc= LINK.EXE -subsystem:console $(LDFLAGS)
## Commands to make a shared library
-SHLIB.c= LINK.EXE /DLL $(LDFLAGS)
-SHLIB.cc= LINK.EXE /DLL $(LDFLAGS)
+SHLIB.c= LINK.EXE -DLL $(LDFLAGS)
+SHLIB.cc= LINK.EXE -DLL $(LDFLAGS)
## Compiler switch to embed a runtime search path
LD_RPATH=
LD_RPATH_PRE=
## Compiler switch to embed a library name
-LD_SONAME = /IMPLIB:$(SO_TARGET:.dll=.lib)
+LD_SONAME = -IMPLIB:$(SO_TARGET:.dll=.lib)
## Shared object suffix
SO = dll
## Non-shared intermediate object suffix
STATIC_O = ao
# OUTOPT is for creating a specific output name
-OUTOPT = /out:
+OUTOPT = -out:
# Static library prefix and file extension
LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX)
@@ -83,11 +83,11 @@ A = lib
# Cygwin's ar can't handle Win64 right now. So we use Microsoft's tool instead.
AR = LIB.EXE#M#
-ARFLAGS := /nologo $(ARFLAGS:r=)#M#
+ARFLAGS := -nologo $(ARFLAGS:r=)#M#
RANLIB = ls -s#M#
-AR_OUTOPT = /OUT:#M#
+AR_OUTOPT = -OUT:#M#
-## An import library is needed for z/OS, MSVC and Cygwin
+## An import library is needed for z-OS, MSVC and Cygwin
IMPORT_LIB_EXT = .lib
LIBPREFIX=
@@ -114,37 +114,25 @@ LIBCTESTFW= $(top_builddir)/tools/ctestf
LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib
## These are the library specific LDFLAGS
-LDFLAGSICUDT+= /base:"0x4ad00000" /NOENTRY# The NOENTRY option is required for creating a resource-only DLL.
-LDFLAGSICUUC= /base:"0x4a800000"# in-uc = 1MB
-LDFLAGSICUI18N= /base:"0x4a900000"# io-in = 2MB
-LDFLAGSICUIO= /base:"0x4ab00000"# le-io = 1MB
-LDFLAGSICULE= /base:"0x4ac00000"# lx-le = 512KB
-LDFLAGSICULX= /base:"0x4ac80000"
+LDFLAGSICUDT+= -base:"0x4ad00000" -NOENTRY# The NOENTRY option is required for creating a resource-only DLL.
+LDFLAGSICUUC= -base:"0x4a800000"# in-uc = 1MB
+LDFLAGSICUI18N= -base:"0x4a900000"# io-in = 2MB
+LDFLAGSICUIO= -base:"0x4ab00000"# le-io = 1MB
+LDFLAGSICULE= -base:"0x4ac00000"# lx-le = 512KB
+LDFLAGSICULX= -base:"0x4ac80000"
LDFLAGSCTESTFW=# Unused for now.
-LDFLAGSICUTOOLUTIL= /base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix.
-
-# The #M# is used to delete lines for icu-config
-# Current full path directory.
-CURR_FULL_DIR?=$(subst \,/,$(shell cygpath -da .))#M# -m isn't used because it doesn't work on Win98
-# Current full path directory for use in source code in a -D compiler option.
-CURR_SRCCODE_FULL_DIR=$(subst \,\\,$(shell cygpath -da .))#M#
-
-ifeq ($(srcdir),.)
-SOURCE_FILE=$<
-else
-SOURCE_FILE=$(shell cygpath -dma $<)#M#
-endif
+LDFLAGSICUTOOLUTIL= -base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix.
## Compilation rules
%.$(STATIC_O): $(srcdir)/%.c
- $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) /Fo$@ $(SOURCE_FILE)
+ $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -Fo$@ $<
%.o: $(srcdir)/%.c
- $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) /Fo$@ $(SOURCE_FILE)
+ $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -Fo$@ $<
%.$(STATIC_O): $(srcdir)/%.cpp
- $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) /Fo$@ $(SOURCE_FILE)
+ $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -Fo$@ $<
%.o: $(srcdir)/%.cpp
- $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) /Fo$@ $(SOURCE_FILE)
+ $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -Fo$@ $<
## Dependency rules
@@ -175,7 +163,7 @@ endif
## Compile a Windows resource file
%.res : $(srcdir)/%.rc
- rc.exe /fo$@ $(CPPFLAGS) $(SOURCE_FILE)
+ rc.exe -fo$@ $(CPPFLAGS) $<
## Versioned target for a shared library.
FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
@@ -191,8 +179,8 @@ MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
## Special pkgdata information that is needed
PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
-ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M#
-ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; cygpath -dma $(DESTDIR)$(libdir))#M#
+ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; echo $(DESTDIR)$(ICUPKGDATA_DIR))#M#
+ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; echo $(DESTDIR)$(libdir))#M#
## Versioned import library names. The library names are versioned,
## but the import libraries do not need versioning.
@@ -225,5 +213,5 @@ PKGDATA_INVOKE_OPTS = MAKEFLAGS=
# Include the version information in the shared library
ENABLE_SO_VERSION_DATA=1
-## End Cygwin-specific setup
+## End MSYS-specific setup
diff --git a/intl/icu/source/configure b/intl/icu/source/configure
--- a/intl/icu/source/configure
+++ b/intl/icu/source/configure
@@ -4100,7 +4100,9 @@ fi
if test "`$CC /help 2>&1 | head -c9`" = "Microsoft"
then
CFLAGS="$CFLAGS /W4"
- fi
+ fi ;;
+ *-*-mingw32|*-*-mingw64)
+ CFLAGS="$CFLAGS -W4" ;;
esac
fi
if test "$GXX" = yes
@@ -4112,7 +4114,9 @@ fi
if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft"
then
CXXFLAGS="$CXXFLAGS /W4"
- fi
+ fi ;;
+ *-*-mingw32|*-*-mingw64)
+ CFLAGS="$CFLAGS -W4" ;;
esac
fi
fi
@@ -4915,7 +4919,10 @@ else
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
- icu_cv_host_frag=mh-cygwin-msvc
+ case "${host}" in
+ *-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;;
+ *-*-mingw32|*-*-mingw64) icu_cv_host_frag=mh-msys-msvc ;;
+ esac
fi ;;
*-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;;
*-*-aix*)
@@ -5157,7 +5164,7 @@ fi
MSVC_RELEASE_FLAG=""
if test $enabled = yes
then
- if test $icu_cv_host_frag = mh-cygwin-msvc
+ if test $icu_cv_host_frag = mh-cygwin-msvc -o $icu_cv_host_frag = mh-msys-msvc
then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff --git a/intl/icu/source/configure.ac b/intl/icu/source/configure.ac
--- a/intl/icu/source/configure.ac
+++ b/intl/icu/source/configure.ac
@@ -330,7 +330,7 @@ AC_SUBST(UCLN_NO_AUTO_CLEANUP)
MSVC_RELEASE_FLAG=""
if test $enabled = yes
then
- if test $icu_cv_host_frag = mh-cygwin-msvc
+ if test $icu_cv_host_frag = mh-cygwin-msvc -o $icu_cv_host_frag = mh-msys-msvc
then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined _MSC_VER && _MSC_VER >= 1400
diff --git a/intl/icu/source/data/Makefile.in b/intl/icu/source/data/Makefile.in
--- a/intl/icu/source/data/Makefile.in
+++ b/intl/icu/source/data/Makefile.in
@@ -350,7 +350,8 @@ ifeq ($(ENABLE_SO_VERSION_DATA),1)
ifeq ($(PKGDATA_MODE),dll)
SO_VERSION_DATA = $(OUTTMPDIR)/icudata.res
$(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc
- rc.exe /i$(srcdir)/../common /i$(top_builddir)/common /fo$@ $(CPPFLAGS) $(SOURCE_FILE)
+ # fixme: need to tell whether to use - or /, $(SOURCEFILE) or $<
+ rc.exe -i$(srcdir)/../common -i$(top_builddir)/common -fo$@ $(CPPFLAGS) $<
endif
endif
diff --git a/intl/icu/source/runConfigureICU b/intl/icu/source/runConfigureICU
--- a/intl/icu/source/runConfigureICU
+++ b/intl/icu/source/runConfigureICU
@@ -315,6 +315,17 @@ case $platform in
CXXFLAGS="--std=c++03"
export CXXFLAGS
;;
+ MSYS/MSVC)
+ THE_OS="MSYS"
+ THE_COMP="Microsoft Visual C++"
+ CC=cl; export CC
+ CXX=cl; export CXX
+ RELEASE_CFLAGS='-Gy -MD'
+ RELEASE_CXXFLAGS='-Gy -MD'
+ DEBUG_CFLAGS='-Zi -MDd'
+ DEBUG_CXXFLAGS='-Zi -MDd'
+ DEBUG_LDFLAGS='-DEBUG'
+ ;;
*BSD)
THE_OS="BSD"
THE_COMP="the GNU C++"