tools/bison: update to version 3.2
[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 PKG_NAME:=glibc
10 PKG_VERSION:=2.27
11
12 PKG_SOURCE_PROTO:=git
13 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
14 PKG_SOURCE_VERSION:=77b4b8231e77702cfaceeac04f5a556f58573565
15 PKG_MIRROR_HASH:=b5ec1cf3d63cbf1c20af07f3c289cb14a077ee9fcb2139047ac3ec80dd5194f9
16 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
18
19 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
20 CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
21 PATCH_DIR:=$(PATH_PREFIX)/patches
22
23 include $(INCLUDE_DIR)/toolchain-build.mk
24
25 HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
26 HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
27 HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
28 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed
29
30 ifeq ($(ARCH),mips64)
31 ifdef CONFIG_MIPS64_ABI_N64
32 TARGET_CFLAGS += -mabi=64
33 endif
34 ifdef CONFIG_MIPS64_ABI_N32
35 TARGET_CFLAGS += -mabi=n32
36 endif
37 ifdef CONFIG_MIPS64_ABI_O32
38 TARGET_CFLAGS += -mabi=32
39 endif
40 endif
41
42
43 # -Os miscompiles w. 2.24 gcc5/gcc6
44 # only -O2 tested by upstream changeset
45 # "Optimize i386 syscall inlining for GCC 5"
46 GLIBC_CONFIGURE:= \
47 unset LD_LIBRARY_PATH; \
48 BUILD_CC="$(HOSTCC)" \
49 $(TARGET_CONFIGURE_OPTS) \
50 CFLAGS="-O2 $(filter-out -Os,$(call qstrip,$(TARGET_CFLAGS)))" \
51 libc_cv_slibdir="/lib" \
52 use_ldconfig=no \
53 $(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \
54 --prefix= \
55 --build=$(GNU_HOST_NAME) \
56 --host=$(REAL_GNU_TARGET_NAME) \
57 --with-headers=$(TOOLCHAIN_DIR)/include \
58 --disable-profile \
59 --disable-werror \
60 --without-gd \
61 --without-cvs \
62 --enable-add-ons \
63 --$(if $(CONFIG_SOFT_FLOAT),without,with)-fp
64
65 export libc_cv_ssp=no
66 export libc_cv_ssp_strong=no
67 export ac_cv_header_cpuid_h=yes
68 export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
69
70 define Host/SetToolchainInfo
71 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
72 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
73 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
74 $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
75 endef
76
77 define Host/Configure
78 [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
79 cd $(HOST_BUILD_DIR)/; \
80 autoconf --force && \
81 touch $(HOST_BUILD_DIR)/.autoconf; \
82 }
83 mkdir -p $(CUR_BUILD_DIR)
84 ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
85 $(GLIBC_CONFIGURE) \
86 );
87 endef
88
89 define Host/Prepare
90 $(call Host/Prepare/Default)
91 ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
92 endef
93
94 define Host/Clean
95 rm -rf $(CUR_BUILD_DIR)* \
96 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
97 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
98 endef