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