common.mk 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. PKG_NAME:=glibc
  9. PKG_VERSION:=2.27
  10. PKG_SOURCE_PROTO:=git
  11. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  12. PKG_SOURCE_VERSION:=d8eee5ef553350364eff1dce9d143fb845c60615
  13. PKG_MIRROR_HASH:=423709d53b28ed78c772061ac312aa630bfaae14e8ce87a8f22109ca38351654
  14. PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  16. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
  17. CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
  18. PATCH_DIR:=$(PATH_PREFIX)/patches
  19. include $(INCLUDE_DIR)/toolchain-build.mk
  20. HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
  21. HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
  22. HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
  23. HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed
  24. ifeq ($(ARCH),mips64)
  25. ifdef CONFIG_MIPS64_ABI_N64
  26. TARGET_CFLAGS += -mabi=64
  27. endif
  28. ifdef CONFIG_MIPS64_ABI_N32
  29. TARGET_CFLAGS += -mabi=n32
  30. endif
  31. ifdef CONFIG_MIPS64_ABI_O32
  32. TARGET_CFLAGS += -mabi=32
  33. endif
  34. endif
  35. # -Os miscompiles w. 2.24 gcc5/gcc6
  36. # only -O2 tested by upstream changeset
  37. # "Optimize i386 syscall inlining for GCC 5"
  38. GLIBC_CONFIGURE:= \
  39. unset LD_LIBRARY_PATH; \
  40. BUILD_CC="$(HOSTCC)" \
  41. $(TARGET_CONFIGURE_OPTS) \
  42. CFLAGS="-O2 $(filter-out -Os,$(call qstrip,$(TARGET_CFLAGS)))" \
  43. libc_cv_slibdir="/lib" \
  44. use_ldconfig=no \
  45. $(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \
  46. --prefix= \
  47. --build=$(GNU_HOST_NAME) \
  48. --host=$(REAL_GNU_TARGET_NAME) \
  49. --with-headers=$(TOOLCHAIN_DIR)/include \
  50. --disable-profile \
  51. --disable-werror \
  52. --without-gd \
  53. --without-cvs \
  54. --enable-add-ons \
  55. --$(if $(CONFIG_SOFT_FLOAT),without,with)-fp
  56. export libc_cv_ssp=no
  57. export libc_cv_ssp_strong=no
  58. export ac_cv_header_cpuid_h=yes
  59. export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
  60. define Host/SetToolchainInfo
  61. $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
  62. $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
  63. $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
  64. $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
  65. endef
  66. define Host/Configure
  67. [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
  68. cd $(HOST_BUILD_DIR)/; \
  69. autoconf --force && \
  70. touch $(HOST_BUILD_DIR)/.autoconf; \
  71. }
  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