2009-01-08 02:49:11 +01:00
|
|
|
#
|
2009-02-03 22:25:48 +01:00
|
|
|
# Copyright (C) 2006-2009 OpenWrt.org
|
2009-01-08 02:49:11 +01:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=glibc
|
|
|
|
PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
|
|
|
|
|
|
|
|
ifeq ($(PKG_VERSION),2.3.6)
|
|
|
|
PKG_MD5SUM:=bfdce99f82d6dbcb64b7f11c05d6bc96
|
|
|
|
endif
|
2009-05-26 16:58:32 +02:00
|
|
|
ifeq ($(PKG_VERSION),2.4)
|
|
|
|
PKG_MD5SUM:=7e9a88dcd41fbc53801dbe5bdacaf245
|
|
|
|
endif
|
2009-01-08 02:49:11 +01:00
|
|
|
ifeq ($(PKG_VERSION),2.6.1)
|
|
|
|
PKG_MD5SUM:=11cf6d3fc86dbe0890b8d00372eb6286
|
|
|
|
endif
|
|
|
|
ifeq ($(PKG_VERSION),2.7)
|
|
|
|
PKG_MD5SUM:=065c5952b439deba40083ccd67bcc8f7
|
|
|
|
endif
|
|
|
|
|
|
|
|
PKG_SOURCE_URL:=@GNU/glibc/
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
|
|
|
|
|
|
|
PATCH_DIR:=./patches/$(PKG_VERSION)
|
|
|
|
|
2009-02-24 00:52:27 +01:00
|
|
|
include $(INCLUDE_DIR)/toolchain-build.mk
|
2009-01-08 02:49:11 +01:00
|
|
|
|
2009-03-13 13:50:23 +01:00
|
|
|
HOST_STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.glibc_built
|
|
|
|
HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_installed
|
2009-01-08 02:49:11 +01:00
|
|
|
|
2009-02-22 05:37:20 +01:00
|
|
|
HOST_BUILD_DIR1:=$(HOST_BUILD_DIR)-initial
|
|
|
|
HOST_BUILD_DIR2:=$(HOST_BUILD_DIR)-final
|
2009-01-08 02:49:11 +01:00
|
|
|
|
|
|
|
GLIBC_ADD_ONS+=nptl,
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_GLIBC_PORTS),)
|
|
|
|
GLIBC_ADD_ONS+=ports,
|
2009-02-22 05:37:20 +01:00
|
|
|
define Host/Prepare/ports
|
|
|
|
ln -snf ../glibc-ports $(HOST_BUILD_DIR)/ports
|
2009-01-08 02:49:11 +01:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
|
|
|
# XXX: {e,}glibc does not build w/ -Os
|
|
|
|
# http://sourceware.org/bugzilla/show_bug.cgi?id=5203
|
|
|
|
GLIBC_CFLAGS:=$(subst -Os,-O2,$(TARGET_CFLAGS))
|
|
|
|
|
2009-02-03 22:25:48 +01:00
|
|
|
GLIBC_CONFIGURE:= \
|
2009-01-08 02:49:11 +01:00
|
|
|
BUILD_CC="$(HOSTCC)" \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
CFLAGS="$(GLIBC_CFLAGS)" \
|
|
|
|
libc_cv_forced_unwind=yes \
|
|
|
|
libc_cv_c_cleanup=yes \
|
|
|
|
libc_cv_386_tls=yes \
|
2009-04-30 22:21:57 +02:00
|
|
|
libc_cv_slibdir="/lib" \
|
2009-02-22 05:37:20 +01:00
|
|
|
$(HOST_BUILD_DIR)/configure \
|
2009-01-08 02:49:11 +01:00
|
|
|
--prefix=/usr \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--host=$(REAL_GNU_TARGET_NAME) \
|
|
|
|
--with-headers="$(TOOLCHAIN_DIR)/usr/include" \
|
2009-04-18 19:03:55 +02:00
|
|
|
$(if $(CONFIG_mips64)$(CONFIG_mips64el), --enable-kernel="2.6.0") \
|
2009-01-08 02:49:11 +01:00
|
|
|
--disable-debug \
|
|
|
|
--disable-profile \
|
|
|
|
--enable-add-ons="$(GLIBC_ADD_ONS)" \
|
|
|
|
--without-gd \
|
|
|
|
--without-cvs \
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_SOFT_FLOAT),)
|
2009-02-03 22:25:48 +01:00
|
|
|
GLIBC_CONFIGURE+= \
|
2009-01-08 02:49:11 +01:00
|
|
|
--with-fp
|
|
|
|
else
|
2009-02-03 22:25:48 +01:00
|
|
|
GLIBC_CONFIGURE+= \
|
2009-01-08 02:49:11 +01:00
|
|
|
--without-fp
|
|
|
|
endif
|
|
|
|
|
|
|
|
GLIBC_CONFIGURE_STAGE1:= \
|
2009-02-03 22:25:48 +01:00
|
|
|
$(GLIBC_CONFIGURE) \
|
2009-01-08 02:49:11 +01:00
|
|
|
--disable-sanity-checks \
|
|
|
|
--enable-hacker-mode \
|
|
|
|
|
|
|
|
GLIBC_CONFIGURE_STAGE2:= \
|
2009-02-03 22:25:48 +01:00
|
|
|
$(GLIBC_CONFIGURE) \
|
2009-01-08 02:49:11 +01:00
|
|
|
|
|
|
|
GLIBC_MAKE:= \
|
|
|
|
$(MAKE) \
|
|
|
|
|
|
|
|
|
2009-02-22 05:37:20 +01:00
|
|
|
define Host/SetToolchainInfo
|
2009-01-08 02:49:11 +01:00
|
|
|
$(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
|
|
|
|
$(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
|
|
|
|
$(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
|
2009-04-24 04:07:24 +02:00
|
|
|
$(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
|
2009-01-08 02:49:11 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Stage1/Configure
|
2009-02-22 05:37:20 +01:00
|
|
|
mkdir -p $(HOST_BUILD_DIR1)
|
|
|
|
( cd $(HOST_BUILD_DIR1); rm -f config.cache; \
|
2009-01-08 02:49:11 +01:00
|
|
|
$(GLIBC_CONFIGURE_STAGE1) \
|
|
|
|
);
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Stage1/Compile
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Stage1/Install
|
2009-02-22 05:37:20 +01:00
|
|
|
$(GLIBC_MAKE) -C $(HOST_BUILD_DIR1) \
|
2009-01-08 02:49:11 +01:00
|
|
|
CFLAGS="-DBOOTSTRAP_GCC" \
|
|
|
|
cross-compiling=yes \
|
|
|
|
install_root="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
|
|
|
|
install-headers
|
|
|
|
[ -f $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/include/bits/stdio_lim.h ] || \
|
2009-02-22 05:37:20 +01:00
|
|
|
$(CP) $(HOST_BUILD_DIR1)/bits/stdio_lim.h \
|
2009-01-08 02:49:11 +01:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/include/bits/stdio_lim.h
|
|
|
|
[ -f $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/include/gnu/stubs.h ] || \
|
|
|
|
touch $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/include/gnu/stubs.h
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Stage2/Configure
|
2009-02-22 05:37:20 +01:00
|
|
|
mkdir -p $(HOST_BUILD_DIR2)
|
|
|
|
( cd $(HOST_BUILD_DIR2); rm -f config.cache; \
|
2009-01-08 02:49:11 +01:00
|
|
|
$(GLIBC_CONFIGURE_STAGE2) \
|
|
|
|
);
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Stage2/Compile
|
2009-02-22 05:37:20 +01:00
|
|
|
$(GLIBC_MAKE) -C $(HOST_BUILD_DIR2) all
|
2009-01-08 02:49:11 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Stage2/Install
|
2009-02-22 05:37:20 +01:00
|
|
|
$(GLIBC_MAKE) -C $(HOST_BUILD_DIR2) \
|
2009-01-08 02:49:11 +01:00
|
|
|
install_root="$(TOOLCHAIN_DIR)" \
|
|
|
|
install
|
|
|
|
( cd $(TOOLCHAIN_DIR) ; \
|
|
|
|
for d in lib usr/lib ; do \
|
|
|
|
for f in libc.so libpthread.so libgcc_s.so ; do \
|
|
|
|
if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
|
|
|
|
$(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
|
|
|
|
fi \
|
|
|
|
done \
|
|
|
|
done \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2009-02-22 05:37:20 +01:00
|
|
|
define Host/Prepare
|
|
|
|
$(call Host/SetToolchainInfo)
|
|
|
|
$(call Host/Prepare/Default)
|
2009-01-08 02:49:11 +01:00
|
|
|
ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
|
2009-02-22 05:37:20 +01:00
|
|
|
$(call Host/Prepare/ports)
|
2009-01-08 02:49:11 +01:00
|
|
|
$(call Stage1/Configure)
|
|
|
|
$(call Stage1/Compile)
|
|
|
|
$(call Stage1/Install)
|
|
|
|
endef
|
|
|
|
|
2009-02-22 05:37:20 +01:00
|
|
|
define Host/Configure
|
2009-01-08 02:49:11 +01:00
|
|
|
endef
|
|
|
|
|
2009-02-22 05:37:20 +01:00
|
|
|
define Host/Compile
|
2009-01-08 02:49:11 +01:00
|
|
|
$(call Stage2/Configure)
|
|
|
|
$(call Stage2/Compile)
|
|
|
|
$(call Stage2/Install)
|
|
|
|
endef
|
|
|
|
|
2009-02-22 05:37:20 +01:00
|
|
|
define Host/Install
|
2009-01-08 02:49:11 +01:00
|
|
|
endef
|
|
|
|
|
2009-02-22 05:37:20 +01:00
|
|
|
define Host/Clean
|
2009-01-08 02:49:11 +01:00
|
|
|
rm -rf \
|
2009-02-22 05:37:20 +01:00
|
|
|
$(HOST_BUILD_DIR) \
|
|
|
|
$(HOST_BUILD_DIR1) \
|
|
|
|
$(HOST_BUILD_DIR2) \
|
2009-01-08 02:49:11 +01:00
|
|
|
$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
|
|
|
|
$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call HostBuild))
|