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.4)
16 PKG_MD5SUM
:=7e9a88dcd41fbc53801dbe5bdacaf245
18 ifeq ($(PKG_VERSION
),2.6.1)
19 PKG_MD5SUM
:=11cf6d3fc86dbe0890b8d00372eb6286
21 ifeq ($(PKG_VERSION
),2.7)
22 PKG_MD5SUM
:=065c5952b439deba40083ccd67bcc8f7
25 PKG_SOURCE_URL
:=@GNU
/glibc
/
26 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
28 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)
30 include $(INCLUDE_DIR
)/toolchain-build.mk
32 HOST_STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_built
33 HOST_STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_installed
35 HOST_BUILD_DIR1
:=$(HOST_BUILD_DIR
)-initial
36 HOST_BUILD_DIR2
:=$(HOST_BUILD_DIR
)-final
40 ifneq ($(CONFIG_GLIBC_PORTS
),)
42 define Host
/Prepare
/ports
43 ln
-snf ..
/glibc-ports
$(HOST_BUILD_DIR
)/ports
47 # XXX: {e,}glibc does not build w/ -Os
48 # http://sourceware.org/bugzilla/show_bug.cgi?id=5203
49 GLIBC_CFLAGS
:=$(subst -Os
,-O2
,$(TARGET_CFLAGS
))
52 BUILD_CC
="$(HOSTCC)" \
53 $(TARGET_CONFIGURE_OPTS
) \
54 CFLAGS
="$(GLIBC_CFLAGS)" \
55 libc_cv_forced_unwind
=yes \
56 libc_cv_c_cleanup
=yes \
58 libc_cv_slibdir
="/lib" \
59 $(HOST_BUILD_DIR
)/configure \
61 --build
=$(GNU_HOST_NAME
) \
62 --host
=$(REAL_GNU_TARGET_NAME
) \
63 --with-headers
="$(TOOLCHAIN_DIR)/include" \
64 $(if
$(CONFIG_mips64
)$(CONFIG_mips64el
), --enable-kernel
="2.6.0") \
67 --enable-add-ons
="$(GLIBC_ADD_ONS)" \
71 ifeq ($(CONFIG_SOFT_FLOAT
),)
79 GLIBC_CONFIGURE_STAGE1
:= \
81 --disable-sanity-checks \
82 --enable-hacker-mode \
84 GLIBC_CONFIGURE_STAGE2
:= \
91 define Host
/SetToolchainInfo
92 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
93 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR
)/info.mk
94 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
95 $(SED
) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
98 define Stage1
/Configure
99 mkdir
-p
$(HOST_BUILD_DIR1
)
100 ( cd
$(HOST_BUILD_DIR1
); rm -f config.cache
; \
101 $(GLIBC_CONFIGURE_STAGE1
) \
105 define Stage1
/Compile
108 define Stage1
/Install
109 $(GLIBC_MAKE
) -C
$(HOST_BUILD_DIR1
) \
110 CFLAGS
="-DBOOTSTRAP_GCC" \
111 cross-compiling
=yes \
112 install_root
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
114 [ -f
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/include/bits
/stdio_lim.h
] || \
115 $(CP
) $(HOST_BUILD_DIR1
)/bits
/stdio_lim.h \
116 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/include/bits
/stdio_lim.h
117 [ -f
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/include/gnu
/stubs.h
] || \
118 touch
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/include/gnu
/stubs.h
121 define Stage2
/Configure
122 mkdir
-p
$(HOST_BUILD_DIR2
)
123 ( cd
$(HOST_BUILD_DIR2
); rm -f config.cache
; \
124 $(GLIBC_CONFIGURE_STAGE2
) \
128 define Stage2
/Compile
129 $(GLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) all
132 define Stage2
/Install
133 $(GLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) \
134 install_root
="$(TOOLCHAIN_DIR)" \
136 ( cd
$(TOOLCHAIN_DIR
) ; \
137 for d in lib usr
/lib
; do \
138 for f in libc.so libpthread.so libgcc_s.so
; do \
139 if
[ -f
$$$$d/$$$$f -a
! -L
$$$$d/$$$$f ] ; then \
140 $(SED
) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
148 $(call Host
/SetToolchainInfo
)
149 $(call Host
/Prepare
/Default
)
150 ln
-snf
$(PKG_NAME
)-$(PKG_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
151 $(call Host
/Prepare
/ports
)
152 $(call Stage1
/Configure
)
153 $(call Stage1
/Compile
)
154 $(call Stage1
/Install
)
157 define Host
/Configure
161 $(call Stage2
/Configure
)
162 $(call Stage2
/Compile
)
163 $(call Stage2
/Install
)
174 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev \
175 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
178 $(eval
$(call HostBuild
))