AA: eglibc: sync with trunk, delete old versions
[12.09/openwrt.git] / toolchain / eglibc / common.mk
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_15),)
19   PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_15
20 endif
21
22 PATCH_DIR:=$(PATH_PREFIX)/patches/$(PKG_VERSION)
23
24 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
25 CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
26
27 include $(INCLUDE_DIR)/toolchain-build.mk
28
29 HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
30 HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
31 HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
32 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.eglibc_$(VARIANT)_installed
33
34
35 EGLIBC_CONFIGURE:= \
36         BUILD_CC="$(HOSTCC)" \
37         $(TARGET_CONFIGURE_OPTS) \
38         CFLAGS="$(TARGET_CFLAGS)" \
39         libc_cv_slibdir="/lib" \
40         use_ldconfig=no \
41         $(HOST_BUILD_DIR)/libc/configure \
42                 --prefix= \
43                 --build=$(GNU_HOST_NAME) \
44                 --host=$(REAL_GNU_TARGET_NAME) \
45                 --with-headers=$(TOOLCHAIN_DIR)/include \
46                 --disable-profile \
47                 --without-gd \
48                 --without-cvs \
49                 --enable-add-ons \
50                 --$(if $(CONFIG_SOFT_FLOAT),without,with)-fp
51
52 export libc_cv_ssp=no
53 export ac_cv_header_cpuid_h=yes
54 export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
55
56 define Host/SetToolchainInfo
57         $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
58         $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk
59         $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
60         $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
61 endef
62
63 define Host/Configure
64         [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
65                 cd $(HOST_BUILD_DIR)/libc; \
66                 autoconf --force && \
67                 touch $(HOST_BUILD_DIR)/.autoconf; \
68         }
69         mkdir -p $(CUR_BUILD_DIR)
70         grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(CUR_BUILD_DIR)/option-groups.config
71         ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
72                 $(EGLIBC_CONFIGURE) \
73         );
74 endef
75
76 define Host/Prepare
77         $(call Host/Prepare/Default)
78         ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
79         $(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults
80 ifneq ($(CONFIG_EGLIBC_VERSION_2_17),y)
81         ln -sf ../ports $(HOST_BUILD_DIR)/libc/
82 endif
83 endef
84
85 define Host/Clean
86         rm -rf $(CUR_BUILD_DIR)* \
87                 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
88                 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
89 endef