暫無描述

Makefile 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #
  2. # Copyright (C) 2008 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=gcc
  10. PKG_VERSION:=4.6.3
  11. PKG_RELEASE:=1
  12. PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
  13. http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
  14. ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  16. PKG_MD5SUM:=773092fe5194353b02bb0110052a972e
  17. PKG_INSTALL:=1
  18. PKG_FIXUP:=libtool
  19. PKG_BUILD_PARALLEL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. SEP:=,
  22. TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
  23. define Package/gcc
  24. SECTION:=devel
  25. CATEGORY:=Development
  26. TITLE:=gcc
  27. MAINTAINER:=Christian Beier <cb@shoutrlabs.com>
  28. DEPENDS:= +binutils +libstdcpp
  29. endef
  30. define Package/gcc/description
  31. build a native toolchain for compiling on target
  32. endef
  33. STRIP:=$(STAGING_DIR_HOST)/bin/sstrip
  34. RSTRIP:= \
  35. NM="$(TARGET_CROSS)nm" \
  36. STRIP="$(STRIP) --strip-debug" \
  37. STRIP_KMOD="$(TARGET_CROSS)strip --strip-debug" \
  38. $(SCRIPT_DIR)/rstrip.sh
  39. define Build/Prepare
  40. $(PKG_UNPACK)
  41. # we have to download additional stuff before patching
  42. (cd $(PKG_BUILD_DIR) && ./contrib/download_prerequisites)
  43. $(Build/Patch)
  44. $(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(PKG_BUILD_DIR)/gcc/version.c
  45. $(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(PKG_BUILD_DIR)/gcc/version.c
  46. endef
  47. define Build/Configure
  48. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  49. SHELL="$(BASH)" \
  50. $(TARGET_CONFIGURE_OPTS) \
  51. $(PKG_BUILD_DIR)/configure \
  52. $(CONFIGURE_ARGS) \
  53. --build=$(GNU_HOST_NAME) \
  54. --host=$(REAL_GNU_TARGET_NAME) \
  55. --target=$(REAL_GNU_TARGET_NAME) \
  56. --enable-languages=$(TARGET_LANGUAGES) \
  57. --enable-shared \
  58. --disable-__cxa_atexit \
  59. --enable-target-optspace \
  60. --with-gnu-ld \
  61. --disable-nls \
  62. --disable-libmudflap \
  63. --disable-multilib \
  64. --disable-libgomp \
  65. --disable-libquadmath \
  66. --disable-libssp \
  67. --disable-decimal-float \
  68. --disable-libstdcxx-pch \
  69. --with-host-libstdcxx=-lstdc++ \
  70. --prefix=/usr \
  71. --libexecdir=/usr/lib \
  72. $(SOFT_FLOAT_CONFIG_OPTION) \
  73. $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
  74. $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
  75. --with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
  76. );
  77. endef
  78. define Build/Compile
  79. export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  80. DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
  81. endef
  82. define Package/gcc/install
  83. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  84. cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr
  85. cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
  86. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
  87. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
  88. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
  89. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
  90. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
  91. cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
  92. $(RM) $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/*.a
  93. cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  94. cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  95. cp -a $(TOOLCHAIN_DIR)/lib/uclibc_nonshared.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  96. endef
  97. $(eval $(call BuildPackage,gcc))