2 # Copyright (C) 2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE_URL
:=ftp
://ftp.fu-berlin.de
/unix
/languages
/gcc
/releases
/gcc-
$(PKG_VERSION
) \
15 http
://mirrors.rcn.net
/pub
/sourceware
/gcc
/releases
/gcc-
$(PKG_VERSION
) \
16 ftp
://ftp.gnu.org
/gnu
/gcc
/releases
/gcc-
$(PKG_VERSION
)
18 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
19 PKG_MD5SUM
:=7c60f24fab389f77af203d2516ee110f
24 include $(INCLUDE_DIR
)/package.mk
26 TARGET_LANGUAGES
:="c,c++"
27 BUGURL
=https
://dev.openwrt.org
/
28 PKGVERSION
=OpenWrt GCC
$(PKG_VERSION
)
30 # not using sstrip here as this fucks up the .so's somehow
31 STRIP
:=$(TOOLCHAIN_DIR
)/bin
/$(TARGET_CROSS
)strip
33 NM
="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \
35 STRIP_KMOD
="$(STRIP) --strip-debug" \
36 $(SCRIPT_DIR
)/rstrip.sh
43 MAINTAINER
:=Christian Beier
<cb@shoutrlabs.com
>
44 DEPENDS
:= +binutils
+libstdcpp
47 define Package
/gcc
/description
48 build a native toolchain for compiling on target
54 # we have to download additional stuff before patching
55 (cd
$(PKG_BUILD_DIR
) && .
/contrib
/download_prerequisites
)
60 define Build
/Configure
61 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
63 $(TARGET_CONFIGURE_OPTS
) \
64 $(PKG_BUILD_DIR
)/configure \
66 --build
=$(GNU_HOST_NAME
) \
67 --host
=$(REAL_GNU_TARGET_NAME
) \
68 --target
=$(REAL_GNU_TARGET_NAME
) \
69 --enable-languages
=$(TARGET_LANGUAGES
) \
70 --with-bugurl
=$(BUGURL
) \
71 --with-pkgversion
="$(PKGVERSION)" \
73 --disable-__cxa_atexit \
74 --enable-target-optspace \
77 --disable-libmudflap \
80 --disable-libquadmath \
82 --disable-decimal-float \
83 --disable-libstdcxx-pch \
84 --with-host-libstdcxx
=-lstdc
++ \
86 --libexecdir
=/usr
/lib \
87 $(SOFT_FLOAT_CONFIG_OPTION
) \
88 $(call qstrip
,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS
)) \
89 $(if
$(CONFIG_mips64
)$(CONFIG_mips64el
),--with-arch
=mips64 \
90 --with-abi
=$(subst ",,$(CONFIG_MIPS64_ABI))) \
95 export SHELL="$(BASH
)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
96 DESTDIR="$(PKG_INSTALL_DIR
)" $(MAKE_ARGS) all install
99 define Package/gcc/install
100 $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
101 cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr
102 cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
103 ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
104 ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
105 ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
106 ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
107 ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
108 cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
109 $(RM) $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/*.a
110 cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
111 cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
112 cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
113 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 $(eval $(call BuildPackage,gcc))