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