summaryrefslogtreecommitdiff
path: root/toolchain/eglibc
diff options
context:
space:
mode:
authorWaldemar Brodkorb <mail@waldemar-brodkorb.de>2012-10-08 23:12:28 +0200
committerWaldemar Brodkorb <mail@waldemar-brodkorb.de>2012-10-08 23:12:28 +0200
commit14b1dc5940bd35637fd901418fbf6c2fe1974fec (patch)
tree61c55f01cfaf2463f3ca73cb24fe481f09a1c228 /toolchain/eglibc
parent440dcafbd07915cadeb26806fe6d8835d62f293b (diff)
finetune multilib support a lot, cleanup eglibc/glibc Makefiles while there
Diffstat (limited to 'toolchain/eglibc')
-rw-r--r--toolchain/eglibc/Makefile203
-rw-r--r--toolchain/eglibc/Makefile.inc26
-rw-r--r--toolchain/eglibc/Makefile.multilib13
3 files changed, 140 insertions, 102 deletions
diff --git a/toolchain/eglibc/Makefile b/toolchain/eglibc/Makefile
index 7f369d3ed..b165d1ba7 100644
--- a/toolchain/eglibc/Makefile
+++ b/toolchain/eglibc/Makefile
@@ -4,53 +4,55 @@
include $(TOPDIR)/rules.mk
include ../rules.mk
include Makefile.inc
+include Makefile.multilib
include ${TOPDIR}/mk/buildhlp.mk
ifneq ($(ADK_DEBUG),)
TARGET_CFLAGS+= -O2
endif
# ssp partially supported
-TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS))
-
-EGLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
- --without-cvs \
- --disable-profile \
- --disable-debug \
- --enable-kernel=2.6.0 \
- --without-gd \
- --with-__thread \
- --with-tls \
- --enable-add-ons \
- $(NLS)
-
-EGLIBC_ENV:= PATH='${TARGET_PATH}' \
- BUILD_CC=${CC_FOR_BUILD} \
- CFLAGS="$(TARGET_CFLAGS)" \
- CC=${REAL_GNU_TARGET_NAME}-gcc \
- CXX=${REAL_GNU_TARGET_NAME}-g++ \
- AR=${REAL_GNU_TARGET_NAME}-ar \
- RANLIB=${REAL_GNU_TARGET_NAME}-ranlib \
- libc_cv_cc_with_libunwind=no \
- libc_cv_forced_unwind=yes \
- libc_cv_c_cleanup=yes \
- libc_cv_gnu99_inline=yes \
- libc_cv_initfini_array=yes \
- libc_cv_slibdir="/lib"
+TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS))
ifeq ($(ADK_TARGET_NO_FPU),y)
EGLIBC_CONFOPTS+= --without-fp
endif
EGLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
-EGLIBC_BUILD_DIR_INITIAL32:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers32
EGLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
-EGLIBC_BUILD_DIR_FINAL32:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final32
ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
-$(WRKBUILD)/.headers_configure: $(WRKBUILD)/.headers_configure32
+$(WRKBUILD)/.headers_configure:
+ for abi in $(TABI); do \
+ mkdir -p $(EGLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \
+ (cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
+ ln -sf ../ports ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)/libc); \
+ $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
+ $(EGLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}/option-groups.config; \
+ (cd $(EGLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \
+ ${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \
+ $(WRKBUILD)/libc/configure \
+ --prefix=$(STAGING_TARGET_DIR)-$${abi/*:/}/usr \
+ --with-headers=$(STAGING_TARGET_DIR)-$${abi/*:/}/usr/include \
+ --host=$${abi/:*/} \
+ ${EGLIBC_CONFOPTS} \
+ ); \
+ done
+ touch $@
+
+$(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
+ for abi in $(TABI); do \
+ (cd $(EGLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \
+ ${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \
+ $(MAKE) install-headers install-bootstrap-headers=yes cross-compiling=yes \
+ ); \
+ touch $(STAGING_TARGET_DIR)-$${abi/*:/}/usr/include/gnu/stubs.h; \
+ touch $(STAGING_TARGET_DIR)-$${abi/*:/}/usr/include/gnu/stubs-{32,x32,64}.h; \
+ done
+ touch $@
else
$(WRKBUILD)/.headers_configure:
-endif
mkdir -p $(EGLIBC_BUILD_DIR_INITIAL)
(cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
ln -sf ../ports ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)/libc);
@@ -58,6 +60,7 @@ endif
$(EGLIBC_BUILD_DIR_INITIAL)/option-groups.config
(cd $(EGLIBC_BUILD_DIR_INITIAL); \
${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
$(WRKBUILD)/libc/configure \
--prefix=$(STAGING_TARGET_DIR)/usr \
--with-headers=$(STAGING_TARGET_DIR)/usr/include \
@@ -68,38 +71,14 @@ endif
$(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
(cd $(EGLIBC_BUILD_DIR_INITIAL); \
- PATH='${TARGET_PATH}' \
${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
$(MAKE) install-headers install-bootstrap-headers=yes cross-compiling=yes \
);
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
- touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-64.h
- touch $@
-
-$(WRKBUILD)/.headers_configure32:
- mkdir -p $(EGLIBC_BUILD_DIR_INITIAL32)
- (cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
- ln -sf ../ports ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)/libc);
- $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
- $(EGLIBC_BUILD_DIR_INITIAL32)/option-groups.config
- (cd $(EGLIBC_BUILD_DIR_INITIAL32); \
- ${EGLIBC_ENV} \
- CC='${REAL_GNU_TARGET_NAME}-gcc -m32' \
- $(WRKBUILD)/libc/configure \
- --prefix=$(STAGING_TARGET_DIR_32)/usr \
- --with-headers=$(STAGING_TARGET_DIR_32)/usr/include \
- --host=i486-openadk-linux-gnu \
- ${EGLIBC_CONFOPTS} \
- );
- (cd $(EGLIBC_BUILD_DIR_INITIAL32); \
- PATH='${TARGET_PATH}' \
- ${EGLIBC_ENV} \
- CC='${REAL_GNU_TARGET_NAME}-gcc -m32' \
- $(MAKE) install-headers install-bootstrap-headers=yes cross-compiling=yes \
- );
- touch $(STAGING_TARGET_DIR_32)/usr/include/gnu/stubs.h
- touch $(STAGING_TARGET_DIR_32)/usr/include/gnu/stubs-64.h
+ touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64}.h
touch $@
+endif
ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
EGLIBC_ENV+= libc_cv_ssp=yes
@@ -108,15 +87,70 @@ EGLIBC_ENV+= libc_cv_ssp=no
endif
ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
-$(WRKBUILD)/.configured: $(WRKBUILD)/.configured32
-else
$(WRKBUILD)/.configured:
+ for abi in $(TABI); do \
+ mkdir -p $(EGLIBC_BUILD_DIR_FINAL)-$${abi/*:/} ;\
+ $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
+ $(EGLIBC_BUILD_DIR_FINAL)-$${abi/*:/}/option-groups.config ;\
+ (cd $(EGLIBC_BUILD_DIR_FINAL)-$${abi/*:/}; \
+ ${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \
+ $(WRKBUILD)/libc/configure \
+ --prefix=/usr \
+ --enable-shared \
+ --enable-stackguard-randomization \
+ --host=$${abi/:*/} \
+ ${EGLIBC_CONFOPTS} \
+ ); \
+ done
+ touch $@
+
+$(EGLIBC_BUILD_DIR_FINAL)/libc.so:
+$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
+ for abi in $(TABI); do \
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL)-$${abi/*:/} cross-compiling=yes all ;\
+ done
+ touch $@
+
+$(WRKBUILD)/.installed: $(EGLIBC_BUILD_DIR_FINAL)/libc.so
+ for abi in $(TABI); do \
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL)-$${abi/*:/} install_root=$(STAGING_TARGET_DIR)-$${abi/*:/} install ;\
+ done
+ifeq ($(ADK_TARGET_ABI_64),y)
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL)-64 install_root=$(STAGING_TARGET_DIR) install
+endif
+ifeq ($(ADK_TARGET_ABI_32),y)
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL)-32 install_root=$(STAGING_TARGET_DIR) install
+endif
+ifeq ($(ADK_TARGET_ABI_X32),y)
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL)-x32 install_root=$(STAGING_TARGET_DIR) install
endif
+ touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
+ touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64}.h
+ # for libgcc build we need C library files, 64 bit default
+ mkdir -p $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2 ; \
+ $(CP) $(STAGING_TARGET_DIR)-64/lib/* $(STAGING_TARGET_DIR)-64/usr/lib/* \
+ $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/; \
+ rm $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/libc.so ; \
+ -for abi in $(TABI); do \
+ mkdir -p $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/} ; \
+ $(CP) $(STAGING_TARGET_DIR)-$${abi/*:/}/lib/* $(STAGING_TARGET_DIR)-$${abi/*:/}/usr/lib/* \
+ $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/} ; \
+ rm $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/}/libc.so ; \
+ done
+ ${INSTALL_DIR} ${STAGING_TARGET_DIR}/etc
+ ${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/
+ ${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/
+ ${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
+ touch $@
+else
+$(WRKBUILD)/.configured:
mkdir -p $(EGLIBC_BUILD_DIR_FINAL)
$(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
$(EGLIBC_BUILD_DIR_FINAL)/option-groups.config
(cd $(EGLIBC_BUILD_DIR_FINAL); \
${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
$(WRKBUILD)/libc/configure \
--prefix=/usr \
--enable-shared \
@@ -128,55 +162,20 @@ endif
$(EGLIBC_BUILD_DIR_FINAL)/libc.so:
$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
- ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) cross-compiling=yes all
+ ${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
+ $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) cross-compiling=yes all
touch $@
$(WRKBUILD)/.installed: $(EGLIBC_BUILD_DIR_FINAL)/libc.so
- ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
+ ${EGLIBC_ENV} \
+ CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
+ $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
+ ${INSTALL_DIR} ${STAGING_TARGET_DIR}/etc
${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/
${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/
${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
touch $@
-
-$(WRKBUILD)/.configured32:
- mkdir -p $(EGLIBC_BUILD_DIR_FINAL32)
- $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
- $(EGLIBC_BUILD_DIR_FINAL32)/option-groups.config
- (cd $(EGLIBC_BUILD_DIR_FINAL32); \
- ${EGLIBC_ENV} \
- CC='${REAL_GNU_TARGET_NAME}-gcc -m32' \
- $(WRKBUILD)/libc/configure \
- --prefix=/usr \
- --enable-shared \
- --enable-stackguard-randomization \
- --host=i486-openadk-linux-gnu \
- ${EGLIBC_CONFOPTS} \
- );
- ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL32) cross-compiling=yes all
- ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL32) install_root=$(STAGING_TARGET_DIR_32) install
- mkdir -p $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/32
- $(CP) $(STAGING_TARGET_DIR_32)/lib/* $(STAGING_TARGET_DIR_32)/usr/lib/* \
- $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/32
- -rm $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/32/libc.so
- touch $@
-
-$(WRKBUILD)/.configuredx32:
- mkdir -p $(EGLIBC_BUILD_DIR_FINALX32)
- $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
- $(EGLIBC_BUILD_DIR_FINALX32)/option-groups.config
- (cd $(EGLIBC_BUILD_DIR_FINALX32); \
- ${EGLIBC_ENV} \
- CC=${REAL_GNU_TARGET_NAME}-gcc -mx32 \
- $(WRKBUILD)/libc/configure \
- --prefix=/usr \
- --enable-shared \
- --enable-stackguard-randomization \
- --host=x86_64-x32-openadk-linux-gnu \
- ${EGLIBC_CONFOPTS} \
- );
- ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINALX32) cross-compiling=yes all
- ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINALX32) install_root=$(STAGING_TARGET_DIR_X32) install
- touch $@
-
+endif
include ${TOPDIR}/mk/toolchain.mk
diff --git a/toolchain/eglibc/Makefile.inc b/toolchain/eglibc/Makefile.inc
index 457969ef6..2541bb5e5 100644
--- a/toolchain/eglibc/Makefile.inc
+++ b/toolchain/eglibc/Makefile.inc
@@ -6,3 +6,29 @@ PKG_VERSION:= 2.16
PKG_RELEASE:= 1
PKG_MD5SUM:= 97b0956c312e747dcead4c9459ac2aa5
PKG_SITES:= http://openadk.org/distfiles/
+EGLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
+ --without-cvs \
+ --disable-profile \
+ --disable-debug \
+ --enable-kernel=2.6.0 \
+ --without-gd \
+ --with-__thread \
+ --with-tls \
+ --enable-add-ons \
+ $(NLS)
+
+EGLIBC_ENV:= PATH='${TARGET_PATH}' \
+ BUILD_CC=${CC_FOR_BUILD} \
+ GCC_HONOUR_COPTS=s \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CC=${REAL_GNU_TARGET_NAME}-gcc \
+ CXX=${REAL_GNU_TARGET_NAME}-g++ \
+ AR=${REAL_GNU_TARGET_NAME}-ar \
+ RANLIB=${REAL_GNU_TARGET_NAME}-ranlib \
+ libc_cv_cc_with_libunwind=no \
+ libc_cv_forced_unwind=yes \
+ libc_cv_c_cleanup=yes \
+ libc_cv_gnu99_inline=yes \
+ libc_cv_initfini_array=yes \
+ libc_cv_slibdir="/lib"
+
diff --git a/toolchain/eglibc/Makefile.multilib b/toolchain/eglibc/Makefile.multilib
new file mode 100644
index 000000000..08be0a100
--- /dev/null
+++ b/toolchain/eglibc/Makefile.multilib
@@ -0,0 +1,13 @@
+# multilib support
+ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
+TABI:=
+ifeq ($(ADK_TARGET_MULTILIB_X86_X32),y)
+TABI+=x86_64-openadk-linux-gnu:x32
+endif
+ifeq ($(ADK_TARGET_MULTILIB_X86_32),y)
+TABI+=i486-openadk-linux-gnu:32
+endif
+ifeq ($(ADK_TARGET_MULTILIB_X86_64),y)
+TABI+=x86_64-openadk-linux-gnu:64
+endif
+endif