common.mk 2.9 KB

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