2 # Copyright (C) 2006-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
10 PKG_VERSION
:=$(call qstrip
,$(CONFIG_GLIBC_VERSION
))
12 ifeq ($(PKG_VERSION
),2.3.6)
13 PKG_MD5SUM
:=bfdce99f82d6dbcb64b7f11c05d6bc96
15 ifeq ($(PKG_VERSION
),2.6.1)
16 PKG_MD5SUM
:=11cf6d3fc86dbe0890b8d00372eb6286
18 ifeq ($(PKG_VERSION
),2.7)
19 PKG_MD5SUM
:=065c5952b439deba40083ccd67bcc8f7
22 PKG_SOURCE_URL
:=@GNU
/glibc
/
23 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
25 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)
27 include $(INCLUDE_DIR
)/toolchain-build.mk
29 HOST_STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_built
30 HOST_STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_installed
32 HOST_BUILD_DIR1
:=$(HOST_BUILD_DIR
)-initial
33 HOST_BUILD_DIR2
:=$(HOST_BUILD_DIR
)-final
37 ifneq ($(CONFIG_GLIBC_PORTS
),)
39 define Host
/Prepare
/ports
40 ln
-snf ..
/glibc-ports
$(HOST_BUILD_DIR
)/ports
44 # XXX: {e,}glibc does not build w/ -Os
45 # http://sourceware.org/bugzilla/show_bug.cgi?id=5203
46 GLIBC_CFLAGS
:=$(subst -Os
,-O2
,$(TARGET_CFLAGS
))
49 BUILD_CC
="$(HOSTCC)" \
50 $(TARGET_CONFIGURE_OPTS
) \
51 CFLAGS
="$(GLIBC_CFLAGS)" \
52 libc_cv_forced_unwind
=yes \
53 libc_cv_c_cleanup
=yes \
55 libc_cv_slibdir
="/lib" \
56 $(HOST_BUILD_DIR
)/configure \
58 --build
=$(GNU_HOST_NAME
) \
59 --host
=$(REAL_GNU_TARGET_NAME
) \
60 --with-headers
="$(TOOLCHAIN_DIR)/usr/include" \
61 $(if
$(CONFIG_mips64
)$(CONFIG_mips64el
), --enable-kernel
="2.6.0") \
64 --enable-add-ons
="$(GLIBC_ADD_ONS)" \
68 ifeq ($(CONFIG_SOFT_FLOAT
),)
76 GLIBC_CONFIGURE_STAGE1
:= \
78 --disable-sanity-checks \
79 --enable-hacker-mode \
81 GLIBC_CONFIGURE_STAGE2
:= \
88 define Host
/SetToolchainInfo
89 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
90 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR
)/info.mk
91 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
92 $(SED
) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
95 define Stage1
/Configure
96 mkdir
-p
$(HOST_BUILD_DIR1
)
97 ( cd
$(HOST_BUILD_DIR1
); rm -f config.cache
; \
98 $(GLIBC_CONFIGURE_STAGE1
) \
102 define Stage1
/Compile
105 define Stage1
/Install
106 $(GLIBC_MAKE
) -C
$(HOST_BUILD_DIR1
) \
107 CFLAGS
="-DBOOTSTRAP_GCC" \
108 cross-compiling
=yes \
109 install_root
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
111 [ -f
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/bits
/stdio_lim.h
] || \
112 $(CP
) $(HOST_BUILD_DIR1
)/bits
/stdio_lim.h \
113 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/bits
/stdio_lim.h
114 [ -f
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/gnu
/stubs.h
] || \
115 touch
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/gnu
/stubs.h
118 define Stage2
/Configure
119 mkdir
-p
$(HOST_BUILD_DIR2
)
120 ( cd
$(HOST_BUILD_DIR2
); rm -f config.cache
; \
121 $(GLIBC_CONFIGURE_STAGE2
) \
125 define Stage2
/Compile
126 $(GLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) all
129 define Stage2
/Install
130 $(GLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) \
131 install_root
="$(TOOLCHAIN_DIR)" \
133 ( cd
$(TOOLCHAIN_DIR
) ; \
134 for d in lib usr
/lib
; do \
135 for f in libc.so libpthread.so libgcc_s.so
; do \
136 if
[ -f
$$$$d/$$$$f -a
! -L
$$$$d/$$$$f ] ; then \
137 $(SED
) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
145 $(call Host
/SetToolchainInfo
)
146 $(call Host
/Prepare
/Default
)
147 ln
-snf
$(PKG_NAME
)-$(PKG_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
148 $(call Host
/Prepare
/ports
)
149 $(call Stage1
/Configure
)
150 $(call Stage1
/Compile
)
151 $(call Stage1
/Install
)
154 define Host
/Configure
158 $(call Stage2
/Configure
)
159 $(call Stage2
/Compile
)
160 $(call Stage2
/Install
)
171 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev \
172 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
175 $(eval
$(call HostBuild
))