common.mk 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.37
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  13. PKG_SOURCE_VERSION:=7c32cb7dd88cf100b0b412163896e30aa2ee671a
  14. PKG_MIRROR_HASH:=92afa3672e4af0c3ba9d360e9aaac60c094a0aad9334ef78a1fd2ee49f5e1b64
  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.15.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. mkdir -p $(CUR_BUILD_DIR)
  73. ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
  74. $(GLIBC_CONFIGURE) \
  75. );
  76. endef
  77. define Host/Prepare
  78. $(call Host/Prepare/Default)
  79. ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  80. endef
  81. define Host/Clean
  82. rm -rf $(CUR_BUILD_DIR)* \
  83. $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
  84. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  85. endef