[kernel] update to 2.6.28.4
[openwrt.git] / toolchain / glibc / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=glibc
10 PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
11
12 ifeq ($(PKG_VERSION),2.3.6)
13 PKG_MD5SUM:=bfdce99f82d6dbcb64b7f11c05d6bc96
14 endif
15 ifeq ($(PKG_VERSION),2.6.1)
16 PKG_MD5SUM:=11cf6d3fc86dbe0890b8d00372eb6286
17 endif
18 ifeq ($(PKG_VERSION),2.7)
19 PKG_MD5SUM:=065c5952b439deba40083ccd67bcc8f7
20 endif
21
22 PKG_SOURCE_URL:=@GNU/glibc/
23 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
24
25 PATCH_DIR:=./patches/$(PKG_VERSION)
26
27 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
28 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
29
30 override CONFIG_AUTOREBUILD=
31
32 include $(INCLUDE_DIR)/host-build.mk
33
34 STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.glibc_built
35 STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_installed
36
37 PKG_BUILD_DIR1:=$(PKG_BUILD_DIR)-initial
38 PKG_BUILD_DIR2:=$(PKG_BUILD_DIR)-final
39
40 GLIBC_ADD_ONS+=nptl,
41
42 ifneq ($(CONFIG_GLIBC_PORTS),)
43 GLIBC_ADD_ONS+=ports,
44 define Build/Prepare/ports
45 ln -snf ../glibc-ports $(PKG_BUILD_DIR)/ports
46 endef
47 endif
48
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))
52
53 GLIBC_CONFIGURE:= \
54 BUILD_CC="$(HOSTCC)" \
55 $(TARGET_CONFIGURE_OPTS) \
56 CFLAGS="$(GLIBC_CFLAGS)" \
57 libc_cv_forced_unwind=yes \
58 libc_cv_c_cleanup=yes \
59 libc_cv_386_tls=yes \
60 $(PKG_BUILD_DIR)/configure \
61 --prefix=/usr \
62 --build=$(GNU_HOST_NAME) \
63 --host=$(REAL_GNU_TARGET_NAME) \
64 --with-headers="$(TOOLCHAIN_DIR)/usr/include" \
65 --disable-debug \
66 --disable-profile \
67 --enable-add-ons="$(GLIBC_ADD_ONS)" \
68 --without-gd \
69 --without-cvs \
70
71 ifeq ($(CONFIG_SOFT_FLOAT),)
72 GLIBC_CONFIGURE+= \
73 --with-fp
74 else
75 GLIBC_CONFIGURE+= \
76 --without-fp
77 endif
78
79 GLIBC_CONFIGURE_STAGE1:= \
80 $(GLIBC_CONFIGURE) \
81 --disable-sanity-checks \
82 --enable-hacker-mode \
83
84 GLIBC_CONFIGURE_STAGE2:= \
85 $(GLIBC_CONFIGURE) \
86
87 GLIBC_MAKE:= \
88 $(MAKE) \
89
90
91 define Build/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
96 endef
97
98 define Stage1/Configure
99 mkdir -p $(PKG_BUILD_DIR1)
100 ( cd $(PKG_BUILD_DIR1); rm -f config.cache; \
101 $(GLIBC_CONFIGURE_STAGE1) \
102 );
103 endef
104
105 define Stage1/Compile
106 endef
107
108 define Stage1/Install
109 $(GLIBC_MAKE) -C $(PKG_BUILD_DIR1) \
110 CFLAGS="-DBOOTSTRAP_GCC" \
111 cross-compiling=yes \
112 install_root="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
113 install-headers
114 [ -f $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/include/bits/stdio_lim.h ] || \
115 $(CP) $(PKG_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
119 endef
120
121 define Stage2/Configure
122 mkdir -p $(PKG_BUILD_DIR2)
123 ( cd $(PKG_BUILD_DIR2); rm -f config.cache; \
124 $(GLIBC_CONFIGURE_STAGE2) \
125 );
126 endef
127
128 define Stage2/Compile
129 $(GLIBC_MAKE) -C $(PKG_BUILD_DIR2) all
130 endef
131
132 define Stage2/Install
133 $(GLIBC_MAKE) -C $(PKG_BUILD_DIR2) \
134 install_root="$(TOOLCHAIN_DIR)" \
135 install
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 ; \
141 fi \
142 done \
143 done \
144 )
145 endef
146
147 define Build/Prepare
148 $(call Build/SetToolchainInfo)
149 $(call Build/Prepare/Default)
150 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
151 $(call Build/Prepare/ports)
152 $(call Stage1/Configure)
153 $(call Stage1/Compile)
154 $(call Stage1/Install)
155 endef
156
157 define Build/Configure
158 endef
159
160 define Build/Compile
161 $(call Stage2/Configure)
162 $(call Stage2/Compile)
163 $(call Stage2/Install)
164 endef
165
166 define Build/Install
167 endef
168
169 define Build/Clean
170 rm -rf \
171 $(PKG_BUILD_DIR) \
172 $(PKG_BUILD_DIR1) \
173 $(PKG_BUILD_DIR2) \
174 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
175 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
176 endef
177
178 $(eval $(call HostBuild))
This page took 0.045834 seconds and 5 git commands to generate.