[toolchain] add support for gcc-4.4.2, add missing gcc-4.4.1 md5sum
[openwrt.git] / toolchain / eglibc / 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:=eglibc
10 PKG_VERSION:=$(call qstrip,$(CONFIG_EGLIBC_VERSION))
11 PKG_REVISION:=$(call qstrip,$(CONFIG_EGLIBC_REVISION))
12
13 PKG_SOURCE_PROTO:=svn
14 PKG_SOURCE_VERSION:=$(PKG_REVISION)
15 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REVISION)
16 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
17
18 ifeq ($(PKG_VERSION),2.6.1)
19 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_6
20 endif
21 ifeq ($(PKG_VERSION),2.7)
22 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_7
23 endif
24 ifeq ($(PKG_VERSION),2.8)
25 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_8
26 endif
27 ifeq ($(PKG_VERSION),2.9)
28 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_9
29 endif
30 ifeq ($(PKG_VERSION),2.10.1)
31 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_10
32 endif
33 ifeq ($(PKG_VERSION),trunk)
34 PKG_SOURCE_URL:=svn://svn.eglibc.org/trunk
35 endif
36
37 PATCH_DIR:=./patches/$(PKG_VERSION)
38
39 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
40
41 include $(INCLUDE_DIR)/toolchain-build.mk
42
43 HOST_STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.eglibc_built
44 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.eglibc_installed
45
46 HOST_BUILD_DIR1:=$(HOST_BUILD_DIR)-initial
47 HOST_BUILD_DIR2:=$(HOST_BUILD_DIR)-final
48
49 # XXX: {e,}glibc does not build w/ -Os
50 # http://sourceware.org/bugzilla/show_bug.cgi?id=5203
51 EGLIBC_CFLAGS:=$(subst -Os,-O2,$(TARGET_CFLAGS))
52
53 EGLIBC_CONFIGURE:= \
54 BUILD_CC="$(HOSTCC)" \
55 $(TARGET_CONFIGURE_OPTS) \
56 CFLAGS="$(EGLIBC_CFLAGS)" \
57 libc_cv_slibdir="/lib" \
58 $(HOST_BUILD_DIR)/libc/configure \
59 --prefix=/usr \
60 --build=$(GNU_HOST_NAME) \
61 --host=$(REAL_GNU_TARGET_NAME) \
62 --with-headers=$(TOOLCHAIN_DIR)/usr/include \
63 --disable-profile \
64 --without-gd \
65 --without-cvs \
66 --enable-add-ons \
67
68 ifeq ($(CONFIG_SOFT_FLOAT),)
69 EGLIBC_CONFIGURE+= \
70 --with-fp
71 else
72 EGLIBC_CONFIGURE+= \
73 --without-fp
74 endif
75
76 EGLIBC_MAKE:= \
77 $(MAKE) \
78
79
80 define Host/SetToolchainInfo
81 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
82 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk
83 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
84 $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
85 endef
86
87 define Stage1/Configure
88 mkdir -p $(HOST_BUILD_DIR1)
89 $(CP) $(HOST_BUILD_DIR)/libc/option-groups.config $(HOST_BUILD_DIR1)/
90 ( cd $(HOST_BUILD_DIR1); rm -f config.cache; \
91 $(EGLIBC_CONFIGURE) \
92 );
93 endef
94
95 define Stage1/Compile
96 endef
97
98 define Stage1/Install
99 mkdir -p $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/{include,lib}
100 $(EGLIBC_MAKE) -C $(HOST_BUILD_DIR1) \
101 install_root="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
102 install-bootstrap-headers=yes \
103 install-headers
104 $(EGLIBC_MAKE) -C $(HOST_BUILD_DIR1) \
105 csu/subdir_lib
106 ( cd $(HOST_BUILD_DIR1); \
107 $(CP) csu/crt1.o csu/crti.o csu/crtn.o $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/lib/ \
108 )
109 $(TARGET_CC) -nostdlib -nostartfiles -shared -x c /dev/null \
110 -o $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/usr/lib/libc.so
111 endef
112
113 define Stage2/Configure
114 mkdir -p $(HOST_BUILD_DIR2)
115 $(CP) $(HOST_BUILD_DIR)/libc/option-groups.config $(HOST_BUILD_DIR2)/
116 ( cd $(HOST_BUILD_DIR2); rm -f config.cache; \
117 $(EGLIBC_CONFIGURE) \
118 );
119 endef
120
121 define Stage2/Compile
122 $(EGLIBC_MAKE) -C $(HOST_BUILD_DIR2) all
123 endef
124
125 define Stage2/Install
126 $(EGLIBC_MAKE) -C $(HOST_BUILD_DIR2) \
127 install_root="$(TOOLCHAIN_DIR)" \
128 install
129 ( cd $(TOOLCHAIN_DIR) ; \
130 for d in lib usr/lib ; do \
131 for f in libc.so libpthread.so libgcc_s.so ; do \
132 if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
133 $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
134 fi \
135 done \
136 done \
137 )
138 endef
139
140 define Host/Prepare
141 $(call Host/SetToolchainInfo)
142 $(call Host/Prepare/Default)
143 ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
144 $(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults
145 grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(HOST_BUILD_DIR)/libc/option-groups.config
146 ln -sf ../ports $(HOST_BUILD_DIR)/libc/
147 ( cd $(HOST_BUILD_DIR)/libc; autoconf --force )
148 $(call Stage1/Configure)
149 $(call Stage1/Compile)
150 $(call Stage1/Install)
151 endef
152
153 define Host/Configure
154 endef
155
156 define Host/Compile
157 $(call Stage2/Configure)
158 $(call Stage2/Compile)
159 $(call Stage2/Install)
160 endef
161
162 define Host/Install
163 endef
164
165 define Host/Clean
166 rm -rf $(HOST_BUILD_DIR) $(HOST_BUILD_DIR1) $(HOST_BUILD_DIR2) \
167 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
168 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
169 endef
170
171 $(eval $(call HostBuild))
This page took 0.042463 seconds and 5 git commands to generate.