common.mk 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. MD5SUM_2.19 = 42dad4edd3bcb38006d13b5640b00b38
  9. REVISION_2.19 = 25243
  10. MD5SUM_2.21 = 76050a65c444d58b5c4aa0d6034736ed
  11. REVISION_2.21 = 16d0a0c
  12. PKG_NAME:=glibc
  13. PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
  14. PKG_REVISION:=$(REVISION_$(PKG_VERSION))
  15. PKG_MIRROR_MD5SUM:=$(MD5SUM_$(PKG_VERSION))
  16. PKG_SOURCE_PROTO:=git
  17. PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git
  18. PKG_SOURCE_VERSION:=$(PKG_REVISION)
  19. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REVISION)
  20. PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
  21. GLIBC_PATH:=
  22. ifneq ($(CONFIG_EGLIBC_VERSION_2_19),)
  23. GLIBC_PATH:=libc/
  24. PKG_SOURCE_PROTO:=svn
  25. PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
  26. PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_19
  27. endif
  28. PATCH_DIR:=$(PATH_PREFIX)/patches/$(PKG_VERSION)
  29. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR)
  30. CUR_BUILD_DIR:=$(HOST_BUILD_DIR)-$(VARIANT)
  31. include $(INCLUDE_DIR)/toolchain-build.mk
  32. HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
  33. HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
  34. HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
  35. HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed
  36. ifeq ($(ARCH),mips64)
  37. ifdef CONFIG_MIPS64_ABI_N64
  38. TARGET_CFLAGS += -mabi=64
  39. endif
  40. ifdef CONFIG_MIPS64_ABI_N32
  41. TARGET_CFLAGS += -mabi=n32
  42. endif
  43. ifdef CONFIG_MIPS64_ABI_O32
  44. TARGET_CFLAGS += -mabi=32
  45. endif
  46. endif
  47. GLIBC_CONFIGURE:= \
  48. BUILD_CC="$(HOSTCC)" \
  49. $(TARGET_CONFIGURE_OPTS) \
  50. CFLAGS="$(TARGET_CFLAGS)" \
  51. libc_cv_slibdir="/lib" \
  52. use_ldconfig=no \
  53. $(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \
  54. --prefix= \
  55. --build=$(GNU_HOST_NAME) \
  56. --host=$(REAL_GNU_TARGET_NAME) \
  57. --with-headers=$(TOOLCHAIN_DIR)/include \
  58. --disable-profile \
  59. --disable-werror \
  60. --without-gd \
  61. --without-cvs \
  62. --enable-add-ons \
  63. --$(if $(CONFIG_SOFT_FLOAT),without,with)-fp
  64. export libc_cv_ssp=no
  65. export ac_cv_header_cpuid_h=yes
  66. export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
  67. define Host/SetToolchainInfo
  68. $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
  69. ifneq ($(CONFIG_GLIBC_VERSION_2_21),)
  70. $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
  71. else
  72. $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk
  73. endif
  74. $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
  75. $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
  76. endef
  77. define Host/Configure
  78. [ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
  79. cd $(HOST_BUILD_DIR)/$(GLIBC_PATH); \
  80. autoconf --force && \
  81. touch $(HOST_BUILD_DIR)/.autoconf; \
  82. }
  83. mkdir -p $(CUR_BUILD_DIR)
  84. grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(CUR_BUILD_DIR)/option-groups.config
  85. ( cd $(CUR_BUILD_DIR); rm -f config.cache; \
  86. $(GLIBC_CONFIGURE) \
  87. );
  88. endef
  89. define Host/Prepare
  90. $(call Host/Prepare/Default)
  91. ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  92. ifeq ($(CONFIG_GLIBC_VERSION_2_21),)
  93. $(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults
  94. endif
  95. endef
  96. define Host/Clean
  97. rm -rf $(CUR_BUILD_DIR)* \
  98. $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev \
  99. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  100. endef