You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
3.8 KiB

  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.8.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:=7c60f24fab389f77af203d2516ee110f
  17. PKG_INSTALL:=1
  18. PKG_FIXUP:=libtool
  19. PKG_BUILD_PARALLEL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. TARGET_LANGUAGES:="c,c++"
  22. BUGURL=https://dev.openwrt.org/
  23. PKGVERSION=OpenWrt GCC $(PKG_VERSION)
  24. # not using sstrip here as this fucks up the .so's somehow
  25. STRIP:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip
  26. RSTRIP:= \
  27. NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \
  28. STRIP="$(STRIP)" \
  29. STRIP_KMOD="$(STRIP) --strip-debug" \
  30. $(SCRIPT_DIR)/rstrip.sh
  31. define Package/gcc
  32. SECTION:=devel
  33. CATEGORY:=Development
  34. TITLE:=gcc
  35. MAINTAINER:=Christian Beier <cb@shoutrlabs.com>
  36. DEPENDS:= +binutils +libstdcpp
  37. endef
  38. define Package/gcc/description
  39. build a native toolchain for compiling on target
  40. endef
  41. define Build/Prepare
  42. $(PKG_UNPACK)
  43. # we have to download additional stuff before patching
  44. (cd $(PKG_BUILD_DIR) && ./contrib/download_prerequisites)
  45. $(Build/Patch)
  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. --with-bugurl=$(BUGURL) \
  58. --with-pkgversion="$(PKGVERSION)" \
  59. --enable-shared \
  60. --disable-__cxa_atexit \
  61. --enable-target-optspace \
  62. --with-gnu-ld \
  63. --disable-nls \
  64. --disable-libmudflap \
  65. --disable-multilib \
  66. --disable-libgomp \
  67. --disable-libquadmath \
  68. --disable-libssp \
  69. --disable-decimal-float \
  70. --disable-libstdcxx-pch \
  71. --with-host-libstdcxx=-lstdc++ \
  72. --prefix=/usr \
  73. --libexecdir=/usr/lib \
  74. $(SOFT_FLOAT_CONFIG_OPTION) \
  75. $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
  76. $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
  77. --with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
  78. );
  79. endef
  80. define Build/Compile
  81. export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  82. DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
  83. endef
  84. define Package/gcc/install
  85. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  86. cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr
  87. cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
  88. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
  89. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
  90. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
  91. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
  92. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
  93. cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
  94. $(RM) $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/*.a
  95. cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  96. cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  97. cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  98. grep "GROUP.*-lgcc" $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libgcc_s.so && cp -a $(PKG_INSTALL_DIR)/usr/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libgcc.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/ ; true
  99. endef
  100. $(eval $(call BuildPackage,gcc))