2 # Copyright (C) 2006-2011 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_2_14
),)
25 PKG_SOURCE_URL
:=svn
://svn.eglibc.org
/branches
/eglibc-2_14
27 ifneq ($(CONFIG_EGLIBC_VERSION_TRUNK
),)
28 PKG_SOURCE_URL
:=svn
://svn.eglibc.org
/trunk
31 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)
33 HOST_BUILD_DIR
:=$(BUILD_DIR_TOOLCHAIN
)/$(PKG_SOURCE_SUBDIR
)
35 include $(INCLUDE_DIR
)/toolchain-build.mk
37 HOST_STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.eglibc_built
38 HOST_STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.eglibc_installed
40 HOST_BUILD_DIR1
:=$(HOST_BUILD_DIR
)-initial
41 HOST_BUILD_DIR2
:=$(HOST_BUILD_DIR
)-final
47 BUILD_CC
="$(HOSTCC)" \
48 $(TARGET_CONFIGURE_OPTS
) \
49 CFLAGS
="$(EGLIBC_CFLAGS)" \
50 libc_cv_slibdir
="/lib" \
52 $(HOST_BUILD_DIR
)/libc
/configure \
54 --build
=$(GNU_HOST_NAME
) \
55 --host
=$(REAL_GNU_TARGET_NAME
) \
56 --with-headers
=$(TOOLCHAIN_DIR
)/include \
62 ifeq ($(CONFIG_SOFT_FLOAT
),)
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
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
; \
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 \
99 $(EGLIBC_MAKE
) -C
$(HOST_BUILD_DIR1
) \
101 ( cd
$(HOST_BUILD_DIR1
); \
102 $(CP
) csu
/crt1.o csu
/crti.o csu
/crtn.o
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/lib
/ \
104 $(TARGET_CC
) -nostdlib
-nostartfiles
-shared
-x c
/dev
/null \
105 -o
$(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
/lib
/libc.so
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
) \
116 define Stage2
/Compile
117 $(EGLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) all
120 define Stage2
/Install
121 $(EGLIBC_MAKE
) -C
$(HOST_BUILD_DIR2
) \
122 install_root
="$(TOOLCHAIN_DIR)" \
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 ; \
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
)
148 define Host
/Configure
152 $(call Stage2
/Configure
)
153 $(call Stage2
/Compile
)
154 $(call Stage2
/Install
)
161 rm -rf
$(HOST_BUILD_DIR
) $(HOST_BUILD_DIR1
) $(HOST_BUILD_DIR2
) \
162 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev \
163 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
166 $(eval
$(call HostBuild
))