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