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 STAGING_DIR_HOST
:=$(TOOLCHAIN_DIR
)
28 BUILD_DIR_HOST
:=$(BUILD_DIR_TOOLCHAIN
)
30 override CONFIG_AUTOREBUILD
=
32 include $(INCLUDE_DIR
)/host-build.mk
34 STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_built
35 STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_installed
37 HOST_BUILD_DIR1
:=$(HOST_BUILD_DIR
)-initial
38 HOST_BUILD_DIR2
:=$(HOST_BUILD_DIR
)-final
42 ifneq ($(CONFIG_GLIBC_PORTS
),)
44 define Host
/Prepare
/ports
45 ln
-snf ..
/glibc-ports
$(HOST_BUILD_DIR
)/ports
49 # XXX: {e,}glibc does not build w/ -Os
50 # http://sourceware.org/bugzilla/show_bug.cgi?id=5203
51 GLIBC_CFLAGS
:=$(subst -Os
,-O2
,$(TARGET_CFLAGS
))
54 BUILD_CC
="$(HOSTCC)" \
55 $(TARGET_CONFIGURE_OPTS
) \
56 CFLAGS
="$(GLIBC_CFLAGS)" \
57 libc_cv_forced_unwind
=yes \
58 libc_cv_c_cleanup
=yes \
60 $(HOST_BUILD_DIR
)/configure \
62 --build
=$(GNU_HOST_NAME
) \
63 --host
=$(REAL_GNU_TARGET_NAME
) \
64 --with-headers
="$(TOOLCHAIN_DIR)/usr/include" \
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_PATCHVER\)=.*,\1=,' $(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
/usr
/include/bits
/stdio_lim.h
] || \
115 $(CP
) $(HOST_BUILD_DIR1
)/bits
/stdio_lim.h \
116 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/bits
/stdio_lim.h
117 [ -f
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/gnu
/stubs.h
] || \
118 touch
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/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
))