build: store SourceDateEpoch in manifest
[openwrt/.git] / toolchain / glibc / common.mk
1 #
2 # Copyright (C) 2006-2020 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.31
11 PKG_RELEASE:=1
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
15 PKG_SOURCE_VERSION:=6fdf971c9dbf7dac9bea552113fe4694015bbc4d
16 PKG_MIRROR_HASH:=80998023c237bd0eaa38554e18536d8f66223e97fc5ade015a2d2aadf587d1f0
17 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
19
20 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
21 CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
22 PATCH_DIR:=$(PATH_PREFIX)/patches
23
24 include $(INCLUDE_DIR)/toolchain-build.mk
25
26 HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
27 HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
28 HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
29 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed
30
31 ifeq ($(ARCH),mips64)
32   ifdef CONFIG_MIPS64_ABI_N64
33     TARGET_CFLAGS += -mabi=64
34   endif
35   ifdef CONFIG_MIPS64_ABI_N32
36     TARGET_CFLAGS += -mabi=n32
37   endif
38   ifdef CONFIG_MIPS64_ABI_O32
39     TARGET_CFLAGS += -mabi=32
40   endif
41 endif
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                   $(if $(CONFIG_PKG_CC_STACKPROTECTOR_REGULAR),--enable-stack-protector=yes) \
65                   $(if $(CONFIG_PKG_CC_STACKPROTECTOR_STRONG),--enable-stack-protector=strong) \
66                 --enable-kernel=4.14.0
67
68 export libc_cv_ssp=no
69 export libc_cv_ssp_strong=no
70 export ac_cv_header_cpuid_h=yes
71 export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
72
73 define Host/SetToolchainInfo
74         $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
75         $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
76         $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
77         $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
78 endef
79
80 define Host/Configure
81         [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
82                 cd $(HOST_BUILD_DIR)/; \
83                 autoconf --force && \
84                 touch $(HOST_BUILD_DIR)/.autoconf; \
85         }
86         mkdir -p $(CUR_BUILD_DIR)
87         ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
88                 $(GLIBC_CONFIGURE) \
89         );
90 endef
91
92 define Host/Prepare
93         $(call Host/Prepare/Default)
94         ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
95 endef
96
97 define Host/Clean
98         rm -rf $(CUR_BUILD_DIR)* \
99                 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
100                 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
101 endef