CC: toolchain: use latest glibc 2.21 revision
[openwrt/svn-archive/archive.git] / toolchain / glibc / 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
10 MD5SUM_2.19 = 42dad4edd3bcb38006d13b5640b00b38
11 REVISION_2.19 = 25243
12
13 MD5SUM_2.21 = 76050a65c444d58b5c4aa0d6034736ed
14 REVISION_2.21 = 16d0a0c
15
16
17 PKG_NAME:=glibc
18 PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
19
20 PKG_REVISION:=$(REVISION_$(PKG_VERSION))
21 PKG_MIRROR_MD5SUM:=$(MD5SUM_$(PKG_VERSION))
22
23 PKG_SOURCE_PROTO:=git
24 PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git
25 PKG_SOURCE_VERSION:=$(PKG_REVISION)
26 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REVISION)
27 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
28
29 GLIBC_PATH:=
30 ifneq ($(CONFIG_EGLIBC_VERSION_2_19),)
31 GLIBC_PATH:=libc/
32 PKG_SOURCE_PROTO:=svn
33 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
34 PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_19
35 endif
36
37 PATCH_DIR:=$(PATH_PREFIX)/patches/$(PKG_VERSION)
38
39 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
40 CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
41
42 include $(INCLUDE_DIR)/toolchain-build.mk
43
44 HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
45 HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
46 HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
47 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed
48
49 ifeq ($(ARCH),mips64)
50 ifdef CONFIG_MIPS64_ABI_N64
51 TARGET_CFLAGS += -mabi=64
52 endif
53 ifdef CONFIG_MIPS64_ABI_N32
54 TARGET_CFLAGS += -mabi=n32
55 endif
56 ifdef CONFIG_MIPS64_ABI_O32
57 TARGET_CFLAGS += -mabi=32
58 endif
59 endif
60
61 GLIBC_CONFIGURE:= \
62 BUILD_CC="$(HOSTCC)" \
63 $(TARGET_CONFIGURE_OPTS) \
64 CFLAGS="$(TARGET_CFLAGS)" \
65 libc_cv_slibdir="/lib" \
66 use_ldconfig=no \
67 $(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \
68 --prefix= \
69 --build=$(GNU_HOST_NAME) \
70 --host=$(REAL_GNU_TARGET_NAME) \
71 --with-headers=$(TOOLCHAIN_DIR)/include \
72 --disable-profile \
73 --disable-werror \
74 --without-gd \
75 --without-cvs \
76 --enable-add-ons \
77 --$(if $(CONFIG_SOFT_FLOAT),without,with)-fp
78
79 export libc_cv_ssp=no
80 export ac_cv_header_cpuid_h=yes
81 export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
82
83 define Host/SetToolchainInfo
84 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
85 ifneq ($(CONFIG_GLIBC_VERSION_2_21),)
86 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
87 else
88 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk
89 endif
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 Host/Configure
95 [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
96 cd $(HOST_BUILD_DIR)/$(GLIBC_PATH); \
97 autoconf --force && \
98 touch $(HOST_BUILD_DIR)/.autoconf; \
99 }
100 mkdir -p $(CUR_BUILD_DIR)
101 grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(CUR_BUILD_DIR)/option-groups.config
102 ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
103 $(GLIBC_CONFIGURE) \
104 );
105 endef
106
107 define Host/Prepare
108 $(call Host/Prepare/Default)
109 ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
110 ifeq ($(CONFIG_GLIBC_VERSION_2_21),)
111 $(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults
112 endif
113 endef
114
115 define Host/Clean
116 rm -rf $(CUR_BUILD_DIR)* \
117 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
118 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
119 endef