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