Browse Source

update glibc

Waldemar Brodkorb 12 years ago
parent
commit
62eda65923

+ 19 - 18
package/glibc/Makefile

@@ -9,6 +9,7 @@ TARGET_CFLAGS:=	$(filter-out -flto,$(TARGET_CFLAGS))
 include $(TOPDIR)/toolchain/glibc/Makefile.inc
 
 PKG_DESCR:=		GNU C library
+PKG_VER:=		2.16
 PKG_SECTION:=		base
 PKG_OPTS:=		noremove
 PKG_SUBPKGS:=		GLIBC GLIBC_DEV
@@ -30,22 +31,22 @@ INSTALL_STYLE:=		manual
 # compile nothing, glibc is already build in toolchain directory
 do-install:
 	${INSTALL_DIR} $(IDIR_GLIBC)/lib $(IDIR_GLIBC)/etc
-	cd ${STAGING_TARGET_DIR} && for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
-		test -s usr/share/zoneinfo/"$$f" || continue; \
-		echo usr/share/zoneinfo/"$$f" | \
-		    ${TOOLS_DIR}/cpio -pdu ${IDIR_GLIBC}/; \
-	done
-	tz=; cd ${IDIR_GLIBC}/usr/share/zoneinfo || exit 1; \
-	    for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
-		test -s "$$f" || continue; \
-		tz=$$f; \
-	done; if test x"$$tz" = x""; then \
-		echo >&2 Error during timezone installation; \
-		exit 1; \
-	else \
-		ln -sf "../usr/share/zoneinfo/$$tz" \
-		    ${IDIR_GLIBC}/etc/localtime; \
-	fi
+	#cd ${STAGING_TARGET_DIR} && for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
+	#	test -s usr/share/zoneinfo/"$$f" || continue; \
+	#	echo usr/share/zoneinfo/"$$f" | \
+	#	    ${TOOLS_DIR}/cpio -pdu ${IDIR_GLIBC}/; \
+	#done
+	#tz=; cd ${IDIR_GLIBC}/usr/share/zoneinfo || exit 1; \
+	#    for f in UTC ${ADK_RUNTIME_TIMEZONE}; do \
+	#	test -s "$$f" || continue; \
+	#	tz=$$f; \
+	#done; if test x"$$tz" = x""; then \
+	#	echo >&2 Error during timezone installation; \
+	#	exit 1; \
+	#else \
+	#	ln -sf "../usr/share/zoneinfo/$$tz" \
+	#	    ${IDIR_GLIBC}/etc/localtime; \
+	#fi
 	${CP} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_GLIBC}/etc
 	${CP} ${STAGING_TARGET_DIR}/etc/nscd.conf ${IDIR_GLIBC}/etc
 	${CP} ${STAGING_TARGET_DIR}/etc/nsswitch.conf ${IDIR_GLIBC}/etc
@@ -55,7 +56,7 @@ endif
 	$(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/lib
 	for file in libc libcrypt libdl libm libnsl libresolv librt libutil libnss_compat libnss_dns libnss_files; do \
 		$(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/lib; \
-		$(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/lib; \
+		$(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VER).so $(IDIR_GLIBC)/lib; \
 	done
 
 glibc-dev-install:
@@ -66,7 +67,7 @@ glibc-dev-install:
 	${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_GLIBC_DEV}/usr/lib
 	${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
 	-for file in libcrypt libdl libm libresolv librt libutil; do \
-		cd $(IDIR_GLIBC_DEV)/lib; ln -sf $$file-$(PKG_VERSION).so $$file.so; \
+		cd $(IDIR_GLIBC_DEV)/lib; ln -sf $$file-$(PKG_VER).so $$file.so; \
 	done
 	# header package
 	$(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \

+ 1 - 0
toolchain/gcc/Makefile

@@ -101,6 +101,7 @@ $(GCC_BUILD_DIR_MINIMAL)/.configured:
 	ln -sf ${STAGING_TARGET_DIR}/include $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
 	rm -rf ${STAGING_HOST_DIR}/$(REAL_GNU_TARGET_NAME)/lib
 	ln -sf ${STAGING_TARGET_DIR}/lib $(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/lib
+	sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' $(WRKBUILD)/gcc/configure
 	cd $(GCC_BUILD_DIR_MINIMAL); PATH='$(TARGET_PATH)' \
 		$(WRKBUILD)/configure \
 			${GCC_CONFOPTS} \

+ 15 - 0
toolchain/gcc/patches/4.6.3/siginfo.patch

@@ -0,0 +1,15 @@
+diff -Nur gcc-4.6.3.orig/gcc/config/i386/linux-unwind.h gcc-4.6.3/gcc/config/i386/linux-unwind.h
+--- gcc-4.6.3.orig/gcc/config/i386/linux-unwind.h	2011-01-03 21:52:22.000000000 +0100
++++ gcc-4.6.3/gcc/config/i386/linux-unwind.h	2012-08-02 11:47:11.000000000 +0200
+@@ -133,9 +133,9 @@
+     {
+       struct rt_sigframe {
+ 	int sig;
+-	struct siginfo *pinfo;
++	siginfo_t *pinfo;
+ 	void *puc;
+-	struct siginfo info;
++	siginfo_t info;
+ 	struct ucontext uc;
+       } *rt_ = context->cfa;
+       /* The void * cast is necessary to avoid an aliasing warning.

+ 1 - 1
toolchain/glibc/Makefile

@@ -23,7 +23,7 @@ endif
 
 GLIBC_MAKEOPTS+=	cross-compiling=yes
 ifeq (${ADK_MAKE_PARALLEL},y)
-GLIBC_MAKEOPTS+=	PARALLELMFLAGS="-j${ADK_MAKE_JOBS}"
+GLIBC_MAKEOPTS+=	PARALLELMFLAGS="-j1"
 endif
 
 GLIBC_BUILD_DIR_INITIAL:=	${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers

+ 2 - 2
toolchain/glibc/Makefile.inc

@@ -2,9 +2,9 @@
 # material, please see the LICENCE file in the top-level directory.
 
 PKG_NAME:=		glibc
-PKG_VERSION:=		2.14.1
+PKG_VERSION:=		2.16.0
 PKG_RELEASE:=		1
-PKG_MD5SUM:=		f3841fd7812db4713115ff4447b29207
+PKG_MD5SUM:=		b5f786fa7df4ff947bcd240c0e595f98
 PKG_SITES:=		${MASTER_SITE_GNU:=glibc/}
 GLIBC_CONFOPTS:=	--build=$(GNU_HOST_NAME) \
 			--host=$(REAL_GNU_TARGET_NAME) \

+ 8 - 11
toolchain/glibc/patches/gcc_eh.patch

@@ -1,18 +1,15 @@
-diff -Nur glibc-2.10.1.orig/Makeconfig glibc-2.10.1/Makeconfig
---- glibc-2.10.1.orig/Makeconfig	2009-08-20 08:51:54.000000000 +0200
-+++ glibc-2.10.1/Makeconfig	2009-08-21 01:53:59.000000000 +0200
-@@ -525,12 +525,12 @@
-   libunwind = -lunwind
- endif
- ifneq ($(have-as-needed),yes)
-- libgcc_eh := -lgcc_eh $(libunwind)
-+ libgcc_eh := $(libunwind)
+diff -Nur glibc-2.16.0.orig/Makeconfig glibc-2.16.0/Makeconfig
+--- glibc-2.16.0.orig/Makeconfig	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/Makeconfig	2012-08-02 10:18:56.000000000 +0200
+@@ -521,9 +521,9 @@
  else
-  libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
+   libunwind = -lunwind
  endif
+-libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
++libgcc_eh := -Wl,--as-needed $(libunwind) -Wl,--no-as-needed
  gnulib := -lgcc $(libgcc_eh)
 -static-gnulib := -lgcc -lgcc_eh $(libunwind)
 +static-gnulib := -lgcc $(libunwind)
  libc.so-gnulib := -lgcc
  endif
- ifeq ($(elf),yes)
+ +preinit = $(addprefix $(csu-objpfx),crti.o)

+ 0 - 14
toolchain/glibc/patches/getpagesize.patch

@@ -1,14 +0,0 @@
-	This patch is needed at least on kirkwood. Otherwise DNS-lookups will fail, since
-	GLRO(dl_pagesize) is zero. Solution taken from this resource:
-	http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg228455.html
---- glibc-2.12.1/sysdeps/unix/sysv/linux/getpagesize.c.orig	2011-02-28 03:41:47.870001678 +0100
-+++ glibc-2.12.1/sysdeps/unix/sysv/linux/getpagesize.c	2011-02-28 03:42:16.712993932 +0100
-@@ -28,7 +28,7 @@
- int
- __getpagesize ()
- {
--#ifdef __ASSUME_AT_PAGESIZE
-+#if 0
-   assert (GLRO(dl_pagesize) != 0);
-   return GLRO(dl_pagesize);
- #else

+ 99 - 0
toolchain/glibc/patches/glibc-cross.patch

@@ -0,0 +1,99 @@
+diff -Nur glibc-2.16.0.orig/sunrpc/rpc/types.h glibc-2.16.0/sunrpc/rpc/types.h
+--- glibc-2.16.0.orig/sunrpc/rpc/types.h	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/rpc/types.h	2012-08-01 18:05:49.000000000 +0200
+@@ -69,19 +69,25 @@
+ #include <sys/types.h>
+ #endif
+ 
+-#ifndef __u_char_defined
+-typedef __u_char u_char;
+-typedef __u_short u_short;
+-typedef __u_int u_int;
+-typedef __u_long u_long;
+-typedef __quad_t quad_t;
+-typedef __u_quad_t u_quad_t;
+-typedef __fsid_t fsid_t;
+-# define __u_char_defined
++typedef unsigned char u_char;
++typedef unsigned short u_short;
++typedef unsigned int u_int;
++typedef unsigned long u_long;
++#if __WORDSIZE == 64
++typedef long int quad_t;
++typedef unsigned long int u_quad_t;
++#elif defined __GLIBC_HAVE_LONG_LONG
++typedef long long int quad_t;
++typedef unsigned long long int u_quad_t;
++#endif
++#if defined(_CROSS_RPCGEN_)
++typedef u_quad_t fsid_t;
+ #endif
+-#ifndef __daddr_t_defined
+-typedef __daddr_t daddr_t;
+-typedef __caddr_t caddr_t;
++
++# define __u_char_defined
++#if !defined(__daddr_t_defined) && defined(linux)
++typedef long int daddr_t;
++typedef char *caddr_t;
+ # define __daddr_t_defined
+ #endif
+ 
+diff -Nur glibc-2.16.0.orig/sunrpc/rpc_clntout.c glibc-2.16.0/sunrpc/rpc_clntout.c
+--- glibc-2.16.0.orig/sunrpc/rpc_clntout.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/rpc_clntout.c	2012-08-01 18:05:49.000000000 +0200
+@@ -31,7 +31,7 @@
+  */
+ #include <stdio.h>
+ #include <string.h>
+-#include <rpc/types.h>
++#include "rpc/types.h"
+ #include "rpc_parse.h"
+ #include "rpc_util.h"
+ #include "proto.h"
+diff -Nur glibc-2.16.0.orig/sunrpc/rpc_main.c glibc-2.16.0/sunrpc/rpc_main.c
+--- glibc-2.16.0.orig/sunrpc/rpc_main.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/rpc_main.c	2012-08-01 18:05:49.000000000 +0200
+@@ -38,7 +38,11 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
++#ifdef _CROSS_RPCGEN_
++#define gettext(X) (X)
++#else
+ #include <libintl.h>
++#endif
+ #include <ctype.h>
+ #include <sys/types.h>
+ #include <sys/param.h>
+@@ -958,10 +962,12 @@
+ 	abort ();
+       temp = rindex (cmd->infile, '.');
+       cp = stpcpy (mkfilename, "Makefile.");
+-      if (temp != NULL)
+-	*((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
+-      else
++      if (temp != NULL) {
++	strncpy (cp, cmd->infile, temp - cmd->infile);
++	cp[temp - cmd->infile - 1] = '\0';
++      } else {
+ 	stpcpy (cp, cmd->infile);
++      }
+ 
+     }
+   else
+diff -Nur glibc-2.16.0.orig/sunrpc/rpc_scan.c glibc-2.16.0/sunrpc/rpc_scan.c
+--- glibc-2.16.0.orig/sunrpc/rpc_scan.c	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sunrpc/rpc_scan.c	2012-08-01 18:05:49.000000000 +0200
+@@ -37,7 +37,11 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <string.h>
++#ifdef _CROSS_RPCGEN_
++#define gettext(X) (X)
++#else
+ #include <libintl.h>
++#endif
+ #include "rpc_scan.h"
+ #include "rpc_parse.h"
+ #include "rpc_util.h"

+ 4 - 19
toolchain/glibc/patches/i686_define_bug.patch

@@ -7,25 +7,10 @@
 	http://bugs.gentoo.org/show_bug.cgi?id=201815. There are lots of duplicates to it, many people are
 	affected, one can find really elaborate reports. And the responsible gentoo developers are too
 	elite to even point to the actual patch fixing the issue.
-diff -Naur glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
---- glibc-2.11.1-orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 20:10:20.000000000 +0000
-+++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c	2010-04-17 02:24:02.000000000 +0100
-@@ -45,6 +45,11 @@
- /* Embed an #include to pull in the alignment and .end directives. */
- asm ("\n#include \"defs.h\"");
- 
-+asm ("\n#if defined __i686 && defined __ASSEMBLER__");
-+asm ("\n#undef __i686");
-+asm ("\n#define __i686 __i686");
-+asm ("\n#endif");
-+
- /* The initial common code ends here. */
- asm ("\n/*@HEADER_ENDS*/");
- 
-diff -Naur glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h
---- glibc-2.11.1-orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 20:10:20.000000000 +0000
-+++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-04-17 02:24:02.000000000 +0100
-@@ -29,6 +29,10 @@
+diff -Nur glibc-2.16.0.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.16.0/sysdeps/unix/sysv/linux/i386/sysdep.h
+--- glibc-2.16.0.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2012-06-30 21:12:34.000000000 +0200
++++ glibc-2.16.0/sysdeps/unix/sysv/linux/i386/sysdep.h	2012-08-01 17:56:05.000000000 +0200
+@@ -28,6 +28,10 @@
  #include <dl-sysdep.h>
  #include <tls.h>
  

+ 0 - 31
toolchain/glibc/patches/stdio_lim.patch

@@ -1,31 +0,0 @@
-diff -Nur glibc-2.11.orig/stdio-common/Makefile glibc-2.11/stdio-common/Makefile
---- glibc-2.11.orig/stdio-common/Makefile	2009-10-30 18:17:08.000000000 +0100
-+++ glibc-2.11/stdio-common/Makefile	2009-12-30 23:52:08.000000000 +0100
-@@ -21,7 +21,7 @@
- #
- subdir	:= stdio-common
- 
--headers	:= stdio_ext.h printf.h bits/printf-ldbl.h
-+headers	:= stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
- 
- routines	:=							      \
- 	ctermid cuserid							      \
-@@ -40,8 +40,6 @@
- 	isoc99_vsscanf							      \
- 	psiginfo
- 
--install-others = $(inst_includedir)/bits/stdio_lim.h
--
- include ../Makeconfig
- 
- aux	:= errlist siglist printf-parsemb printf-parsewc fxprintf
-@@ -66,9 +64,6 @@
- 
- include ../Rules
- 
--$(inst_includedir)/bits/stdio_lim.h: $(common-objpfx)bits/stdio_lim.h $(+force)
--	$(do-install)
--
- ifeq ($(cross-compiling),no)
- .PHONY: do-tst-unbputc do-tst-printf
- tests: do-tst-unbputc do-tst-printf

+ 60 - 0
toolchain/glibc/patches/timezone.patch

@@ -0,0 +1,60 @@
+--- toolchain_build_i686_eglibc/w-eglibc-2.16-1/eglibc-2.16/libc/timezone/Makefile	2012-07-31 08:58:48.000000000 +0200
++++ toolchain_build_i686_glibc/w-glibc-2.16.0-1/glibc-2.16.0/timezone/Makefile	2012-06-30 21:12:34.000000000 +0200
+@@ -52,16 +52,7 @@
+ include ../Rules
+ 
+ 
+-zic-objs = zic.o ialloc.o scheck.o
+-
+-$(objpfx)zic: $(addprefix $(objpfx), $(zic-objs))
+-
+-$(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c
+-	$(BUILD_CC) $< -c $(OUTPUT_OPTION) $(CFLAGS-$*.c) $(CPPFLAGS-$*) \
+-		-DCROSS_ZIC $(compile-mkdep-flags)
+-
+-$(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs))
+-	$(BUILD_CC) $(addprefix $(objpfx)cross-,$(zic-objs)) -o $@
++$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
+ 
+ tz-cflags = -DTZDIR='"$(zonedir)"' \
+ 	    -DTZDEFAULT='"$(localtime-file)"' \
+@@ -78,17 +69,10 @@
+ # Don't add leapseconds here since test-tz made checks that work only without
+ # leapseconds.
+ testdata = $(objpfx)testdata
+-ifeq (no,$(cross-compiling))
+ define build-testdata
+ GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \
+   $(built-program-cmd) -d $(testdata) -y ./yearistype $<
+ endef
+-else
+-define build-testdata
+-LANGUAGE=C LC_ALL=C \
+-  $(objpfx)cross-zic -d $(testdata) -y ./yearistype $<
+-endef
+-endif
+ 
+ $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
+ $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
+@@ -101,11 +85,7 @@
+ tst-timezone-ENV = TZDIR=$(testdata)
+ 
+ # Note this must come second in the deps list for $(built-program-cmd) to work.
+-ifeq (no,$(cross-compiling))
+ zic-deps = $(objpfx)zic $(leapseconds) yearistype
+-else
+-zic-deps = $(objpfx)cross-zic $(objpfx)zic $(leapseconds) yearistype
+-endif
+ 
+ $(testdata)/America/New_York: northamerica $(zic-deps)
+ 	$(build-testdata)
+@@ -127,8 +107,6 @@
+ 
+ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
+ 	sed -e 's%@KSH@%$(KSH)%g' \
+-	    -e 's%@TZDIR@%$(zonedir)%g' \
+-	    -e 's%@PKGVERSION@%$(PKGVERSION)%g' \
+-	    -e 's%@REPORT_BUGS_TO@%$(REPORT_BUGS_TO)%g' < $< > $@.new
++	    -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new
+ 	chmod 555 $@.new
+ 	mv -f $@.new $@

+ 0 - 135
toolchain/glibc/patches/tz.patch

@@ -1,135 +0,0 @@
---- glibc-2.12.1/timezone/Makefile	2010-07-27 13:34:39.000000000 +0200
-+++ glibc-2.12.1.orig/timezone/Makefile	2011-01-10 15:20:02.576150764 +0100
-@@ -69,13 +69,10 @@
- 					 $(addprefix $(inst_zonedir)/, \
- 						     $(posixrules-file)))
- 
--ifeq ($(cross-compiling),no)
--# Don't try to install the zoneinfo files since we can't run zic.
- install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \
- 					      $(zonenames:%=posix/%) \
- 					      $(zonenames:%=right/%)) \
- 		 $(installed-localtime-file) $(installed-posixrules-file)
--endif
- 
- ifeq ($(have-ksh),yes)
- install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab
-@@ -106,18 +103,35 @@
- 	   echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \'	    ;\
- 	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\
- 	 fi								    ;\
--	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;\
--	 echo '$< $$(objpfx)zic leapseconds yearistype'			    ;\
--	 echo '	$$(tzcompile)'						    ;\
--	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;\
--	 echo '$< $$(objpfx)zic /dev/null yearistype'			    ;\
--	 echo '	$$(tzcompile)'						    ;\
--	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;\
--	 echo '$< $$(objpfx)zic $$(leapseconds) yearistype'		    ;\
--	 echo '	$$(tzcompile)'						    ;\
-+	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;) > $@.new
-+
-+ifeq (no,$(cross-compiling))
-+	(echo '$< $$(objpfx)zic leapseconds yearistype'			    ;) >> $@.new
-+else
-+	(echo '$< $$(objpfx)cross-zic leapseconds yearistype'		    ;) >> $@.new
-+endif
-+
-+	(echo '	$$(tzcompile)'						    ;\
-+	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;) >> $@.new
-+
-+ifeq (no,$(cross-compiling))
-+	(echo '$< $$(objpfx)zic /dev/null yearistype'			    ;) >> $@.new
-+else
-+	(echo '$< $$(objpfx)cross-zic /dev/null yearistype'		    ;) >> $@.new
-+endif
-+
-+	(echo '	$$(tzcompile)'						    ;\
-+	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;) >> $@.new
-+
-+ifeq (no,$(cross-compiling))
-+	(echo '$< $$(objpfx)zic $$(leapseconds) yearistype'		    ;) >> $@.new
-+else
-+	(echo '$< $$(objpfx)cross-zic $$(leapseconds) yearistype'	    ;) >> $@.new
-+endif
-+
-+	(echo '	$$(tzcompile)'						    ;\
- 	 echo 'endif'							    ;\
--	 echo 'zonenames := $$(zonenames) $$($*-zones)'			    ;\
--	) > $@.new
-+	 echo 'zonenames := $$(zonenames) $$($*-zones)'			    ;) >> $@.new
- 	mv $@.new $@
- 
- .PHONY: echo-zonenames
-@@ -128,7 +142,11 @@
- # We have to use `-d $(inst_zonedir)' to explictly tell zic where to
- # place the output files although $(zonedir) is compiled in.  But the
- # user might have set $(install_root) on the command line of `make install'.
-+ifeq (no,$(cross-compiling))
- zic-cmd = $(built-program-cmd) -d $(inst_zonedir)
-+else
-+zic-cmd = $(objpfx)cross-zic -d $(inst_zonedir)
-+endif
- tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
- 	    -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
- 
-@@ -158,8 +176,17 @@
- 	$(zic-cmd) -p $(posixrules)
- endif
- 
-+zic-objs = zic.o ialloc.o scheck.o
-+
-+$(objpfx)zic: $(addprefix $(objpfx), $(zic-objs))
-+
-+$(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c
-+	gcc $< -c $(OUTPUT_OPTION) \
-+		$(filter-out -DHAVE_GETTEXT,$(CFLAGS-$*.c)) \
-+		$(CPPFLAGS-$*) -DCROSS_ZIC $(compile-mkdep-flags)
- 
--$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
-+$(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs))
-+	gcc $(addprefix $(objpfx)cross-,$(zic-objs)) -o $@
- 
- tz-cflags = -DTZDIR='"$(zonedir)"' \
- 	    -DTZDEFAULT='"$(localtime-file)"' \
-@@ -176,10 +203,17 @@
- # Don't add leapseconds here since test-tz made checks that work only without
- # leapseconds.
- testdata = $(objpfx)testdata
-+ifeq (no,$(cross-compiling))
- define build-testdata
- GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \
-   $(built-program-cmd) -d $(testdata) -y ./yearistype $<
- endef
-+else
-+define build-testdata
-+LANGUAGE=C LC_ALL=C \
-+  $(objpfx)cross-zic -d $(testdata) -y ./yearistype $<
-+endef
-+endif
- 
- $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
- $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
-@@ -192,7 +226,11 @@
- tst-timezone-ENV = TZDIR=$(testdata)
- 
- # Note this must come second in the deps list for $(built-program-cmd) to work.
-+ifeq (no,$(cross-compiling))
- zic-deps = $(objpfx)zic $(leapseconds) yearistype
-+else
-+zic-deps = $(objpfx)cross-zic $(objpfx)zic $(leapseconds) yearistype
-+endif
- 
- $(testdata)/America/New_York: northamerica $(zic-deps)
- 	$(build-testdata)
-@@ -214,7 +252,9 @@
- 
- $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
- 	sed -e 's%@KSH@%$(KSH)%g' \
--	    -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new
-+	    -e 's%@TZDIR@%$(zonedir)%g' \
-+	    -e 's%@PKGVERSION@%$(PKGVERSION)%g' \
-+	    -e 's%@REPORT_BUGS_TO@%$(REPORT_BUGS_TO)%g' < $< > $@.new
- 	chmod 555 $@.new
- 	mv -f $@.new $@
-