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