common.mk 3.1 KB

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