summaryrefslogtreecommitdiff
path: root/toolchain/glibc
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain/glibc')
-rw-r--r--toolchain/glibc/Makefile13
-rw-r--r--toolchain/glibc/Makefile.inc3
-rw-r--r--toolchain/glibc/patches/i686_define_bug.patch38
-rw-r--r--toolchain/glibc/patches/tz.patch135
4 files changed, 183 insertions, 6 deletions
diff --git a/toolchain/glibc/Makefile b/toolchain/glibc/Makefile
index 4d39e2b27..d492b9837 100644
--- a/toolchain/glibc/Makefile
+++ b/toolchain/glibc/Makefile
@@ -17,6 +17,7 @@ ifeq ($(ADK_TARGET_NO_FPU),y)
GLIBC_CONFOPTS+= --without-fp
endif
+GLIBC_MAKEOPTS+= cross-compiling=yes
ifeq (${ADK_MAKE_PARALLEL},y)
GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j${ADK_MAKE_JOBS}"
endif
@@ -31,21 +32,19 @@ $(WRKBUILD)/.headers_configure:
(cd $(GLIBC_BUILD_DIR_INITIAL); \
${GLIBC_ENV} \
$(WRKBUILD)/configure \
- --prefix=$(TOOLCHAIN_SYSROOT)/usr \
- --with-sysroot=$(TOOLCHAIN_SYSROOT) \
+ --prefix=$(STAGING_TARGET_DIR)/usr \
+ --with-sysroot=$(STAGING_TARGET_DIR) \
${GLIBC_CONFOPTS} \
);
touch $@
$(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
- mkdir -p $(TOOLCHAIN_SYSROOT)/usr/lib
(cd $(GLIBC_BUILD_DIR_INITIAL); \
${GLIBC_ENV} \
$(MAKE) ${GLIBC_MAKEOPTS} \
- cross-compiling=yes \
install-headers \
);
- touch $(TOOLCHAIN_SYSROOT)/usr/include/gnu/stubs.h
+ touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
touch $@
$(WRKBUILD)/.configured:
@@ -67,6 +66,10 @@ $(WRKBUILD)/.compiled:
$(WRKBUILD)/.installed:
${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) \
install_root=$(STAGING_TARGET_DIR) install
+ mkdir -p ${STAGING_TARGET_DIR}/etc
+ ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc/
+ ${INSTALL_DATA} ${WRKBUILD}/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/
+ ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
touch $(WRKBUILD)/.installed
diff --git a/toolchain/glibc/Makefile.inc b/toolchain/glibc/Makefile.inc
index ff4753465..79ba89cc2 100644
--- a/toolchain/glibc/Makefile.inc
+++ b/toolchain/glibc/Makefile.inc
@@ -9,7 +9,7 @@ PKG_SITES:= ${MASTER_SITE_GNU:=glibc/}
GLIBC_PORTS_VERSION:= 2.12
GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
--host=$(REAL_GNU_TARGET_NAME) \
- --with-headers=$(TOOLCHAIN_SYSROOT)/usr/include \
+ --with-headers=$(STAGING_TARGET_DIR)/usr/include \
--disable-nls \
--disable-sanity-checks \
--disable-nls \
@@ -32,3 +32,4 @@ GLIBC_ENV:= PATH='${TARGET_PATH}' \
libc_cv_c_cleanup=yes \
libc_cv_gnu99_inline=yes \
libc_cv_sparc64_tls=yes \
+ libc_cv_slibdir="/lib" \
diff --git a/toolchain/glibc/patches/i686_define_bug.patch b/toolchain/glibc/patches/i686_define_bug.patch
new file mode 100644
index 000000000..0414fecc9
--- /dev/null
+++ b/toolchain/glibc/patches/i686_define_bug.patch
@@ -0,0 +1,38 @@
+ Fix for compiling glibc with -march=i686 specified.
+ The patch below found at: http://permalink.gmane.org/gmane.linux.lfs.devel/9758,
+ a nice discussion (with a comment of the glibc maintainer) can be found here:
+ http://old.nabble.com/-RFC-PATCH--glibc-doesn%27t-build-with-%22gcc--march%3Di686%22-td17442608.html
+
+ To me, this simply shows once more how fucked up things can be. E.g. the (related) bug report here:
+ 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 @@
+ #include <dl-sysdep.h>
+ #include <tls.h>
+
++#if defined __i686 && defined __ASSEMBLER__
++#undef __i686
++#define __i686 __i686
++#endif
+
+ /* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
diff --git a/toolchain/glibc/patches/tz.patch b/toolchain/glibc/patches/tz.patch
new file mode 100644
index 000000000..990458aa4
--- /dev/null
+++ b/toolchain/glibc/patches/tz.patch
@@ -0,0 +1,135 @@
+--- 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 $@
+