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