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.

120 lines
4.0 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. # poor man's fix for `none-openwrt-linux' not recognized when building with musl
  47. cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpfr/
  48. cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/gmp/
  49. cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpc/
  50. endef
  51. define Build/Configure
  52. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  53. SHELL="$(BASH)" \
  54. $(TARGET_CONFIGURE_OPTS) \
  55. $(PKG_BUILD_DIR)/configure \
  56. $(CONFIGURE_ARGS) \
  57. --build=$(GNU_HOST_NAME) \
  58. --host=$(REAL_GNU_TARGET_NAME) \
  59. --target=$(REAL_GNU_TARGET_NAME) \
  60. --enable-languages=$(TARGET_LANGUAGES) \
  61. --with-bugurl=$(BUGURL) \
  62. --with-pkgversion="$(PKGVERSION)" \
  63. --enable-shared \
  64. --disable-__cxa_atexit \
  65. --enable-target-optspace \
  66. --with-gnu-ld \
  67. --disable-nls \
  68. --disable-libmudflap \
  69. --disable-multilib \
  70. --disable-libgomp \
  71. --disable-libquadmath \
  72. --disable-libssp \
  73. --disable-decimal-float \
  74. --disable-libstdcxx-pch \
  75. --with-host-libstdcxx=-lstdc++ \
  76. --prefix=/usr \
  77. --libexecdir=/usr/lib \
  78. $(SOFT_FLOAT_CONFIG_OPTION) \
  79. $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
  80. $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
  81. --with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
  82. );
  83. endef
  84. define Build/Compile
  85. export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  86. DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
  87. endef
  88. define Package/gcc/install
  89. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  90. cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr
  91. cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
  92. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
  93. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
  94. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
  95. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
  96. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
  97. cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
  98. $(RM) $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/*.a
  99. cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  100. cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  101. cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  102. 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
  103. endef
  104. $(eval $(call BuildPackage,gcc))