1
0

common.mk 2.9 KB

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