summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rwxr-xr-x[-rw-r--r--]Makefile.in1
-rw-r--r--config/companion_libs.in25
-rwxr-xr-xconfig/companion_libs/gettext.in19
-rw-r--r--config/companion_libs/libiconv.in19
-rw-r--r--config/libc/glibc.in1
-rwxr-xr-x[-rw-r--r--]configure.ac7
-rwxr-xr-x[-rw-r--r--]docs/C - Misc. tutorials.txt46
-rwxr-xr-x[-rw-r--r--]kconfig/Makefile9
-rwxr-xr-xpatches/binutils/2.25.1/310-fix-gold-pthreads-typo.patch14
-rwxr-xr-xpatches/binutils/2.25.1/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch11
-rw-r--r--patches/binutils/2.25.1/330-Dont-link-to-libfl-as-its-unnecessary.patch102
-rw-r--r--patches/gettext/0.19.6/110-Fix-linker-error-redefinition-of-vasprintf.patch31
-rw-r--r--patches/gettext/0.19.6/120-Fix-Woe32-link-errors-when-compiling-with-O0.patch369
-rw-r--r--patches/gettext/0.19.6/130-Fix-static-Cygwin-x86_64-build-environ-is-always-dllimport.patch72
-rw-r--r--patches/glibc/2.22/110-Cygwin-doesnt-have-stat64.patch13
-rw-r--r--patches/libiconv/1.14/100-srclib_stdio.in.h-remove-gets-declarations.patch30
-rwxr-xr-xpatches/libtool/2.4.6/2.4.5-pass-ldflags.patch12
-rwxr-xr-xpatches/linux/4.2.3/100-Define-R_X86_64_JUMP_SLOT-for-Cygwin.patch16
-rwxr-xr-xsamples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/crosstool.config28
-rw-r--r--samples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/reported.by3
-rwxr-xr-xscripts/build/companion_libs/320-libiconv.sh113
-rwxr-xr-xscripts/build/companion_libs/330-gettext.sh136
-rwxr-xr-x[-rw-r--r--]scripts/build/companion_tools/400-libtool.sh2
-rw-r--r--scripts/build/libc/glibc.sh14
25 files changed, 1084 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 44b8d20..58f6a85 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,6 +25,7 @@ addons:
- gperf
- libncurses5-dev
- texinfo
+ - help2man
# Building crosstool-NG core
install:
diff --git a/Makefile.in b/Makefile.in
index 895983b..59d8e54 100644..100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -75,6 +75,7 @@ export CPPFLAGS := @CPPFLAGS@
export CFLAGS := @CFLAGS@
export LDFLAGS := @LDFLAGS@
export LIBS := @LIBS@
+export INTL_LIBS := @INTL_LIBS@
export curses_hdr := @ac_ct_curses_hdr@
export gettext := @gettext@
diff --git a/config/companion_libs.in b/config/companion_libs.in
index c48fc82..0b0177c 100644
--- a/config/companion_libs.in
+++ b/config/companion_libs.in
@@ -7,6 +7,17 @@ menu "Companion libraries"
config COMPLIBS_NEEDED
bool
+config LIBICONV_NEEDED
+ bool
+ select LIBICONV
+ select COMPLIBS_NEEDED
+
+config GETTEXT_NEEDED
+ bool
+ select GETTEXT
+ select LIBICONV_NEEDED
+ select COMPLIBS_NEEDED
+
config GMP_NEEDED
bool
select GMP
@@ -45,6 +56,14 @@ config LIBELF_NEEDED
config COMPLIBS
bool
+config LIBICONV
+ bool
+ select COMPLIBS
+
+config GETTEXT
+ bool
+ select COMPLIBS
+
config GMP
bool
select COMPLIBS
@@ -82,6 +101,12 @@ config LIBELF
config LIBELF_TARGET
bool
+if LIBICONV
+source "config/companion_libs/libiconv.in"
+endif
+if GETTEXT
+source "config/companion_libs/gettext.in"
+endif
if GMP
source "config/companion_libs/gmp.in"
endif
diff --git a/config/companion_libs/gettext.in b/config/companion_libs/gettext.in
new file mode 100755
index 0000000..ef5e5a5
--- /dev/null
+++ b/config/companion_libs/gettext.in
@@ -0,0 +1,19 @@
+# gettext options
+
+choice
+ bool
+ prompt "gettext version"
+# Don't remove next line
+# CT_INSERT_VERSION_BELOW
+
+config GETTEXT_V_0_19_6
+ bool
+ prompt "0.19.6"
+
+endchoice
+
+config GETTEXT_VERSION
+ string
+# Don't remove next line
+# CT_INSERT_VERSION_STRING_BELOW
+ default "0.19.6" if GETTEXT_V_0_19_6
diff --git a/config/companion_libs/libiconv.in b/config/companion_libs/libiconv.in
new file mode 100644
index 0000000..361d34e
--- /dev/null
+++ b/config/companion_libs/libiconv.in
@@ -0,0 +1,19 @@
+# libiconv options
+
+choice
+ bool
+ prompt "libiconv version"
+# Don't remove next line
+# CT_INSERT_VERSION_BELOW
+
+config LIBICONV_V_1_14
+ bool
+ prompt "1.14"
+
+endchoice
+
+config LIBICONV_VERSION
+ string
+# Don't remove next line
+# CT_INSERT_VERSION_STRING_BELOW
+ default "1.14" if LIBICONV_V_1_14
diff --git a/config/libc/glibc.in b/config/libc/glibc.in
index dee6748..71df501 100644
--- a/config/libc/glibc.in
+++ b/config/libc/glibc.in
@@ -4,6 +4,7 @@
##
## select LIBC_SUPPORT_THREADS_NATIVE
## select CC_CORE_PASSES_NEEDED
+## select GETTEXT_NEEDED
##
## help The de-facto standard for Linux distributions.
## help Feature-rich, but large... Most useful for desktop-like systems.
diff --git a/configure.ac b/configure.ac
index adde2ab..b922482 100644..100755
--- a/configure.ac
+++ b/configure.ac
@@ -171,6 +171,7 @@ ACX_CHECK_PROGS_REQ([wget], [wget])
ACX_CHECK_PROGS_REQ([tar], [tar])
ACX_CHECK_PROGS_REQ([gzip], [gzip])
ACX_CHECK_PROGS_REQ([bzip2], [bzip2])
+ACX_CHECK_PROGS_REQ([help2man], [help2man])
#--------------------------------------------------------------------
# Still boring, but remember the path, now...
@@ -320,7 +321,7 @@ AC_FUNC_REALLOC
AC_FUNC_ALLOCA
#----------------------------------------
-# Check for gettext, for the kconfig frontends
+# Check for gettext and libintl for the kconfig frontends
AC_SUBST([gettext])
AC_CHECK_HEADERS(
[libintl.h],
@@ -332,6 +333,10 @@ AS_IF(
[gettext=y],,
[AC_INCLUDES_DEFAULT()
#include <$ac_ct_gettext_hdr>])])
+SAVE_LIBS=$LIBS
+AC_SEARCH_LIBS(bindtextdomain, intl, [test "$ac_res" = "none required" || INTL_LIBS="${ac_res}"])
+LIBS=$SAVE_LIBS
+AC_SUBST([INTL_LIBS])
#----------------------------------------
# Check for ncurses, for the kconfig frontends
diff --git a/docs/C - Misc. tutorials.txt b/docs/C - Misc. tutorials.txt
index 0a827d2..34f485b 100644..100755
--- a/docs/C - Misc. tutorials.txt
+++ b/docs/C - Misc. tutorials.txt
@@ -313,3 +313,49 @@ Here is an example commit message (see revision 8bb5151c5b01):
I missed refreshing the patch before pushing. :-(
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+
+Using crosstool-NG on Windows |
+------------------------------+
+
+Contributed by: Ray Donnelly
+
+Prerequisites and instructions for using crosstool-NG for building a cross
+toolchain on Windows (Cygwin) as build and, optionally Windows (hereafter)
+MinGW-w64 as host.
+
+0. Use Cygwin64 if you can. DLL base-address problems are lessened that
+ way and if you bought a 64-bit CPU, you may as well use it.
+
+1. You must enable Case Sensitivity in the Windows Kernel (this is only really
+ necessary for Linux targets, but at present, crosstool-ng refuses to operate
+ on case insensitive filesystems). The registry key for this is:
+ HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive
+ Read more at:
+ https://cygwin.com/cygwin-ug-net/using-specialnames.html
+
+2. Using setup{,-x86_64}.exe, install the default packages and also the
+ following ones: (tested versions in brackets, please test newer versions
+ and report successes via pull requests changing this list and failures to:
+ https://github.com/crosstool-ng/crosstool-ng/issues
+ autoconf (13-1), make (4.1-1), gcc-g++ (4.9.3-1), gperf (3.0.4-2),
+ bison (3.0.4-1), flex (2.5.39-1), texinfo (6.0-1), wget (1.16.3-1),
+ patch (2.7.4-1), libtool (2.4.6-2), automake (9-1), diffutils (3.3-3),
+ libncurses-devel (6.0-1.20151017), help2man (1.44.1-1)
+ mingw64-i686-gcc-g++* (4.9.2-2), mingw64-x86_64-gcc-g++* (4.9.2-2)
+ Leave "Select required packages (RECOMMENDED)" ticked.
+ Notes:
+ 2.1 The packages marked with * are only needed if your host is MinGW-w64.
+ 2.2 Unfortunately, wget pulls in an awful lot of dependencies, including
+ Python 2.7, Ruby, glib and Tcl.
+
+3. Although nativestrict symlinks seem like the best idea, extracting glibc fails
+ when they are enabled, so just don't set anything here. If your host is MinGW-w64
+ then these 'Cygwin-special' symlinks won't work, but you can dereference them by
+ using tar options --dereference and --hard-dereference when making a final tarball.
+ I plan to investigate and fix or at least work around the extraction problem.
+ Read more at:
+ https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
+
+4. collect2.exe will attempt to run ld which is a shell script that runs either
+ ld.exe or gold.exe so you need to make sure that a working shell is in your path.
+ Eventually I will replace this with a native program for MinGW-w64 host.
diff --git a/kconfig/Makefile b/kconfig/Makefile
index b18ddc0..27482af 100644..100755
--- a/kconfig/Makefile
+++ b/kconfig/Makefile
@@ -7,7 +7,7 @@ all: conf mconf nconf
# Build flags
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
-LDFLAGS =
+LDFLAGS = $(INTL_LIBS)
# Compiler flags to use gettext
ifeq ($(gettext),)
@@ -50,13 +50,6 @@ nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
nconf: LDFLAGS += -lmenu -lpanel -lncurses
-# Under Cygwin, we need to auto-import some libs (which ones, exactly?)
-# for mconf and nconf to lin properly.
-ifeq ($(shell uname -o 2>/dev/null || echo unknown),Cygwin)
-mconf: LDFLAGS += -Wl,--enable-auto-import
-nconf: LDFLAGS += -Wl,--enable-auto-import
-endif
-
# These are generated files:
ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))
ALL_DEPS = $(sort $(COMMON_DEP) $(LX_DEP) $(conf_DEP) $(mconf_DEP) $(nconf_DEP))
diff --git a/patches/binutils/2.25.1/310-fix-gold-pthreads-typo.patch b/patches/binutils/2.25.1/310-fix-gold-pthreads-typo.patch
new file mode 100755
index 0000000..f2e6ff2
--- /dev/null
+++ b/patches/binutils/2.25.1/310-fix-gold-pthreads-typo.patch
@@ -0,0 +1,14 @@
+--- binutils-2.25.1/gold/gold-threads.cc.orig 2014-10-14 08:32:04.000000000 +0100
++++ binutils-2.25.1/gold/gold-threads.cc 2015-10-20 22:38:18.640819300 +0100
+@@ -102,9 +102,9 @@
+ if (err != 0)
+ gold_fatal(_("pthead_mutextattr_init failed: %s"), strerror(err));
+ #ifdef PTHREAD_MUTEX_ADAPTIVE_NP
+- err = pthread_mutextattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
++ err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
+ if (err != 0)
+- gold_fatal(_("pthread_mutextattr_settype failed: %s"), strerror(err));
++ gold_fatal(_("pthread_mutexattr_settype failed: %s"), strerror(err));
+ #endif
+
+ err = pthread_mutex_init(&this->mutex_, &attr);
diff --git a/patches/binutils/2.25.1/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch b/patches/binutils/2.25.1/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch
new file mode 100755
index 0000000..f9a8af6
--- /dev/null
+++ b/patches/binutils/2.25.1/320-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch
@@ -0,0 +1,11 @@
+--- binutils-2.25.1/gold/gold-threads.cc.orig 2015-10-20 22:39:36.371169400 +0100
++++ binutils-2.25.1/gold/gold-threads.cc 2015-10-20 22:39:38.182772700 +0100
+@@ -101,7 +101,7 @@
+ int err = pthread_mutexattr_init(&attr);
+ if (err != 0)
+ gold_fatal(_("pthead_mutextattr_init failed: %s"), strerror(err));
+-#ifdef PTHREAD_MUTEX_ADAPTIVE_NP
++#if defined(PTHREAD_MUTEX_ADAPTIVE_NP) && !defined(_WIN32)
+ err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
+ if (err != 0)
+ gold_fatal(_("pthread_mutexattr_settype failed: %s"), strerror(err));
diff --git a/patches/binutils/2.25.1/330-Dont-link-to-libfl-as-its-unnecessary.patch b/patches/binutils/2.25.1/330-Dont-link-to-libfl-as-its-unnecessary.patch
new file mode 100644
index 0000000..af4032a
--- /dev/null
+++ b/patches/binutils/2.25.1/330-Dont-link-to-libfl-as-its-unnecessary.patch
@@ -0,0 +1,102 @@
+diff -urN binutils-2.25.1.orig/binutils/configure binutils-2.25.1/binutils/configure
+--- binutils-2.25.1.orig/binutils/configure 2015-10-25 13:18:46.249052806 +0000
++++ binutils-2.25.1/binutils/configure 2015-10-25 13:39:21.339034801 +0000
+@@ -12067,6 +12067,7 @@
+ done
+ test -n "$YACC" || YACC="yacc"
+
++save_LIBS=$LIBS
+ for ac_prog in flex lex
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+@@ -12227,6 +12228,8 @@
+ if test "$LEX" = :; then
+ LEX=${am_missing_run}flex
+ fi
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="bg da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr"
+ # If we haven't got the data from the intl directory,
+diff -urN binutils-2.25.1.orig/binutils/configure.ac binutils-2.25.1/binutils/configure.ac
+--- binutils-2.25.1.orig/binutils/configure.ac 2015-10-25 13:18:46.249052806 +0000
++++ binutils-2.25.1/binutils/configure.ac 2015-10-25 13:38:52.969035216 +0000
+@@ -87,7 +87,10 @@
+ fi
+
+ AC_PROG_YACC
++save_LIBS=$LIBS
+ AM_PROG_LEX
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="bg da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr"
+ ZW_GNU_GETTEXT_SISTER_DIR
+diff -urN binutils-2.25.1.orig/gas/configure binutils-2.25.1/gas/configure
+--- binutils-2.25.1.orig/gas/configure 2015-10-25 13:18:46.389052803 +0000
++++ binutils-2.25.1/gas/configure 2015-10-25 15:16:55.988949456 +0000
+@@ -12795,6 +12795,7 @@
+ done
+ test -n "$YACC" || YACC="yacc"
+
++save_LIBS=$LIBS
+ for ac_prog in flex lex
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+@@ -12955,6 +12956,8 @@
+ if test "$LEX" = :; then
+ LEX=${am_missing_run}flex
+ fi
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="fr tr es rw id ru fi ja"
+ # If we haven't got the data from the intl directory,
+diff -urN binutils-2.25.1.orig/gas/configure.ac binutils-2.25.1/gas/configure.ac
+--- binutils-2.25.1.orig/gas/configure.ac 2015-10-25 15:15:06.000000000 +0000
++++ binutils-2.25.1/gas/configure.ac 2015-10-25 14:45:32.000000000 +0000
+@@ -717,7 +717,10 @@
+ AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.])
+
+ AC_PROG_YACC
++save_LIBS=$LIBS
+ AM_PROG_LEX
++LIBS=$save_LIBS
++LEXLIB=
+
+ ALL_LINGUAS="fr tr es rw id ru fi ja"
+ ZW_GNU_GETTEXT_SISTER_DIR
+diff -urN binutils-2.25.1.orig/ld/configure binutils-2.25.1/ld/configure
+--- binutils-2.25.1.orig/ld/configure 2015-10-25 13:18:47.399052788 +0000
++++ binutils-2.25.1/ld/configure 2015-10-25 15:17:06.472282637 +0000
+@@ -16071,6 +16071,7 @@
+ done
+ test -n "$YACC" || YACC="yacc"
+
++save_LIBS=$LIBS
+ for ac_prog in flex lex
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+@@ -16231,6 +16232,8 @@
+ if test "$LEX" = :; then
+ LEX=${am_missing_run}flex
+ fi
++LIBS=$save_LIBS
++LEXLIB=
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+diff -urN binutils-2.25.1.orig/ld/configure.ac binutils-2.25.1/ld/configure.ac
+--- binutils-2.25.1.orig/ld/configure.ac 2015-10-25 13:18:47.415719456 +0000
++++ binutils-2.25.1/ld/configure.ac 2015-10-25 15:14:43.000000000 +0000
+@@ -173,7 +173,10 @@
+ AC_EXEEXT
+
+ AC_PROG_YACC
++save_LIBS=$LIBS
+ AM_PROG_LEX
++LIBS=$save_LIBS
++LEXLIB=
+
+ AM_MAINTAINER_MODE
+ AM_CONDITIONAL(GENINSRC_NEVER, false)
diff --git a/patches/gettext/0.19.6/110-Fix-linker-error-redefinition-of-vasprintf.patch b/patches/gettext/0.19.6/110-Fix-linker-error-redefinition-of-vasprintf.patch
new file mode 100644
index 0000000..dacdfb1
--- /dev/null
+++ b/patches/gettext/0.19.6/110-Fix-linker-error-redefinition-of-vasprintf.patch
@@ -0,0 +1,31 @@
+From a76649dae62768d0af7017b3fc0ca5f891588c78 Mon Sep 17 00:00:00 2001
+From: Andoni Morales Alastruey <ylatuya@gmail.com>
+Date: Wed, 29 Feb 2012 10:44:43 +0100
+Subject: [PATCH] Fix linker error: redefinition of vasprintf
+
+This might not be the best patch, but it works for us
+The link error was:
+.libs/autosprintf.o:autosprintf.cc:(.text$vasprintf[_vasprintf]+0x0): multiple definition of `_vasprintf'
+.libs/lib-asprintf.o:lib-asprintf.c:(.text+0x4621): first defined here
+---
+ gettext-runtime/libasprintf/autosprintf.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/gettext-runtime/libasprintf/autosprintf.cc b/gettext-runtime/libasprintf/autosprintf.cc
+index ca318f7..2526210 100644
+--- a/gettext-runtime/libasprintf/autosprintf.cc
++++ b/gettext-runtime/libasprintf/autosprintf.cc
+@@ -19,8 +19,10 @@
+ This must come before <config.h> because <config.h> may include
+ <features.h>, and once <features.h> has been included, it's too late. */
+ #ifndef _GNU_SOURCE
++#ifndef _WIN32
+ # define _GNU_SOURCE 1
+ #endif
++#endif
+
+ /* Specification. */
+ #include "autosprintf.h"
+--
+1.8.4
+
diff --git a/patches/gettext/0.19.6/120-Fix-Woe32-link-errors-when-compiling-with-O0.patch b/patches/gettext/0.19.6/120-Fix-Woe32-link-errors-when-compiling-with-O0.patch
new file mode 100644
index 0000000..d5c4143
--- /dev/null
+++ b/patches/gettext/0.19.6/120-Fix-Woe32-link-errors-when-compiling-with-O0.patch
@@ -0,0 +1,369 @@
+From d4ecf6f15ad7a428786df2efdc88b03be0a4fdbb Mon Sep 17 00:00:00 2001
+From: Daiki Ueno <ueno@gnu.org>
+Date: Thu, 17 Jan 2013 18:33:40 +0900
+Subject: [PATCH] Fix Woe32 link errors when compiling with -O0.
+
+---
+ gettext-tools/src/Makefile.am | 24 ++++++++++++++++++++++--
+ gettext-tools/src/color.c | 1 +
+ gettext-tools/woe32dll/c++color.cc | 1 +
+ gettext-tools/woe32dll/c++file-ostream.cc | 2 ++
+ gettext-tools/woe32dll/c++html-ostream.cc | 1 +
+ gettext-tools/woe32dll/c++styled-ostream.cc | 1 +
+ gettext-tools/woe32dll/c++term-ostream.cc | 1 +
+ gettext-tools/woe32dll/c++write-catalog.cc | 1 +
+ gettext-tools/woe32dll/c++write-po.cc | 1 +
+ gettext-tools/woe32dll/c++write-properties.cc | 1 +
+ gettext-tools/woe32dll/c++write-stringtable.cc | 1 +
+ gnulib-local/modules/file-ostream | 4 ++++
+ gnulib-local/modules/html-ostream | 4 ++++
+ gnulib-local/modules/ostream | 4 ++++
+ gnulib-local/modules/styled-ostream | 4 ++++
+ gnulib-local/modules/term-ostream | 4 ++++
+ 16 files changed, 53 insertions(+), 2 deletions(-)
+ create mode 100644 gettext-tools/woe32dll/c++color.cc
+ create mode 100644 gettext-tools/woe32dll/c++file-ostream.cc
+ create mode 100644 gettext-tools/woe32dll/c++html-ostream.cc
+ create mode 100644 gettext-tools/woe32dll/c++styled-ostream.cc
+ create mode 100644 gettext-tools/woe32dll/c++term-ostream.cc
+ create mode 100644 gettext-tools/woe32dll/c++write-catalog.cc
+ create mode 100644 gettext-tools/woe32dll/c++write-po.cc
+ create mode 100644 gettext-tools/woe32dll/c++write-properties.cc
+ create mode 100644 gettext-tools/woe32dll/c++write-stringtable.cc
+
+Additional fix (COLOR_SOURCE) by Ray Donnelly <mingw.android@gmail.com>
+
+diff -urN a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am
+--- a/gettext-tools/src/Makefile.am 2015-09-11 01:54:21.000000000 +0100
++++ b/gettext-tools/src/Makefile.am 2015-10-22 00:41:49.601786700 +0100
+@@ -145,10 +145,26 @@
+ format-lua.c \
+ format-javascript.c
+
++if !WOE32DLL
++COLOR_SOURCE = color.c
++OUTPUT_SOURCE = \
++ write-catalog.c \
++ write-properties.c \
++ write-stringtable.c \
++ write-po.c
++else
++COLOR_SOURCE = ../woe32dll/c++color.cc
++OUTPUT_SOURCE = \
++ ../woe32dll/c++write-catalog.cc \
++ ../woe32dll/c++write-properties.cc \
++ ../woe32dll/c++write-stringtable.cc \
++ ../woe32dll/c++write-po.cc
++endif
++
+ # libgettextsrc contains all code that is needed by at least two programs.
+ libgettextsrc_la_SOURCES = \
+ $(COMMON_SOURCE) read-catalog.c \
+-color.c write-catalog.c write-properties.c write-stringtable.c write-po.c \
++$(COLOR_SOURCE) $(OUTPUT_SOURCE) \
+ msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c msgl-header.c msgl-english.c \
+ msgl-check.c file-list.c msgl-charset.c po-time.c plural-exp.c plural-eval.c \
+ plural-table.c quote.h sentence.h sentence.c libexpat-compat.c \
+diff -urN a/gettext-tools/src/Makefile.in b/gettext-tools/src/Makefile.in
+--- a/gettext-tools/src/Makefile.in 2015-09-11 04:05:11.000000000 +0100
++++ b/gettext-tools/src/Makefile.in 2015-10-22 00:42:26.253852000 +0100
+@@ -387,19 +387,22 @@
+ am__libgettextsrc_la_SOURCES_DIST = message.c po-error.c po-xerror.c \
+ read-catalog-abstract.c po-lex.c po-gram-gen.y po-charset.c \
+ read-po.c read-properties.c read-stringtable.c open-catalog.c \
+- dir-list.c str-list.c read-catalog.c color.c write-catalog.c \
+- write-properties.c write-stringtable.c write-po.c msgl-ascii.c \
+- msgl-iconv.c msgl-equal.c msgl-cat.c msgl-header.c \
+- msgl-english.c msgl-check.c file-list.c msgl-charset.c \
+- po-time.c plural-exp.c plural-eval.c plural-table.c quote.h \
+- sentence.h sentence.c libexpat-compat.c format.c \
+- format-invalid.h format-c.c format-c-parse.h format-sh.c \
+- format-python.c format-python-brace.c format-lisp.c \
+- format-elisp.c format-librep.c format-scheme.c format-java.c \
+- format-csharp.c format-awk.c format-pascal.c format-ycp.c \
+- format-tcl.c format-perl.c format-perl-brace.c format-php.c \
+- format-gcc-internal.c format-gfc-internal.c format-qt.c \
+- format-qt-plural.c format-kde.c format-kde-kuit.c \
++ dir-list.c str-list.c read-catalog.c color.c \
++ ../woe32dll/c++color.cc write-catalog.c write-properties.c \
++ write-stringtable.c write-po.c ../woe32dll/c++write-catalog.cc \
++ ../woe32dll/c++write-properties.cc \
++ ../woe32dll/c++write-stringtable.cc ../woe32dll/c++write-po.cc \
++ msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c \
++ msgl-header.c msgl-english.c msgl-check.c file-list.c \
++ msgl-charset.c po-time.c plural-exp.c plural-eval.c \
++ plural-table.c quote.h sentence.h sentence.c libexpat-compat.c \
++ format.c format-invalid.h format-c.c format-c-parse.h \
++ format-sh.c format-python.c format-python-brace.c \
++ format-lisp.c format-elisp.c format-librep.c format-scheme.c \
++ format-java.c format-csharp.c format-awk.c format-pascal.c \
++ format-ycp.c format-tcl.c format-perl.c format-perl-brace.c \
++ format-php.c format-gcc-internal.c format-gfc-internal.c \
++ format-qt.c format-qt-plural.c format-kde.c format-kde-kuit.c \
+ format-boost.c format-lua.c format-javascript.c \
+ ../woe32dll/c++format.cc read-desktop.c \
+ ../woe32dll/gettextsrc-exports.c
+@@ -413,7 +416,18 @@
+ libgettextsrc_la-open-catalog.lo libgettextsrc_la-dir-list.lo \
+ libgettextsrc_la-str-list.lo
+ am__dirstamp = $(am__leading_dot)dirstamp
+-@WOE32DLL_FALSE@am__objects_2 = libgettextsrc_la-format.lo \
++@WOE32DLL_FALSE@am__objects_2 = libgettextsrc_la-color.lo
++@WOE32DLL_TRUE@am__objects_2 = \
++@WOE32DLL_TRUE@ ../woe32dll/libgettextsrc_la-c++color.lo
++@WOE32DLL_FALSE@am__objects_3 = libgettextsrc_la-write-catalog.lo \
++@WOE32DLL_FALSE@ libgettextsrc_la-write-properties.lo \
++@WOE32DLL_FALSE@ libgettextsrc_la-write-stringtable.lo \
++@WOE32DLL_FALSE@ libgettextsrc_la-write-po.lo
++@WOE32DLL_TRUE@am__objects_3 = ../woe32dll/libgettextsrc_la-c++write-catalog.lo \
++@WOE32DLL_TRUE@ ../woe32dll/libgettextsrc_la-c++write-properties.lo \
++@WOE32DLL_TRUE@ ../woe32dll/libgettextsrc_la-c++write-stringtable.lo \
++@WOE32DLL_TRUE@ ../woe32dll/libgettextsrc_la-c++write-po.lo
++@WOE32DLL_FALSE@am__objects_4 = libgettextsrc_la-format.lo \
+ @WOE32DLL_FALSE@ libgettextsrc_la-format-c.lo \
+ @WOE32DLL_FALSE@ libgettextsrc_la-format-sh.lo \
+ @WOE32DLL_FALSE@ libgettextsrc_la-format-python.lo \
+@@ -440,7 +454,7 @@
+ @WOE32DLL_FALSE@ libgettextsrc_la-format-boost.lo \
+ @WOE32DLL_FALSE@ libgettextsrc_la-format-lua.lo \
+ @WOE32DLL_FALSE@ libgettextsrc_la-format-javascript.lo
+-@WOE32DLL_TRUE@am__objects_2 = \
++@WOE32DLL_TRUE@am__objects_4 = \
+ @WOE32DLL_TRUE@ ../woe32dll/libgettextsrc_la-c++format.lo \
+ @WOE32DLL_TRUE@ libgettextsrc_la-format-c.lo \
+ @WOE32DLL_TRUE@ libgettextsrc_la-format-sh.lo \
+@@ -468,13 +482,10 @@
+ @WOE32DLL_TRUE@ libgettextsrc_la-format-boost.lo \
+ @WOE32DLL_TRUE@ libgettextsrc_la-format-lua.lo \
+ @WOE32DLL_TRUE@ libgettextsrc_la-format-javascript.lo
+-@WOE32DLL_TRUE@am__objects_3 = ../woe32dll/libgettextsrc_la-gettextsrc-exports.lo
++@WOE32DLL_TRUE@am__objects_5 = ../woe32dll/libgettextsrc_la-gettextsrc-exports.lo
+ am_libgettextsrc_la_OBJECTS = $(am__objects_1) \
+- libgettextsrc_la-read-catalog.lo libgettextsrc_la-color.lo \
+- libgettextsrc_la-write-catalog.lo \
+- libgettextsrc_la-write-properties.lo \
+- libgettextsrc_la-write-stringtable.lo \
+- libgettextsrc_la-write-po.lo libgettextsrc_la-msgl-ascii.lo \
++ libgettextsrc_la-read-catalog.lo $(am__objects_2) \
++ $(am__objects_3) libgettextsrc_la-msgl-ascii.lo \
+ libgettextsrc_la-msgl-iconv.lo libgettextsrc_la-msgl-equal.lo \
+ libgettextsrc_la-msgl-cat.lo libgettextsrc_la-msgl-header.lo \
+ libgettextsrc_la-msgl-english.lo \
+@@ -482,8 +493,8 @@
+ libgettextsrc_la-msgl-charset.lo libgettextsrc_la-po-time.lo \
+ libgettextsrc_la-plural-exp.lo libgettextsrc_la-plural-eval.lo \
+ libgettextsrc_la-plural-table.lo libgettextsrc_la-sentence.lo \
+- libgettextsrc_la-libexpat-compat.lo $(am__objects_2) \
+- libgettextsrc_la-read-desktop.lo $(am__objects_3)
++ libgettextsrc_la-libexpat-compat.lo $(am__objects_4) \
++ libgettextsrc_la-read-desktop.lo $(am__objects_5)
+ libgettextsrc_la_OBJECTS = $(am_libgettextsrc_la_OBJECTS)
+ PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+ am_cldr_plurals_OBJECTS = cldr_plurals-cldr-plural.$(OBJEXT) \
+@@ -1975,15 +1986,29 @@
+ @WOE32DLL_TRUE@ format-qt.c format-qt-plural.c format-kde.c \
+ @WOE32DLL_TRUE@ format-kde-kuit.c format-boost.c format-lua.c \
+ @WOE32DLL_TRUE@ format-javascript.c
++@WOE32DLL_FALSE@COLOR_SOURCE = color.c
++@WOE32DLL_TRUE@COLOR_SOURCE = ../woe32dll/c++color.cc
++@WOE32DLL_FALSE@OUTPUT_SOURCE = \
++@WOE32DLL_FALSE@ write-catalog.c \
++@WOE32DLL_FALSE@ write-properties.c \
++@WOE32DLL_FALSE@ write-stringtable.c \
++@WOE32DLL_FALSE@ write-po.c
++
++@WOE32DLL_TRUE@OUTPUT_SOURCE = \
++@WOE32DLL_TRUE@ ../woe32dll/c++write-catalog.cc \
++@WOE32DLL_TRUE@ ../woe32dll/c++write-properties.cc \
++@WOE32DLL_TRUE@ ../woe32dll/c++write-stringtable.cc \
++@WOE32DLL_TRUE@ ../woe32dll/c++write-po.cc
++
+
+ # libgettextsrc contains all code that is needed by at least two programs.
+-libgettextsrc_la_SOURCES = $(COMMON_SOURCE) read-catalog.c color.c \
+- write-catalog.c write-properties.c write-stringtable.c \
+- write-po.c msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c \
+- msgl-header.c msgl-english.c msgl-check.c file-list.c \
+- msgl-charset.c po-time.c plural-exp.c plural-eval.c \
+- plural-table.c quote.h sentence.h sentence.c libexpat-compat.c \
+- $(FORMAT_SOURCE) read-desktop.c $(am__append_1)
++libgettextsrc_la_SOURCES = $(COMMON_SOURCE) read-catalog.c \
++ $(COLOR_SOURCE) $(OUTPUT_SOURCE) msgl-ascii.c msgl-iconv.c \
++ msgl-equal.c msgl-cat.c msgl-header.c msgl-english.c \
++ msgl-check.c file-list.c msgl-charset.c po-time.c plural-exp.c \
++ plural-eval.c plural-table.c quote.h sentence.h sentence.c \
++ libexpat-compat.c $(FORMAT_SOURCE) read-desktop.c \
++ $(am__append_1)
+
+ # msggrep needs pattern matching.
+ LIBGREP = ../libgrep/libgrep.a
+@@ -2345,6 +2370,15 @@
+ ../woe32dll/$(am__dirstamp):
+ @$(MKDIR_P) ../woe32dll
+ @: > ../woe32dll/$(am__dirstamp)
++../woe32dll/libgettextsrc_la-c++color.lo: ../woe32dll/$(am__dirstamp)
++../woe32dll/libgettextsrc_la-c++write-catalog.lo: \
++ ../woe32dll/$(am__dirstamp)
++../woe32dll/libgettextsrc_la-c++write-properties.lo: \
++ ../woe32dll/$(am__dirstamp)
++../woe32dll/libgettextsrc_la-c++write-stringtable.lo: \
++ ../woe32dll/$(am__dirstamp)
++../woe32dll/libgettextsrc_la-c++write-po.lo: \
++ ../woe32dll/$(am__dirstamp)
+ ../woe32dll/libgettextsrc_la-c++format.lo: \
+ ../woe32dll/$(am__dirstamp)
+ ../woe32dll/libgettextsrc_la-gettextsrc-exports.lo: \
+@@ -3156,6 +3190,21 @@
+ .cc.lo:
+ $(AM_V_CXX)$(LTCXXCOMPILE) -c -o $@ $<
+
++../woe32dll/libgettextsrc_la-c++color.lo: ../woe32dll/c++color.cc
++ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgettextsrc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../woe32dll/libgettextsrc_la-c++color.lo `test -f '../woe32dll/c++color.cc' || echo '$(srcdir)/'`../woe32dll/c++color.cc
++
++../woe32dll/libgettextsrc_la-c++write-catalog.lo: ../woe32dll/c++write-catalog.cc
++ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgettextsrc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../woe32dll/libgettextsrc_la-c++write-catalog.lo `test -f '../woe32dll/c++write-catalog.cc' || echo '$(srcdir)/'`../woe32dll/c++write-catalog.cc
++
++../woe32dll/libgettextsrc_la-c++write-properties.lo: ../woe32dll/c++write-properties.cc
++ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgettextsrc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../woe32dll/libgettextsrc_la-c++write-properties.lo `test -f '../woe32dll/c++write-properties.cc' || echo '$(srcdir)/'`../woe32dll/c++write-properties.cc
++
++../woe32dll/libgettextsrc_la-c++write-stringtable.lo: ../woe32dll/c++write-stringtable.cc
++ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgettextsrc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../woe32dll/libgettextsrc_la-c++write-stringtable.lo `test -f '../woe32dll/c++write-stringtable.cc' || echo '$(srcdir)/'`../woe32dll/c++write-stringtable.cc
++
++../woe32dll/libgettextsrc_la-c++write-po.lo: ../woe32dll/c++write-po.cc
++ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgettextsrc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../woe32dll/libgettextsrc_la-c++write-po.lo `test -f '../woe32dll/c++write-po.cc' || echo '$(srcdir)/'`../woe32dll/c++write-po.cc
++
+ ../woe32dll/libgettextsrc_la-c++format.lo: ../woe32dll/c++format.cc
+ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgettextsrc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../woe32dll/libgettextsrc_la-c++format.lo `test -f '../woe32dll/c++format.cc' || echo '$(srcdir)/'`../woe32dll/c++format.cc
+
+diff -urN a/gettext-tools/src/color.c b/gettext-tools/src/color.c
+--- a/gettext-tools/src/color.c 2015-08-21 08:18:27.000000000 +0100
++++ b/gettext-tools/src/color.c 2015-10-22 00:31:33.326659600 +0100
+@@ -28,6 +28,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
++#include "ostream.h"
+ #include "term-ostream.h"
+ #include "xalloc.h"
+ #include "relocatable.h"
+diff -urN a/gettext-tools/woe32dll/c++color.cc b/gettext-tools/woe32dll/c++color.cc
+--- a/gettext-tools/woe32dll/c++color.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++color.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../src/color.c"
+diff -urN a/gettext-tools/woe32dll/c++file-ostream.cc b/gettext-tools/woe32dll/c++file-ostream.cc
+--- a/gettext-tools/woe32dll/c++file-ostream.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++file-ostream.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1,2 @@
++#include "../gnulib-lib/file-ostream.c"
++
+diff -urN a/gettext-tools/woe32dll/c++html-ostream.cc b/gettext-tools/woe32dll/c++html-ostream.cc
+--- a/gettext-tools/woe32dll/c++html-ostream.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++html-ostream.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../gnulib-lib/html-ostream.c"
+diff -urN a/gettext-tools/woe32dll/c++styled-ostream.cc b/gettext-tools/woe32dll/c++styled-ostream.cc
+--- a/gettext-tools/woe32dll/c++styled-ostream.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++styled-ostream.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../gnulib-lib/styled-ostream.c"
+diff -urN a/gettext-tools/woe32dll/c++term-ostream.cc b/gettext-tools/woe32dll/c++term-ostream.cc
+--- a/gettext-tools/woe32dll/c++term-ostream.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++term-ostream.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../gnulib-lib/term-ostream.c"
+diff -urN a/gettext-tools/woe32dll/c++write-catalog.cc b/gettext-tools/woe32dll/c++write-catalog.cc
+--- a/gettext-tools/woe32dll/c++write-catalog.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++write-catalog.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../src/write-catalog.c"
+diff -urN a/gettext-tools/woe32dll/c++write-po.cc b/gettext-tools/woe32dll/c++write-po.cc
+--- a/gettext-tools/woe32dll/c++write-po.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++write-po.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../src/write-po.c"
+diff -urN a/gettext-tools/woe32dll/c++write-properties.cc b/gettext-tools/woe32dll/c++write-properties.cc
+--- a/gettext-tools/woe32dll/c++write-properties.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++write-properties.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../src/write-properties.c"
+diff -urN a/gettext-tools/woe32dll/c++write-stringtable.cc b/gettext-tools/woe32dll/c++write-stringtable.cc
+--- a/gettext-tools/woe32dll/c++write-stringtable.cc 1970-01-01 01:00:00.000000000 +0100
++++ b/gettext-tools/woe32dll/c++write-stringtable.cc 2015-10-22 00:31:33.326659600 +0100
+@@ -0,0 +1 @@
++#include "../src/write-stringtable.c"
+diff -urN a/gnulib-local/modules/file-ostream b/gnulib-local/modules/file-ostream
+--- a/gnulib-local/modules/file-ostream 2015-08-21 06:48:27.000000000 +0100
++++ b/gnulib-local/modules/file-ostream 2015-10-22 00:31:33.326659600 +0100
+@@ -12,7 +12,11 @@
+ configure.ac:
+
+ Makefile.am:
++if !WOE32DLL
+ lib_SOURCES += file-ostream.c
++else
++lib_SOURCES += ../woe32dll/c++file-ostream.cc
++endif
+ # This is a Makefile rule that generates multiple files at once; see the
+ # automake documentation, node "Multiple Outputs", for details.
+ file-ostream.h : $(top_srcdir)/build-aux/moopp file-ostream.oo.h file-ostream.oo.c ostream.oo.h
+diff -urN a/gnulib-local/modules/html-ostream b/gnulib-local/modules/html-ostream
+--- a/gnulib-local/modules/html-ostream 2015-08-21 06:48:27.000000000 +0100
++++ b/gnulib-local/modules/html-ostream 2015-10-22 00:31:33.326659600 +0100
+@@ -15,7 +15,11 @@
+ configure.ac:
+
+ Makefile.am:
++if !WOE32DLL
+ lib_SOURCES += html-ostream.c
++else
++lib_SOURCES += ../woe32dll/c++html-ostream.cc
++endif
+ # This is a Makefile rule that generates multiple files at once; see the
+ # automake documentation, node "Multiple Outputs", for details.
+ html-ostream.h : $(top_srcdir)/build-aux/moopp html-ostream.oo.h html-ostream.oo.c ostream.oo.h
+diff -urN a/gnulib-local/modules/ostream b/gnulib-local/modules/ostream
+--- a/gnulib-local/modules/ostream 2015-08-21 06:48:27.000000000 +0100
++++ b/gnulib-local/modules/ostream 2015-10-22 00:31:33.342259600 +0100
+@@ -11,7 +11,11 @@
+ configure.ac:
+
+ Makefile.am:
++if !WOE32DLL
+ lib_SOURCES += ostream.c
++else
++lib_SOURCES += ../woe32dll/c++ostream.cc
++endif
+ # This is a Makefile rule that generates multiple files at once; see the
+ # automake documentation, node "Multiple Outputs", for details.
+ ostream.h : $(top_srcdir)/build-aux/moopp ostream.oo.h ostream.oo.c
+diff -urN a/gnulib-local/modules/styled-ostream b/gnulib-local/modules/styled-ostream
+--- a/gnulib-local/modules/styled-ostream 2015-08-21 06:48:27.000000000 +0100
++++ b/gnulib-local/modules/styled-ostream 2015-10-22 00:31:33.342259600 +0100
+@@ -11,7 +11,11 @@
+ configure.ac:
+
+ Makefile.am:
++if !WOE32DLL
+ lib_SOURCES += styled-ostream.c
++else
++lib_SOURCES += ../woe32dll/c++styled-ostream.cc
++endif
+ # This is a Makefile rule that generates multiple files at once; see the
+ # automake documentation, node "Multiple Outputs", for details.
+ styled-ostream.h : $(top_srcdir)/build-aux/moopp styled-ostream.oo.h styled-ostream.oo.c ostream.oo.h
+diff -urN a/gnulib-local/modules/term-ostream b/gnulib-local/modules/term-ostream
+--- a/gnulib-local/modules/term-ostream 2015-08-21 06:48:27.000000000 +0100
++++ b/gnulib-local/modules/term-ostream 2015-10-22 00:31:33.342259600 +0100
+@@ -22,7 +22,11 @@
+ gl_TERM_OSTREAM
+
+ Makefile.am:
++if !WOE32DLL
+ lib_SOURCES += term-ostream.c
++else
++lib_SOURCES += ../woe32dll/c++term-ostream.cc
++endif
+ # This is a Makefile rule that generates multiple files at once; see the
+ # automake documentation, node "Multiple Outputs", for details.
+ term-ostream.h : $(top_srcdir)/build-aux/moopp term-ostream.oo.h term-ostream.oo.c ostream.oo.h
diff --git a/patches/gettext/0.19.6/130-Fix-static-Cygwin-x86_64-build-environ-is-always-dllimport.patch b/patches/gettext/0.19.6/130-Fix-static-Cygwin-x86_64-build-environ-is-always-dllimport.patch
new file mode 100644
index 0000000..3487302
--- /dev/null
+++ b/patches/gettext/0.19.6/130-Fix-static-Cygwin-x86_64-build-environ-is-always-dllimport.patch
@@ -0,0 +1,72 @@
+diff -urN gettext-0.19.6.orig/gettext-tools/gnulib-lib/execute.c gettext-0.19.6/gettext-tools/gnulib-lib/execute.c
+--- gettext-0.19.6.orig/gettext-tools/gnulib-lib/execute.c 2015-10-24 16:54:39.310372500 +0100
++++ gettext-0.19.6/gettext-tools/gnulib-lib/execute.c 2015-10-24 16:55:35.261954100 +0100
+@@ -52,7 +52,7 @@
+ __cygwin_environ variable on cygwin64:
+ <https://cygwin.com/ml/cygwin/2013-06/msg00228.html>. */
+ #if defined __CYGWIN__ && defined __x86_64__
+-extern DLL_VARIABLE char **environ;
++extern __attribute__((dllimport)) char **environ;
+ #endif
+
+
+diff -urN gettext-0.19.6.orig/gettext-tools/gnulib-lib/spawn-pipe.c gettext-0.19.6/gettext-tools/gnulib-lib/spawn-pipe.c
+--- gettext-0.19.6.orig/gettext-tools/gnulib-lib/spawn-pipe.c 2015-09-11 04:03:56.000000000 +0100
++++ gettext-0.19.6/gettext-tools/gnulib-lib/spawn-pipe.c 2015-10-24 16:56:00.885918100 +0100
+@@ -52,7 +52,7 @@
+ __cygwin_environ variable on cygwin64:
+ <https://cygwin.com/ml/cygwin/2013-06/msg00228.html>. */
+ #if defined __CYGWIN__ && defined __x86_64__
+-extern DLL_VARIABLE char **environ;
++extern __attribute__((dllimport)) char **environ;
+ #endif
+
+
+diff -urN gettext-0.19.6.orig/gettext-tools/gnulib-tests/test-environ.c gettext-0.19.6/gettext-tools/gnulib-tests/test-environ.c
+--- gettext-0.19.6.orig/gettext-tools/gnulib-tests/test-environ.c 2015-09-11 04:03:58.000000000 +0100
++++ gettext-0.19.6/gettext-tools/gnulib-tests/test-environ.c 2015-10-24 16:56:51.519198900 +0100
+@@ -26,7 +26,7 @@
+ __cygwin_environ variable on cygwin64:
+ <https://cygwin.com/ml/cygwin/2013-06/msg00228.html>. */
+ #if defined __CYGWIN__ && defined __x86_64__
+-extern DLL_VARIABLE char **environ;
++extern __attribute__((dllimport)) char **environ;
+ #endif
+
+ int
+diff -urN gettext-0.19.6.orig/gnulib-local/lib/execute.c.diff gettext-0.19.6/gnulib-local/lib/execute.c.diff
+--- gettext-0.19.6.orig/gnulib-local/lib/execute.c.diff 2015-08-21 08:18:28.000000000 +0100
++++ gettext-0.19.6/gnulib-local/lib/execute.c.diff 2015-10-24 16:58:17.182285000 +0100
+@@ -10,7 +10,7 @@
+ + __cygwin_environ variable on cygwin64:
+ + <https://cygwin.com/ml/cygwin/2013-06/msg00228.html>. */
+ +#if defined __CYGWIN__ && defined __x86_64__
+-+extern DLL_VARIABLE char **environ;
+++extern __attribute__((dllimport)) char **environ;
+ +#endif
+ +
+
+diff -urN gettext-0.19.6.orig/gnulib-local/lib/spawn-pipe.c.diff gettext-0.19.6/gnulib-local/lib/spawn-pipe.c.diff
+--- gettext-0.19.6.orig/gnulib-local/lib/spawn-pipe.c.diff 2015-08-21 08:18:28.000000000 +0100
++++ gettext-0.19.6/gnulib-local/lib/spawn-pipe.c.diff 2015-10-24 16:58:11.741447300 +0100
+@@ -10,7 +10,7 @@
+ + __cygwin_environ variable on cygwin64:
+ + <https://cygwin.com/ml/cygwin/2013-06/msg00228.html>. */
+ +#if defined __CYGWIN__ && defined __x86_64__
+-+extern DLL_VARIABLE char **environ;
+++extern __attribute__((dllimport)) char **environ;
+ +#endif
+ +
+
+diff -urN gettext-0.19.6.orig/gnulib-local/tests/test-environ.c.diff gettext-0.19.6/gnulib-local/tests/test-environ.c.diff
+--- gettext-0.19.6.orig/gnulib-local/tests/test-environ.c.diff 2015-08-21 08:18:28.000000000 +0100
++++ gettext-0.19.6/gnulib-local/tests/test-environ.c.diff 2015-10-24 16:58:35.915765100 +0100
+@@ -10,7 +10,7 @@
+ + __cygwin_environ variable on cygwin64:
+ + <https://cygwin.com/ml/cygwin/2013-06/msg00228.html>. */
+ +#if defined __CYGWIN__ && defined __x86_64__
+-+extern DLL_VARIABLE char **environ;
+++extern __attribute__((dllimport)) char **environ;
+ +#endif
+ +
+ int
diff --git a/patches/glibc/2.22/110-Cygwin-doesnt-have-stat64.patch b/patches/glibc/2.22/110-Cygwin-doesnt-have-stat64.patch
new file mode 100644
index 0000000..9097628
--- /dev/null
+++ b/patches/glibc/2.22/110-Cygwin-doesnt-have-stat64.patch
@@ -0,0 +1,13 @@
+--- glibc-2.22/sunrpc/rpc_main.c.orig 2015-08-05 07:42:21.000000000 +0100
++++ glibc-2.22/sunrpc/rpc_main.c 2015-10-21 23:37:31.071268800 +0100
+@@ -51,6 +51,10 @@
+ #include "rpc_scan.h"
+ #include "proto.h"
+
++#if defined(__CYGWIN__)
++#define stat64 stat
++#endif
++
+ #include "../version.h"
+ #define PACKAGE _libc_intl_domainname
+
diff --git a/patches/libiconv/1.14/100-srclib_stdio.in.h-remove-gets-declarations.patch b/patches/libiconv/1.14/100-srclib_stdio.in.h-remove-gets-declarations.patch
new file mode 100644
index 0000000..382c841
--- /dev/null
+++ b/patches/libiconv/1.14/100-srclib_stdio.in.h-remove-gets-declarations.patch
@@ -0,0 +1,30 @@
+diff -r -u libiconv-1.14/srclib/stdio.in.h.orig libiconv-1.14/srclib/stdio.in.h
+--- libiconv-1.14/srclib/stdio.in.h.orig 2013-02-22 13:52:46.336327969 -0600
++++ libiconv-1.14/srclib/stdio.in.h 2013-02-22 13:54:27.948207059 -0600
+@@ -679,22 +679,11 @@
+ # endif
+ #endif
+
+-#if @GNULIB_GETS@
+-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+-# undef gets
+-# define gets rpl_gets
+-# endif
+-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
+-_GL_CXXALIAS_RPL (gets, char *, (char *s));
+-# else
+-_GL_CXXALIAS_SYS (gets, char *, (char *s));
+-# undef gets
+-# endif
+-_GL_CXXALIASWARN (gets);
+ /* It is very rare that the developer ever has full control of stdin,
+- so any use of gets warrants an unconditional warning. Assume it is
+- always declared, since it is required by C89. */
++ so any use of gets warrants an unconditional warning; besides, C11
++ removed it. */
++#undef gets
++#if HAVE_RAW_DECL_GETS
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ #endif
+
diff --git a/patches/libtool/2.4.6/2.4.5-pass-ldflags.patch b/patches/libtool/2.4.6/2.4.5-pass-ldflags.patch
new file mode 100755
index 0000000..d35e343
--- /dev/null
+++ b/patches/libtool/2.4.6/2.4.5-pass-ldflags.patch
@@ -0,0 +1,12 @@
+--- libtool-2.4.5.orig/build-aux/ltmain.in 2015-01-16 12:52:04.000000000 -0600
++++ libtool-2.4.5/build-aux/ltmain.in 2015-02-07 22:45:14.421079200 -0600
+@@ -5356,7 +5356,8 @@ func_mode_link ()
+ # -stdlib=* select c++ std lib with clang
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
++ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
++ -shared-libgcc|-static-libgcc|-static-libgfortran|-static-libstdc++)
+ func_quote_for_eval "$arg"
+ arg=$func_quote_for_eval_result
+ func_append compile_command " $arg"
diff --git a/patches/linux/4.2.3/100-Define-R_X86_64_JUMP_SLOT-for-Cygwin.patch b/patches/linux/4.2.3/100-Define-R_X86_64_JUMP_SLOT-for-Cygwin.patch
new file mode 100755
index 0000000..7b6ee5a
--- /dev/null
+++ b/patches/linux/4.2.3/100-Define-R_X86_64_JUMP_SLOT-for-Cygwin.patch
@@ -0,0 +1,16 @@
+--- linux-4.2/arch/x86/tools/relocs.c.orig 2015-10-20 22:36:03.075546600 +0100
++++ linux-4.2/arch/x86/tools/relocs.c 2015-10-20 22:36:04.934950000 +0100
+@@ -187,6 +187,13 @@
+ return name;
+ }
+
++/* Hack for Cygwin */
++#if ELF_BITS == 64
++#if !defined(R_X86_64_JUMP_SLOT) && defined(R_X86_64_JMP_SLOT)
++#define R_X86_64_JUMP_SLOT R_X86_64_JMP_SLOT
++#endif
++#endif
++
+ static const char *rel_type(unsigned type)
+ {
+ static const char *type_name[] = {
diff --git a/samples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/crosstool.config b/samples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/crosstool.config
new file mode 100755
index 0000000..373ec83
--- /dev/null
+++ b/samples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/crosstool.config
@@ -0,0 +1,28 @@
+CT_EXPERIMENTAL=y
+CT_DEBUG_CT=y
+CT_DEBUG_CT_SAVE_STEPS=y
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+# CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES is not set
+CT_LOG_EXTRA=y
+CT_ARCH_64=y
+CT_ARCH_x86=y
+CT_TARGET_VENDOR="pc"
+CT_CANADIAN=y
+CT_HOST="x86_64-w64-mingw32"
+CT_KERNEL_linux=y
+CT_BINUTILS_LINKER_LD_GOLD=y
+CT_BINUTILS_GOLD_THREADS=y
+CT_BINUTILS_LD_WRAPPER=y
+CT_BINUTILS_FOR_TARGET=y
+CT_CC_LANG_CXX=y
+CT_DEBUG_ltrace=y
+CT_LTRACE_V_0_5_3=y
+CT_DEBUG_strace=y
+CT_STRACE_V_4_5_19=y
+CT_GMP_V_5_1_3=y
+CT_MPFR_V_3_1_2=y
+CT_MPC_V_0_9=y
+CT_COMP_TOOLS=y
+CT_COMP_TOOLS_make=y
+CT_COMP_TOOLS_libtool=y
diff --git a/samples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/reported.by b/samples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/reported.by
new file mode 100644
index 0000000..aa52a3a
--- /dev/null
+++ b/samples/x86_64-w64-mingw32,x86_64-pc-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Ray Donnelly"
+reporter_url="https://github.com/crosstool-ng/crosstool-ng"
+reporter_comment="Tested as Canadian Cross with build of GNU/Linux-x86_64 and Cygwin-x86_64"
diff --git a/scripts/build/companion_libs/320-libiconv.sh b/scripts/build/companion_libs/320-libiconv.sh
new file mode 100755
index 0000000..e8417e9
--- /dev/null
+++ b/scripts/build/companion_libs/320-libiconv.sh
@@ -0,0 +1,113 @@
+# Build script for libiconv
+
+do_libiconv_get() { :; }
+do_libiconv_extract() { :; }
+do_libiconv_for_build() { :; }
+do_libiconv_for_host() { :; }
+
+if [ "${CT_LIBICONV}" = "y" ]; then
+
+do_libiconv_get() {
+ CT_GetFile "libiconv-${CT_LIBICONV_VERSION}" \
+ http://ftp.gnu.org/pub/gnu/libiconv/
+}
+
+do_libiconv_extract() {
+ CT_Extract "libiconv-${CT_LIBICONV_VERSION}"
+ CT_Patch "libiconv" "${CT_LIBICONV_VERSION}"
+}
+
+# Build libiconv for running on build
+do_libiconv_for_build() {
+ local -a libiconv_opts
+
+ case "$CT_BUILD" in
+ *darwin*|*linux*)
+ return 0
+ ;;
+ esac
+
+ CT_DoStep INFO "Installing libiconv for build"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-libiconv-build-${CT_BUILD}"
+
+ libiconv_opts+=( "host=${CT_BUILD}" )
+ libiconv_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+ libiconv_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+ libiconv_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
+ libiconv_opts+=( "static_build=y" )
+ do_libiconv_backend "${libiconv_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build libiconv for running on host
+do_libiconv_for_host() {
+ local -a libiconv_opts
+
+ case "$CT_HOST" in
+ *darwin*|*linux*)
+ return 0
+ ;;
+ esac
+
+ CT_DoStep INFO "Installing libiconv for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-libiconv-host-${CT_HOST}"
+
+ libiconv_opts+=( "host=${CT_HOST}" )
+ libiconv_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+ libiconv_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ libiconv_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
+ libiconv_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
+ do_libiconv_backend "${libiconv_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build libiconv
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# static_build : build statically : bool : no
+# cflags : host cflags to use : string : (empty)
+# ldflags : host ldflags to use : string : (empty)
+do_libiconv_backend() {
+ local host
+ local prefix
+ local static_build
+ local cflags
+ local ldflags
+ local arg
+ local -a extra_config
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoLog EXTRA "Configuring libiconv"
+
+ CT_DoExecLog ALL cp -aT "${CT_SRC_DIR}/libiconv-${CT_LIBICONV_VERSION}" "."
+
+ if [ "${static_build}" = "y" ]; then
+ extra_config+=("--disable-shared")
+ extra_config+=("--enable-static")
+ fi
+
+ CT_DoExecLog CFG \
+ CFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}" \
+ "${CT_SRC_DIR}/libiconv-${CT_LIBICONV_VERSION}/configure" \
+ --build=${CT_BUILD} \
+ --host="${host}" \
+ --prefix="${prefix}" \
+ "${extra_config[@]}" \
+
+ CT_DoLog EXTRA "Building libiconv"
+ CT_DoExecLog ALL make CC="${host}-gcc ${cflags}" ${JOBSFLAGS}
+
+ CT_DoLog EXTRA "Installing libiconv"
+ CT_DoExecLog ALL make install CC="${host}-gcc ${cflags}"
+}
+
+fi
diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh
new file mode 100755
index 0000000..5a3f461
--- /dev/null
+++ b/scripts/build/companion_libs/330-gettext.sh
@@ -0,0 +1,136 @@
+# Build script for gettext
+
+do_gettext_get() { :; }
+do_gettext_extract() { :; }
+do_gettext_for_build() { :; }
+do_gettext_for_host() { :; }
+
+if [ "${CT_GETTEXT}" = "y" ]; then
+
+do_gettext_get() {
+ CT_GetFile "gettext-${CT_GETTEXT_VERSION}" \
+ http://ftp.gnu.org/pub/gnu/gettext/
+}
+
+do_gettext_extract() {
+ CT_Extract "gettext-${CT_GETTEXT_VERSION}"
+ CT_Patch "gettext" "${CT_GETTEXT_VERSION}"
+}
+
+# Build gettext for running on build
+do_gettext_for_build() {
+ local -a gettext_opts
+
+ case "$CT_BUILD" in
+ *linux*)
+ return 0
+ ;;
+ esac
+
+ CT_DoStep INFO "Installing gettext for build"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gettext-build-${CT_BUILD}"
+
+ gettext_opts+=( "host=${CT_BUILD}" )
+ gettext_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+ gettext_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
+ gettext_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
+ gettext_opts+=( "static_build=y" )
+ do_gettext_backend "${gettext_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build gettext for running on host
+do_gettext_for_host() {
+ local -a gettext_opts
+
+ case "$CT_HOST" in
+ *linux*)
+ return 0
+ ;;
+ esac
+
+ CT_DoStep INFO "Installing gettext for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gettext-host-${CT_HOST}"
+
+ gettext_opts+=( "host=${CT_HOST}" )
+ gettext_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+ gettext_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+ gettext_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
+ gettext_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
+ do_gettext_backend "${gettext_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+# Build gettext
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# static_build : build statically : bool : no
+# cflags : host cflags to use : string : (empty)
+# ldflags : host ldflags to use : string : (empty)
+do_gettext_backend() {
+ local host
+ local prefix
+ local static_build
+ local cflags
+ local ldflags
+ local arg
+ local -a extra_config
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoLog EXTRA "Configuring gettext"
+
+ CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/gettext-${CT_GETTEXT_VERSION}/"/* .
+
+ # A bit ugly. D__USE_MINGW_ANSI_STDIO=1 has its own {v}asprintf functions
+ # but gettext configure doesn't see this flag when it checks for that. An
+ # alternative may be to use CC="${host}-gcc ${cflags}" but that didn't
+ # work.
+ # -O2 works around bug at http://savannah.gnu.org/bugs/?36443
+ # gettext needs some fixing for MinGW-w64 it would seem.
+ case "${host}" in
+ *mingw*)
+ case "${cflags}" in
+ *D__USE_MINGW_ANSI_STDIO=1*)
+ extra_config+=( --disable-libasprintf )
+ ;;
+ esac
+ extra_config+=( --enable-threads=win32 )
+ cflags=$cflags" -O2"
+ ;;
+ esac
+
+ if [ "${static_build}" = "y" ]; then
+ extra_config+=("--disable-shared")
+ extra_config+=("--enable-static")
+ fi
+
+ CT_DoExecLog CFG \
+ CFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}" \
+ "${CT_SRC_DIR}/gettext-${CT_GETTEXT_VERSION}/configure" \
+ --build=${CT_BUILD} \
+ --host="${host}" \
+ --prefix="${prefix}" \
+ --disable-java \
+ --disable-native-java \
+ --disable-csharp \
+ --without-emacs \
+ --disable-openmp \
+ "${extra_config[@]}"
+
+ CT_DoLog EXTRA "Building gettext"
+ CT_DoExecLog ALL make ${JOBSFLAGS}
+
+ CT_DoLog EXTRA "Installing gettext"
+ CT_DoExecLog ALL make install
+}
+
+fi
diff --git a/scripts/build/companion_tools/400-libtool.sh b/scripts/build/companion_tools/400-libtool.sh
index 9ddf00f..43d1f05 100644..100755
--- a/scripts/build/companion_tools/400-libtool.sh
+++ b/scripts/build/companion_tools/400-libtool.sh
@@ -1,6 +1,6 @@
# Build script for libtool
-CT_LIBTOOL_VERSION=2.2.6b
+CT_LIBTOOL_VERSION=2.4.6
do_companion_tools_libtool_get() {
CT_GetFile "libtool-${CT_LIBTOOL_VERSION}" \
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 6a84017..cfdacf0 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -377,6 +377,20 @@ do_libc_backend_once() {
CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}"
extra_make_args+=( "BUILD_CFLAGS=${CT_CFLAGS_FOR_BUILD}" "BUILD_LDFLAGS=${CT_LDFLAGS_FOR_BUILD}" )
+ case "$CT_BUILD" in
+ *mingw*|*cygwin*|*msys*)
+ # When installing headers on Cygwin, MSYS2 and MinGW-w64 sunrpc needs
+ # gettext for building cross-rpcgen.
+ extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" )
+ extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -Wl,-Bstatic -lintl -liconv -Wl,-Bdynamic" )
+ ;;
+ *darwin*)
+ # .. and the same goes for Darwin.
+ extra_make_args+=( BUILD_CPPFLAGS="-I${CT_BUILDTOOLS_PREFIX_DIR}/include/" )
+ extra_make_args+=( BUILD_LDFLAGS="-L${CT_BUILDTOOLS_PREFIX_DIR}/lib -lintl" )
+ ;;
+ esac
+
if [ "${libc_headers}" = "y" ]; then
CT_DoLog EXTRA "Installing C library headers"