2016-05-25  Stefan Liebler  <stli@linux.vnet.ibm.com>

	* iconvdata/Makefile ($(inst_gconvdir)/gconv-modules):
	Install file from $(objpfx)gconv-modules.
	($(objpfx)gconv-modules): Concatenate architecture specific file
	in variable sysdeps-gconv-modules and gconv-modules in src dir.
	* sysdeps/s390/gconv-modules: New file.
	* sysdeps/s390/s390-64/Makefile: ($(inst_gconvdir)/gconv-modules):
	Deleted.
	($(objpfx)gconv-modules-s390): Deleted.
	(sysdeps-gconv-modules): New variable.

Index: glibc-2.22/iconvdata/Makefile
===================================================================
--- glibc-2.22.orig/iconvdata/Makefile
+++ glibc-2.22/iconvdata/Makefile
@@ -244,7 +244,7 @@ headers: $(addprefix $(objpfx), $(genera
 $(addprefix $(inst_gconvdir)/, $(modules.so)): \
     $(inst_gconvdir)/%: $(objpfx)% $(+force)
 	$(do-install-program)
-$(inst_gconvdir)/gconv-modules: gconv-modules $(+force)
+$(inst_gconvdir)/gconv-modules: $(objpfx)gconv-modules $(+force)
 	$(do-install)
 ifeq (no,$(cross-compiling))
 # Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary
@@ -323,7 +323,5 @@ do-tests-clean common-mostlyclean: tst-t
 tst-tables-clean:
 	-rm -f $(objpfx)tst-*.table $(objpfx)tst-EUC-TW.irreversible
 
-ifdef objpfx
 $(objpfx)gconv-modules: gconv-modules
-	cp $^ $@
-endif
+	cat $(sysdeps-gconv-modules) $^ > $@
Index: glibc-2.22/sysdeps/s390/gconv-modules
===================================================================
--- /dev/null
+++ glibc-2.22/sysdeps/s390/gconv-modules
@@ -0,0 +1,50 @@
+# GNU libc iconv configuration.
+# Copyright (C) 1997-2016 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+# All lines contain the following information:
+
+# If the lines start with `module'
+#  fromset:	either a name triple or a regular expression triple.
+#  toset:	a name triple or an expression with \N to get regular
+#		expression matching results.
+#  filename:	filename of the module implementing the transformation.
+#		If it is not absolute the path is made absolute by prepending
+#		the directory the configuration file is found in.
+#  cost:	optional cost of the transformation.  Default is 1.
+
+# If the lines start with `alias'
+#  alias:	alias name which is not really recognized.
+#  name:	the real name of the character set
+
+# S/390 hardware accelerated modules
+#	from			to			module			cost
+module	ISO-8859-1//		IBM037//		ISO-8859-1_CP037_Z900	1
+module	IBM037//		ISO-8859-1//		ISO-8859-1_CP037_Z900	1
+module	ISO-10646/UTF8/		UTF-32//		UTF8_UTF32_Z9		1
+module	UTF-32BE//		ISO-10646/UTF8/		UTF8_UTF32_Z9		1
+module	ISO-10646/UTF8/		UTF-32BE//		UTF8_UTF32_Z9		1
+module	UTF-16BE//		UTF-32//		UTF16_UTF32_Z9		1
+module	UTF-32BE//		UTF-16//		UTF16_UTF32_Z9		1
+module	INTERNAL		UTF-16//		UTF16_UTF32_Z9		1
+module	UTF-32BE//		UTF-16BE//		UTF16_UTF32_Z9		1
+module	INTERNAL		UTF-16BE//		UTF16_UTF32_Z9		1
+module	UTF-16BE//		UTF-32BE//		UTF16_UTF32_Z9		1
+module	UTF-16BE//		INTERNAL		UTF16_UTF32_Z9		1
+module	UTF-16BE//		ISO-10646/UTF8/		UTF8_UTF16_Z9		1
+module	ISO-10646/UTF8/		UTF-16//		UTF8_UTF16_Z9		1
+module	ISO-10646/UTF8/		UTF-16BE//		UTF8_UTF16_Z9		1
Index: glibc-2.22/sysdeps/s390/s390-64/Makefile
===================================================================
--- glibc-2.22.orig/sysdeps/s390/s390-64/Makefile
+++ glibc-2.22/sysdeps/s390/s390-64/Makefile
@@ -39,54 +39,5 @@ $(patsubst %, $(inst_gconvdir)/%.so, $(s
 $(inst_gconvdir)/%.so: $(objpfx)%.so $(+force)
 	$(do-install-program)
 
-$(objpfx)gconv-modules-s390: gconv-modules $(+force)
-	cp $< $@
-	echo >> $@
-	echo "# S/390 hardware accelerated modules" >> $@
-	echo -n "module	ISO-8859-1//		IBM037//	" >> $@
-	echo "	ISO-8859-1_CP037_Z900	1" >> $@
-	echo -n "module	IBM037//		ISO-8859-1//	" >> $@
-	echo "	ISO-8859-1_CP037_Z900	1" >> $@
-	echo -n "module	ISO-10646/UTF8/		UTF-32//	" >> $@
-	echo "	UTF8_UTF32_Z9		1" >> $@
-	echo -n "module	UTF-32BE//		ISO-10646/UTF8/	" >> $@
-	echo "	UTF8_UTF32_Z9		1" >> $@
-	echo -n "module	ISO-10646/UTF8/		UTF-32BE//	" >> $@
-	echo "	UTF8_UTF32_Z9		1" >> $@
-	echo -n "module	UTF-16BE//		UTF-32//	" >> $@
-	echo "	UTF16_UTF32_Z9		1" >> $@
-	echo -n "module	UTF-32BE//		UTF-16//	" >> $@
-	echo "	UTF16_UTF32_Z9		1" >> $@
-	echo -n "module	INTERNAL		UTF-16//	" >> $@
-	echo "	UTF16_UTF32_Z9		1" >> $@
-	echo -n "module	UTF-32BE//		UTF-16BE//	" >> $@
-	echo "	UTF16_UTF32_Z9		1" >> $@
-	echo -n "module	INTERNAL		UTF-16BE//	" >> $@
-	echo "	UTF16_UTF32_Z9		1" >> $@
-	echo -n "module	UTF-16BE//		UTF-32BE//	" >> $@
-	echo "	UTF16_UTF32_Z9		1" >> $@
-	echo -n "module	UTF-16BE//		INTERNAL	" >> $@
-	echo "	UTF16_UTF32_Z9		1" >> $@
-	echo -n "module	UTF-16BE//		ISO-10646/UTF8/	" >> $@
-	echo "	UTF8_UTF16_Z9		1" >> $@
-	echo -n "module	ISO-10646/UTF8/		UTF-16//	" >> $@
-	echo "	UTF8_UTF16_Z9		1" >> $@
-	echo -n "module	ISO-10646/UTF8/		UTF-16BE//	" >> $@
-	echo "	UTF8_UTF16_Z9		1" >> $@
-
-$(inst_gconvdir)/gconv-modules: $(objpfx)gconv-modules-s390 $(+force)
-	$(do-install)
-ifeq (no,$(cross-compiling))
-# Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary
-# if this libc has more gconv modules than the previously installed one.
-	if test -f "$(inst_gconvdir)/gconv-modules.cache"; then \
-	   LC_ALL=C \
-	   $(rtld-prefix) \
-	   $(common-objpfx)iconv/iconvconfig \
-	     $(addprefix --prefix=,$(install_root)); \
-	fi
-else
-	@echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
-endif
-
+sysdeps-gconv-modules = ../sysdeps/s390/gconv-modules
 endif
