11de291ab874f66c38942d21ab3a0f64a4bda534
[openwrt/openwrt.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 MD5SUM_2.24 = 5c5a6f1ac6fce866e37643c41ac116f3
20 REVISION_2.24 = 8c716c2
21
22
23 PKG_NAME:=glibc
24 PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
25
26 PKG_REVISION:=$(REVISION_$(PKG_VERSION))
27 PKG_MIRROR_MD5SUM:=$(MD5SUM_$(PKG_VERSION))
28
29 PKG_SOURCE_PROTO:=git
30 PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git
31 PKG_SOURCE_VERSION:=$(PKG_REVISION)
32 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REVISION)
33 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
34
35 GLIBC_PATH:=
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
62 # -Os miscompiles w. 2.24 gcc5/gcc6
63 # only -O2 tested by upstream changeset
64 # "Optimize i386 syscall inlining for GCC 5"
65 GLIBC_CONFIGURE:= \
66 BUILD_CC="$(HOSTCC)" \
67 $(TARGET_CONFIGURE_OPTS) \
68 CFLAGS="-O2 $(filter-out -Os,$(call qstrip,$(TARGET_CFLAGS)))" \
69 libc_cv_slibdir="/lib" \
70 use_ldconfig=no \
71 $(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \
72 --prefix= \
73 --build=$(GNU_HOST_NAME) \
74 --host=$(REAL_GNU_TARGET_NAME) \
75 --with-headers=$(TOOLCHAIN_DIR)/include \
76 --disable-profile \
77 --disable-werror \
78 --without-gd \
79 --without-cvs \
80 --enable-add-ons \
81 --$(if $(CONFIG_SOFT_FLOAT),without,with)-fp
82
83 export libc_cv_ssp=no
84 export libc_cv_ssp_strong=no
85 export ac_cv_header_cpuid_h=yes
86 export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
87
88 define Host/SetToolchainInfo
89 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
90 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
91 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
92 $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
93 endef
94
95 define Host/Configure
96 [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
97 cd $(HOST_BUILD_DIR)/$(GLIBC_PATH); \
98 autoconf --force && \
99 touch $(HOST_BUILD_DIR)/.autoconf; \
100 }
101 mkdir -p $(CUR_BUILD_DIR)
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 endef
111
112 define Host/Clean
113 rm -rf $(CUR_BUILD_DIR)* \
114 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
115 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
116 endef