[package] base-files: Use -h instead of deprecated -L for symlink check
[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_TRUNK),)
40 PKG_SOURCE_URL:=svn://svn.eglibc.org/trunk
41 endif
42
43 PATCH_DIR:=./patches/$(PKG_VERSION)
44
45 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
46
47 include $(INCLUDE_DIR)/toolchain-build.mk
48
49 HOST_STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.eglibc_built
50 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.eglibc_installed
51
52 HOST_BUILD_DIR1:=$(HOST_BUILD_DIR)-initial
53 HOST_BUILD_DIR2:=$(HOST_BUILD_DIR)-final
54
55 # XXX: {e,}glibc does not build w/ -Os
56 # http://sourceware.org/bugzilla/show_bug.cgi?id=5203
57 EGLIBC_CFLAGS:=$(subst -Os,-O2,$(TARGET_CFLAGS))
58
59 EGLIBC_CONFIGURE:= \
60 BUILD_CC="$(HOSTCC)" \
61 $(TARGET_CONFIGURE_OPTS) \
62 CFLAGS="$(EGLIBC_CFLAGS)" \
63 libc_cv_slibdir="/lib" \
64 $(HOST_BUILD_DIR)/libc/configure \
65 --prefix= \
66 --build=$(GNU_HOST_NAME) \
67 --host=$(REAL_GNU_TARGET_NAME) \
68 --with-headers=$(TOOLCHAIN_DIR)/include \
69 --disable-profile \
70 --without-gd \
71 --without-cvs \
72 --enable-add-ons \
73
74 ifeq ($(CONFIG_SOFT_FLOAT),)
75 EGLIBC_CONFIGURE+= \
76 --with-fp
77 else
78 EGLIBC_CONFIGURE+= \
79 --without-fp
80 endif
81
82 EGLIBC_MAKE:= \
83 $(MAKE) \
84
85 export libc_cv_ssp=no
86
87 define Host/SetToolchainInfo
88 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
89 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk
90 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
91 $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
92 endef
93
94 define Stage1/Configure
95 mkdir -p $(HOST_BUILD_DIR1)
96 $(CP) $(HOST_BUILD_DIR)/libc/option-groups.config $(HOST_BUILD_DIR1)/
97 ( cd $(HOST_BUILD_DIR1); rm -f config.cache; \
98 $(EGLIBC_CONFIGURE) \
99 );
100 endef
101
102 define Stage1/Compile
103 endef
104
105 define Stage1/Install
106 mkdir -p $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/{include,lib}
107 $(EGLIBC_MAKE) -C $(HOST_BUILD_DIR1) \
108 install_root="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
109 install-bootstrap-headers=yes \
110 install-headers
111 $(EGLIBC_MAKE) -C $(HOST_BUILD_DIR1) \
112 csu/subdir_lib
113 ( cd $(HOST_BUILD_DIR1); \
114 $(CP) csu/crt1.o csu/crti.o csu/crtn.o $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/lib/ \
115 )
116 $(TARGET_CC) -nostdlib -nostartfiles -shared -x c /dev/null \
117 -o $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/lib/libc.so
118 endef
119
120 define Stage2/Configure
121 mkdir -p $(HOST_BUILD_DIR2)
122 $(CP) $(HOST_BUILD_DIR)/libc/option-groups.config $(HOST_BUILD_DIR2)/
123 ( cd $(HOST_BUILD_DIR2); rm -f config.cache; \
124 $(EGLIBC_CONFIGURE) \
125 );
126 endef
127
128 define Stage2/Compile
129 $(EGLIBC_MAKE) -C $(HOST_BUILD_DIR2) all
130 endef
131
132 define Stage2/Install
133 $(EGLIBC_MAKE) -C $(HOST_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 Host/Prepare
148 $(call Host/SetToolchainInfo)
149 $(call Host/Prepare/Default)
150 ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
151 $(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults
152 grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(HOST_BUILD_DIR)/libc/option-groups.config
153 ln -sf ../ports $(HOST_BUILD_DIR)/libc/
154 ( cd $(HOST_BUILD_DIR)/libc; autoconf --force )
155 $(call Stage1/Configure)
156 $(call Stage1/Compile)
157 $(call Stage1/Install)
158 endef
159
160 define Host/Configure
161 endef
162
163 define Host/Compile
164 $(call Stage2/Configure)
165 $(call Stage2/Compile)
166 $(call Stage2/Install)
167 endef
168
169 define Host/Install
170 endef
171
172 define Host/Clean
173 rm -rf $(HOST_BUILD_DIR) $(HOST_BUILD_DIR1) $(HOST_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.044204 seconds and 5 git commands to generate.