Browse Source

glibc: move env/flags back to Makefile, fix cross-compile on MacOS X

Waldemar Brodkorb 8 years ago
parent
commit
17f20eabca

+ 43 - 6
toolchain/glibc/Makefile

@@ -3,8 +3,51 @@
 
 include $(ADK_TOPDIR)/rules.mk
 include ../rules.mk
+include Makefile.inc
+include ${ADK_TOPDIR}/mk/buildhlp.mk
 
 TARGET_CFLAGS:=		$(filter-out -ffast-math,$(TARGET_CFLAGS))
+TARGET_CFLAGS:=		$(filter-out -fno-asynchronous-unwind-tables,$(TARGET_CFLAGS))
+TARGET_CFLAGS:=		$(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
+TARGET_LDFLAGS:=	$(filter-out -fstack-protector-all,$(TARGET_LDFLAGS))
+
+GLIBC_CONFOPTS:=	--build=$(GNU_HOST_NAME) \
+			--host=$(GNU_TARGET_NAME) \
+			--with-headers=$(STAGING_TARGET_DIR)/usr/include \
+			--disable-sanity-checks \
+			--disable-werror \
+			--disable-nls \
+			--disable-werror \
+			--without-cvs \
+			--disable-profile \
+			--disable-debug \
+			--without-gd \
+			--disable-nscd \
+			--with-__thread \
+			--with-tls \
+			--enable-kernel="2.6.32" \
+			--enable-add-ons
+
+ifeq ($(ADK_TARGET_FLOAT),soft)
+GLIBC_CONFOPTS+=	--without-fp
+endif
+ifeq ($(ADK_TARGET_FLOAT),hard)
+GLIBC_CONFOPTS+=	--with-fp
+endif
+
+GLIBC_ENV:=             PATH='${TARGET_PATH}' \
+			CONFIG_SHELL='$(strip ${SHELL})' \
+                        BUILD_CC=${CC_FOR_BUILD} \
+                        CFLAGS="$(TARGET_CFLAGS)" \
+                        CC="${TARGET_CC}" \
+                        CXX="${TARGET_CXX}" \
+                        AR="${TARGET_AR}" \
+                        RANLIB="${TARGET_RANLIB}" \
+                        libc_cv_forced_unwind=yes \
+			libc_cv_cc_with_libunwind=yes \
+                        libc_cv_c_cleanup=yes \
+                        libc_cv_gnu99_inline=yes \
+			libc_cv_initfini_array=yes \
 
 # glibc does not compile with Os
 TARGET_CFLAGS:=		$(subst Os,O2,$(TARGET_CFLAGS))
@@ -12,9 +55,6 @@ ifneq ($(ADK_DEBUG),)
 TARGET_CFLAGS+=		-O2
 endif
 
-include Makefile.inc
-include ${ADK_TOPDIR}/mk/buildhlp.mk
-
 GLIBC_MAKEOPTS+=	cross-compiling=yes
 ifeq (${ADK_MAKE_PARALLEL},y)
 GLIBC_MAKEOPTS+=	PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
@@ -47,7 +87,4 @@ $(WRKBUILD)/.installed:
 	${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
 	touch $@
 
-$(WRKBUILD)/.final:
-	touch $@
-
 include ${ADK_TOPDIR}/mk/toolchain.mk

+ 0 - 38
toolchain/glibc/Makefile.inc

@@ -32,41 +32,3 @@ PKG_RELEASE:=		1
 PKG_HASH:=		2d3997f588401ea095a0b27227b1d50cdfdd416236f6567b564549d3b46ea2a2
 endif
 DISTFILES:=		$(PKG_NAME)-$(PKG_VERSION).tar.xz
-GLIBC_CONFOPTS:=	--build=$(GNU_HOST_NAME) \
-			--host=$(GNU_TARGET_NAME) \
-			--with-headers=$(STAGING_TARGET_DIR)/usr/include \
-			--disable-sanity-checks \
-			--disable-werror \
-			--disable-nls \
-			--disable-werror \
-			--without-cvs \
-			--disable-profile \
-			--disable-debug \
-			--without-gd \
-			--disable-nscd \
-			--with-__thread \
-			--with-tls \
-			--enable-kernel="2.6.32" \
-			--enable-add-ons
-ifeq ($(ADK_TARGET_FLOAT),soft)
-GLIBC_CONFOPTS+=	--without-fp
-endif
-ifeq ($(ADK_TARGET_FLOAT),hard)
-GLIBC_CONFOPTS+=	--with-fp
-endif
-TARGET_CFLAGS:=		$(filter-out -fno-asynchronous-unwind-tables,$(TARGET_CFLAGS))
-TARGET_CFLAGS:=		$(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
-TARGET_LDFLAGS:=	$(filter-out -fstack-protector-all,$(TARGET_LDFLAGS))
-GLIBC_ENV:=             PATH='${TARGET_PATH}' \
-			CONFIG_SHELL='$(strip ${SHELL})' \
-                        BUILD_CC=${CC_FOR_BUILD} \
-                        CFLAGS="$(TARGET_CFLAGS)" \
-                        CC="${TARGET_CC}" \
-                        CXX="${TARGET_CXX}" \
-                        AR="${TARGET_AR}" \
-                        RANLIB="${TARGET_RANLIB}" \
-                        libc_cv_forced_unwind=yes \
-			libc_cv_cc_with_libunwind=yes \
-                        libc_cv_c_cleanup=yes \
-                        libc_cv_gnu99_inline=yes \
-			libc_cv_initfini_array=yes \

+ 16 - 1
toolchain/glibc/patches/2.22/glibc-cross.patch

@@ -1,6 +1,6 @@
 diff -Nur glibc-2.22.orig/sunrpc/rpc_main.c glibc-2.22/sunrpc/rpc_main.c
 --- glibc-2.22.orig/sunrpc/rpc_main.c	2015-08-05 08:42:21.000000000 +0200
-+++ glibc-2.22/sunrpc/rpc_main.c	2015-08-19 02:37:42.912687500 +0200
++++ glibc-2.22/sunrpc/rpc_main.c	2015-12-08 06:21:38.000000000 +0100
 @@ -38,7 +38,11 @@
  #include <stdio.h>
  #include <string.h>
@@ -24,3 +24,18 @@ diff -Nur glibc-2.22.orig/sunrpc/rpc_main.c glibc-2.22/sunrpc/rpc_main.c
  #include "../version.h"
  #define PACKAGE _libc_intl_domainname
  
+diff -Nur glibc-2.22.orig/sunrpc/rpc_scan.c glibc-2.22/sunrpc/rpc_scan.c
+--- glibc-2.22.orig/sunrpc/rpc_scan.c	2015-08-05 08:42:21.000000000 +0200
++++ glibc-2.22/sunrpc/rpc_scan.c	2015-12-08 06:22:36.000000000 +0100
+@@ -37,7 +37,11 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <string.h>
++#if defined(__APPLE__) || defined(__CYGWIN__)
++#define gettext(X) (X)
++#else
+ #include <libintl.h>
++#endif
+ #include "rpc_scan.h"
+ #include "rpc_parse.h"
+ #include "rpc_util.h"