common.mk 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #
  2. # Copyright (C) 2006-2011 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:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
  10. PKG_REVISION:=$(call qstrip,$(CONFIG_GLIBC_REVISION))
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git
  13. PKG_SOURCE_VERSION:=$(PKG_REVISION)
  14. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REVISION)
  15. PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
  16. GLIBC_PATH:=
  17. ifneq ($(CONFIG_EGLIBC_VERSION_2_19),)
  18. GLIBC_PATH:=libc/
  19. PKG_SOURCE_PROTO:=svn
  20. PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
  21. PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_19
  22. endif
  23. PATCH_DIR:=$(PATH_PREFIX)/patches/$(PKG_VERSION)
  24. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
  25. CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
  26. include $(INCLUDE_DIR)/toolchain-build.mk
  27. HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
  28. HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
  29. HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
  30. HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed
  31. ifeq ($(ARCH),mips64)
  32. ifdef CONFIG_MIPS64_ABI_N64
  33. TARGET_CFLAGS += -mabi=64
  34. endif
  35. ifdef CONFIG_MIPS64_ABI_N32
  36. TARGET_CFLAGS += -mabi=n32
  37. endif
  38. ifdef CONFIG_MIPS64_ABI_O32
  39. TARGET_CFLAGS += -mabi=32
  40. endif
  41. endif
  42. GLIBC_CONFIGURE:= \
  43. BUILD_CC="$(HOSTCC)" \
  44. $(TARGET_CONFIGURE_OPTS) \
  45. CFLAGS="$(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 ac_cv_header_cpuid_h=yes
  61. export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
  62. define Host/SetToolchainInfo
  63. $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
  64. ifneq ($(CONFIG_GLIBC_VERSION_2_21),)
  65. $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
  66. else
  67. $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk
  68. endif
  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. [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
  74. cd $(HOST_BUILD_DIR)/$(GLIBC_PATH); \
  75. autoconf --force && \
  76. touch $(HOST_BUILD_DIR)/.autoconf; \
  77. }
  78. mkdir -p $(CUR_BUILD_DIR)
  79. grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(CUR_BUILD_DIR)/option-groups.config
  80. ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
  81. $(GLIBC_CONFIGURE) \
  82. );
  83. endef
  84. define Host/Prepare
  85. $(call Host/Prepare/Default)
  86. ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  87. ifeq ($(CONFIG_GLIBC_VERSION_2_21),)
  88. $(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults
  89. endif
  90. endef
  91. define Host/Clean
  92. rm -rf $(CUR_BUILD_DIR)* \
  93. $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
  94. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  95. endef