2 # Copyright (C) 2006-2020 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
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
20 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
21 CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
22 PATCH_DIR:=$(PATH_PREFIX)/patches
24 include $(INCLUDE_DIR)/toolchain-build.mk
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
32 ifdef CONFIG_MIPS64_ABI_N64
33 TARGET_CFLAGS += -mabi=64
35 ifdef CONFIG_MIPS64_ABI_N32
36 TARGET_CFLAGS += -mabi=n32
38 ifdef CONFIG_MIPS64_ABI_O32
39 TARGET_CFLAGS += -mabi=32
43 # -Os miscompiles w. 2.24 gcc5/gcc6
44 # only -O2 tested by upstream changeset
45 # "Optimize i386 syscall inlining for GCC 5"
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" \
53 $(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \
55 --build=$(GNU_HOST_NAME) \
56 --host=$(REAL_GNU_TARGET_NAME) \
57 --with-headers=$(TOOLCHAIN_DIR)/include \
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
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
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
81 [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
82 cd $(HOST_BUILD_DIR)/; \
84 touch $(HOST_BUILD_DIR)/.autoconf; \
86 mkdir -p $(CUR_BUILD_DIR)
87 ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
93 $(call Host/Prepare/Default)
94 ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
98 rm -rf $(CUR_BUILD_DIR)* \
99 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
100 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)