2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
10 PKG_VERSION
:=$(call qstrip
,$(CONFIG_EGLIBC_VERSION
))
11 PKG_REVISION
:=$(call qstrip
,$(CONFIG_EGLIBC_REVISION
))
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
18 ifneq ($(CONFIG_EGLIBC_VERSION_2_12
),)
19 PKG_SOURCE_URL
:=svn
://svn.eglibc.org
/branches
/eglibc-2_12
21 ifneq ($(CONFIG_EGLIBC_VERSION_2_13
),)
22 PKG_SOURCE_URL
:=svn
://svn.eglibc.org
/branches
/eglibc-2_13
24 ifneq ($(CONFIG_EGLIBC_VERSION_TRUNK
),)
25 PKG_SOURCE_URL
:=svn
://svn.eglibc.org
/trunk
28 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)
30 HOST_BUILD_DIR
:=$(BUILD_DIR_TOOLCHAIN
)/$(PKG_SOURCE_SUBDIR
)
32 include $(INCLUDE_DIR
)/toolchain-build.mk
34 HOST_STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.eglibc_built
35 HOST_STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.eglibc_installed
37 HOST_BUILD_DIR1
:=$(HOST_BUILD_DIR
)-initial
38 HOST_BUILD_DIR2
:=$(HOST_BUILD_DIR
)-final
44 BUILD_CC
="$(HOSTCC)" \
45 $(TARGET_CONFIGURE_OPTS
) \
46 CFLAGS
="$(EGLIBC_CFLAGS)" \
47 libc_cv_slibdir
="/lib" \
49 $(HOST_BUILD_DIR
)/libc
/configure \
51 --build
=$(GNU_HOST_NAME
) \
52 --host
=$(REAL_GNU_TARGET_NAME
) \
53 --with-headers
=$(TOOLCHAIN_DIR
)/include \
59 ifeq ($(CONFIG_SOFT_FLOAT
),)
72 define Host
/SetToolchainInfo
73 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
74 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR
)/info.mk
75 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
76 $(SED
) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
79 define Stage1
/Configure
80 mkdir
-p
$(HOST_BUILD_DIR1
)
81 $(CP
) $(HOST_BUILD_DIR
)/libc
/option-groups.config
$(HOST_BUILD_DIR1
)/
82 ( cd
$(HOST_BUILD_DIR1
); rm -f config.cache
; \
91 mkdir
-p
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/{include,lib
}
92 $(EGLIBC_MAKE
) -C
$(HOST_BUILD_DIR1
) \
93 install_root
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
94 install-bootstrap-headers
=yes \
96 $(EGLIBC_MAKE
) -C
$(HOST_BUILD_DIR1
) \
98 ( cd
$(HOST_BUILD_DIR1
); \
99 $(CP
) csu
/crt1.o csu
/crti.o csu
/crtn.o
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/lib
/ \
101 $(TARGET_CC
) -nostdlib
-nostartfiles
-shared
-x c
/dev
/null \
102 -o
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/lib
/libc.so
105 define Stage2
/Configure
106 mkdir
-p
$(HOST_BUILD_DIR2
)
107 $(CP
) $(HOST_BUILD_DIR
)/libc
/option-groups.config
$(HOST_BUILD_DIR2
)/
108 ( cd
$(HOST_BUILD_DIR2
); rm -f config.cache
; \
109 $(EGLIBC_CONFIGURE
) \
113 define Stage2
/Compile
114 $(EGLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) all
117 define Stage2
/Install
118 $(EGLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) \
119 install_root
="$(TOOLCHAIN_DIR)" \
121 ( cd
$(TOOLCHAIN_DIR
) ; \
122 for d in lib usr
/lib
; do \
123 for f in libc.so libpthread.so libgcc_s.so
; do \
124 if
[ -f
$$$$d/$$$$f -a
! -L
$$$$d/$$$$f ] ; then \
125 $(SED
) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
133 $(call Host
/SetToolchainInfo
)
134 $(call Host
/Prepare
/Default
)
135 ln
-snf
$(PKG_SOURCE_SUBDIR
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
136 $(SED
) 's,y,n,' $(HOST_BUILD_DIR
)/libc
/option-groups.defaults
137 grep
'CONFIG_EGLIBC_OPTION_' $(TOPDIR
)/.config | sed
-e
"s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(HOST_BUILD_DIR
)/libc
/option-groups.config
138 ln
-sf ..
/ports
$(HOST_BUILD_DIR
)/libc
/
139 ( cd
$(HOST_BUILD_DIR
)/libc
; autoconf
--force )
140 $(call Stage1
/Configure
)
141 $(call Stage1
/Compile
)
142 $(call Stage1
/Install
)
145 define Host
/Configure
149 $(call Stage2
/Configure
)
150 $(call Stage2
/Compile
)
151 $(call Stage2
/Install
)
158 rm -rf
$(HOST_BUILD_DIR
) $(HOST_BUILD_DIR1
) $(HOST_BUILD_DIR2
) \
159 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev \
160 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
163 $(eval
$(call HostBuild
))