2010-10-09 10:38:12 +03:00
|
|
|
#
|
|
|
|
# Copyright (C) 2008 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=gcc
|
|
|
|
#PKG_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#"))
|
2012-04-06 21:40:08 +03:00
|
|
|
PKG_VERSION:=4.6.2
|
2011-05-10 18:35:00 +03:00
|
|
|
PKG_RELEASE:=1
|
2010-10-09 10:38:12 +03:00
|
|
|
PATCH_DIR=$(TOPDIR)/toolchain/gcc/patches/$(PKG_VERSION)
|
|
|
|
PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
|
|
|
|
http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
|
|
|
|
ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
|
|
|
|
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
2012-04-08 15:22:42 +03:00
|
|
|
PKG_MD5SUM:=028115c4fbfb6cfd75d6369f4a90d87e
|
2010-10-09 10:38:12 +03:00
|
|
|
PKG_INSTALL:=1
|
|
|
|
PKG_FIXUP:=libtool
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
|
|
|
SEP:=,
|
|
|
|
TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
|
|
|
|
EXTRA_TARGET=$(if $(CONFIG_EXTRA_TARGET_ARCH),--enable-biarch --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-uclibc)
|
2010-10-11 19:19:36 +03:00
|
|
|
|
|
|
|
STRIP:=$(STAGING_DIR_HOST)/bin/sstrip
|
|
|
|
RSTRIP:= \
|
|
|
|
NM="$(TARGET_CROSS)nm" \
|
2011-05-10 18:35:00 +03:00
|
|
|
STRIP="$(STRIP) --strip-debug" \
|
2010-10-11 19:19:36 +03:00
|
|
|
STRIP_KMOD="$(TARGET_CROSS)strip --strip-debug" \
|
|
|
|
$(SCRIPT_DIR)/rstrip.sh
|
2010-10-09 10:38:12 +03:00
|
|
|
|
|
|
|
define Package/gcc-mips
|
|
|
|
SECTION:=devel
|
|
|
|
CATEGORY:=Development
|
|
|
|
TITLE:=gcc-mips
|
2012-04-06 21:40:08 +03:00
|
|
|
DEPENDS:=+mpfr +binutils +libmpc
|
2010-10-09 10:38:12 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/gcc-mips/description
|
|
|
|
build a native toolchain for compiling on target
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Prepare
|
|
|
|
$(call Build/Prepare/Default)
|
2011-05-26 15:20:04 +03:00
|
|
|
($(CP) ./patches $(PKG_BUILD_DIR); cd $(PKG_BUILD_DIR); patch -Np1 < ./patches/001-cache-amnesia.patch;);
|
2011-03-07 18:05:54 +02:00
|
|
|
(cd $(PKG_BUILD_DIR)/libstdc++-v3; \
|
|
|
|
$(SED) 's/m4_rename(/m4_rename_force(/' acinclude.m4;);
|
2010-10-09 10:38:12 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Configure
|
2011-03-07 18:05:54 +02:00
|
|
|
$(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(PKG_BUILD_DIR)/libstdc++-v3/configure
|
|
|
|
$(SED) 's/\"CFLAGS=/\"CFLAGS=$(FPIC) /' $(PKG_BUILD_DIR)/libstdc++-v3/Makefile.am
|
2010-10-09 10:38:12 +03:00
|
|
|
(cd $(PKG_BUILD_DIR); rm -f config.cache; \
|
|
|
|
SHELL="$(BASH)" \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
$(PKG_BUILD_DIR)/configure \
|
|
|
|
$(TARGET_CONFIGURE_ARGS) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--host=$(REAL_GNU_TARGET_NAME) \
|
|
|
|
--target=$(REAL_GNU_TARGET_NAME) \
|
|
|
|
--enable-languages=$(TARGET_LANGUAGES) \
|
|
|
|
--enable-shared \
|
|
|
|
--disable-__cxa_atexit \
|
|
|
|
--enable-target-optspace \
|
|
|
|
--with-gnu-ld \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-libmudflap \
|
|
|
|
--disable-multilib \
|
|
|
|
--with-gmp=$(STAGING_DIR)/usr \
|
2011-05-10 18:35:00 +03:00
|
|
|
--with-mpc=$(STAGING_DIR)/usr \
|
2010-10-09 10:38:12 +03:00
|
|
|
--with-mpfr=$(STAGING_DIR)/usr \
|
2012-04-06 21:40:08 +03:00
|
|
|
--disable-libstdcxx-pch \
|
2010-10-09 10:38:12 +03:00
|
|
|
--prefix=/usr \
|
|
|
|
$(EXTRA_TARGET) \
|
|
|
|
$(SOFT_FLOAT_CONFIG_OPTION) \
|
|
|
|
$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
|
|
|
|
);
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
|
|
|
export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
|
|
|
|
DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/gcc-mips/install
|
2011-05-10 18:35:00 +03:00
|
|
|
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
|
|
|
|
cp -ar $(PKG_INSTALL_DIR)/usr/{include,libexec} $(1)/usr
|
2012-04-06 21:40:08 +03:00
|
|
|
cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
|
2011-05-10 18:35:00 +03:00
|
|
|
ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
|
|
|
|
ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
|
|
|
|
ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
|
|
|
|
ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
|
|
|
|
ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
|
|
|
|
cp -a $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
|
|
|
|
cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
|
|
|
|
cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
|
|
|
|
cp -a $(TOOLCHAIN_DIR)/lib/*.{a,o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
|
2010-10-09 10:38:12 +03:00
|
|
|
endef
|
|
|
|
|
2011-08-23 23:28:11 +03:00
|
|
|
define Package/gcc-mips/postinst
|
|
|
|
#!/bin/sh
|
|
|
|
#we use some files from host's openwrt toolchain for gcc-mips package,
|
2012-04-06 21:40:08 +03:00
|
|
|
#and the host's gcc version (linaro) is now 4.6.3.
|
2011-08-23 23:28:11 +03:00
|
|
|
#workaround for now
|
2012-04-06 21:40:08 +03:00
|
|
|
for i in $$(find $${IPKG_INSTROOT}/usr/lib/gcc/mipsel-openwrt-linux-uclibc/4.6.3 -type f); do
|
|
|
|
ln -s ../4.6.3/$${i##*/} $${i/4.6.3/4.6.2}
|
2011-08-23 23:28:11 +03:00
|
|
|
done
|
|
|
|
endef
|
|
|
|
|
2010-10-09 10:38:12 +03:00
|
|
|
$(eval $(call BuildPackage,gcc-mips))
|