2 # Copyright (C) 2006-2008 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
26 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)
28 STAGING_DIR_HOST
:=$(TOOLCHAIN_DIR
)
29 BUILD_DIR_HOST
:=$(BUILD_DIR_TOOLCHAIN
)
31 override CONFIG_AUTOREBUILD
=
33 include $(INCLUDE_DIR
)/host-build.mk
35 STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_built
36 STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.glibc_installed
38 PKG_BUILD_DIR1
:=$(PKG_BUILD_DIR
)-initial
39 PKG_BUILD_DIR2
:=$(PKG_BUILD_DIR
)-final
43 ifneq ($(CONFIG_GLIBC_PORTS
),)
45 define Build
/Prepare
/ports
46 ln
-snf ..
/glibc-ports
$(PKG_BUILD_DIR
)/ports
50 # XXX: {e,}glibc does not build w/ -Os
51 # http://sourceware.org/bugzilla/show_bug.cgi?id=5203
52 GLIBC_CFLAGS
:=$(subst -Os
,-O2
,$(TARGET_CFLAGS
))
54 GLIBC_CONFIGURE_COMMON
:= \
55 BUILD_CC
="$(HOSTCC)" \
56 $(TARGET_CONFIGURE_OPTS
) \
57 CFLAGS
="$(GLIBC_CFLAGS)" \
58 libc_cv_forced_unwind
=yes \
59 libc_cv_c_cleanup
=yes \
61 $(PKG_BUILD_DIR
)/configure \
63 --build
=$(GNU_HOST_NAME
) \
64 --host
=$(REAL_GNU_TARGET_NAME
) \
65 --with-headers
="$(TOOLCHAIN_DIR)/usr/include" \
68 --enable-add-ons
="$(GLIBC_ADD_ONS)" \
72 ifeq ($(CONFIG_SOFT_FLOAT
),)
73 GLIBC_CONFIGURE_COMMON
+= \
76 GLIBC_CONFIGURE_COMMON
+= \
80 GLIBC_CONFIGURE_STAGE1
:= \
81 $(GLIBC_CONFIGURE_COMMON
) \
82 --disable-sanity-checks \
83 --enable-hacker-mode \
85 GLIBC_CONFIGURE_STAGE2
:= \
86 $(GLIBC_CONFIGURE_COMMON
) \
92 define Build
/SetToolchainInfo
93 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
94 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR
)/info.mk
95 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
96 $(SED
) 's,^\(LIBC_PATCHVER\)=.*,\1=,' $(TOOLCHAIN_DIR
)/info.mk
99 define Stage1
/Configure
100 mkdir
-p
$(PKG_BUILD_DIR1
)
101 ( cd
$(PKG_BUILD_DIR1
); rm -f config.cache
; \
102 $(GLIBC_CONFIGURE_STAGE1
) \
106 define Stage1
/Compile
109 define Stage1
/Install
110 $(GLIBC_MAKE
) -C
$(PKG_BUILD_DIR1
) \
111 CFLAGS
="-DBOOTSTRAP_GCC" \
112 cross-compiling
=yes \
113 install_root
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
115 [ -f
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/bits
/stdio_lim.h
] || \
116 $(CP
) $(PKG_BUILD_DIR1
)/bits
/stdio_lim.h \
117 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/bits
/stdio_lim.h
118 [ -f
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/gnu
/stubs.h
] || \
119 touch
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/usr
/include/gnu
/stubs.h
122 define Stage2
/Configure
123 mkdir
-p
$(PKG_BUILD_DIR2
)
124 ( cd
$(PKG_BUILD_DIR2
); rm -f config.cache
; \
125 $(GLIBC_CONFIGURE_STAGE2
) \
129 define Stage2
/Compile
130 $(GLIBC_MAKE
) -C
$(PKG_BUILD_DIR2
) all
133 define Stage2
/Install
134 $(GLIBC_MAKE
) -C
$(PKG_BUILD_DIR2
) \
135 install_root
="$(TOOLCHAIN_DIR)" \
137 ( cd
$(TOOLCHAIN_DIR
) ; \
138 for d in lib usr
/lib
; do \
139 for f in libc.so libpthread.so libgcc_s.so
; do \
140 if
[ -f
$$$$d/$$$$f -a
! -L
$$$$d/$$$$f ] ; then \
141 $(SED
) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
149 $(call Build
/SetToolchainInfo
)
150 $(call Build
/Prepare
/Default
)
151 ln
-snf
$(PKG_NAME
)-$(PKG_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
152 $(call Build
/Prepare
/ports
)
153 $(call Stage1
/Configure
)
154 $(call Stage1
/Compile
)
155 $(call Stage1
/Install
)
158 define Build
/Configure
162 $(call Stage2
/Configure
)
163 $(call Stage2
/Compile
)
164 $(call Stage2
/Install
)
175 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev \
176 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
179 $(eval
$(call HostBuild
))