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.

118 lines
3.9 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:=@GNU/gcc/gcc-$(PKG_VERSION)
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  14. PKG_MD5SUM:=7c60f24fab389f77af203d2516ee110f
  15. PKG_INSTALL:=1
  16. PKG_FIXUP:=libtool
  17. PKG_BUILD_PARALLEL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. TARGET_LANGUAGES:="c,c++"
  20. BUGURL=https://dev.openwrt.org/
  21. PKGVERSION=OpenWrt GCC $(PKG_VERSION)
  22. # not using sstrip here as this fucks up the .so's somehow
  23. STRIP:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip
  24. RSTRIP:= \
  25. NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \
  26. STRIP="$(STRIP)" \
  27. STRIP_KMOD="$(STRIP) --strip-debug" \
  28. $(SCRIPT_DIR)/rstrip.sh
  29. define Package/gcc
  30. SECTION:=devel
  31. CATEGORY:=Development
  32. TITLE:=gcc
  33. MAINTAINER:=Christian Beier <cb@shoutrlabs.com>
  34. DEPENDS:= +binutils +libstdcpp
  35. endef
  36. define Package/gcc/description
  37. build a native toolchain for compiling on target
  38. endef
  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. # poor man's fix for `none-openwrt-linux' not recognized when building with musl
  45. cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpfr/
  46. cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/gmp/
  47. cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpc/
  48. endef
  49. define Build/Configure
  50. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  51. SHELL="$(BASH)" \
  52. $(TARGET_CONFIGURE_OPTS) \
  53. $(PKG_BUILD_DIR)/configure \
  54. $(CONFIGURE_ARGS) \
  55. --build=$(GNU_HOST_NAME) \
  56. --host=$(REAL_GNU_TARGET_NAME) \
  57. --target=$(REAL_GNU_TARGET_NAME) \
  58. --enable-languages=$(TARGET_LANGUAGES) \
  59. --with-bugurl=$(BUGURL) \
  60. --with-pkgversion="$(PKGVERSION)" \
  61. --enable-shared \
  62. --disable-__cxa_atexit \
  63. --enable-target-optspace \
  64. --with-gnu-ld \
  65. --disable-nls \
  66. --disable-libmudflap \
  67. --disable-multilib \
  68. --disable-libgomp \
  69. --disable-libquadmath \
  70. --disable-libssp \
  71. --disable-decimal-float \
  72. --disable-libstdcxx-pch \
  73. --with-host-libstdcxx=-lstdc++ \
  74. --prefix=/usr \
  75. --libexecdir=/usr/lib \
  76. $(SOFT_FLOAT_CONFIG_OPTION) \
  77. $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
  78. $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
  79. --with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
  80. );
  81. endef
  82. define Build/Compile
  83. export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  84. DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
  85. endef
  86. define Package/gcc/install
  87. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  88. cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr
  89. cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
  90. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
  91. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
  92. ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
  93. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
  94. ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
  95. cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
  96. $(RM) $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/*.a
  97. cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  98. cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  99. cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
  100. 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
  101. endef
  102. $(eval $(call BuildPackage,gcc))