Root/gcc-mips/Makefile

Source at commit 7eb4f78cd9a6a0ecb656ba8fd0ddb5eca07c60e9 created 11 years 11 months ago.
By Xiangfu, gcc-mips mark as broken
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#
7include $(TOPDIR)/rules.mk
8PKG_NAME:=gcc
9#PKG_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#"))
10PKG_VERSION:=4.5.2
11PKG_RELEASE:=1
12PATCH_DIR=$(TOPDIR)/toolchain/gcc/patches/$(PKG_VERSION)
13PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
14    http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
15        ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
16
17PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
18PKG_MD5SUM:=d6559145853fbaaa0fd7556ed93bce9a
19PKG_INSTALL:=1
20PKG_FIXUP:=libtool
21
22include $(INCLUDE_DIR)/package.mk
23
24SEP:=,
25TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
26EXTRA_TARGET=$(if $(CONFIG_EXTRA_TARGET_ARCH),--enable-biarch --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-uclibc)
27
28STRIP:=$(STAGING_DIR_HOST)/bin/sstrip
29RSTRIP:= \
30    NM="$(TARGET_CROSS)nm" \
31    STRIP="$(STRIP) --strip-debug" \
32    STRIP_KMOD="$(TARGET_CROSS)strip --strip-debug" \
33    $(SCRIPT_DIR)/rstrip.sh
34
35define Package/gcc-mips
36  SECTION:=devel
37  CATEGORY:=Development
38  TITLE:=gcc-mips
39  DEPENDS:=+mpfr +binutils +libmpc @BROKEN
40endef
41
42define Package/gcc-mips/description
43    build a native toolchain for compiling on target
44endef
45
46define Build/Prepare
47    $(call Build/Prepare/Default)
48    ($(CP) ./patches $(PKG_BUILD_DIR); cd $(PKG_BUILD_DIR); patch -Np1 < ./patches/001-cache-amnesia.patch;);
49    (cd $(PKG_BUILD_DIR)/libstdc++-v3; \
50    $(SED) 's/m4_rename(/m4_rename_force(/' acinclude.m4;);
51endef
52
53define Build/Configure
54    $(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(PKG_BUILD_DIR)/libstdc++-v3/configure
55    $(SED) 's/\"CFLAGS=/\"CFLAGS=$(FPIC) /' $(PKG_BUILD_DIR)/libstdc++-v3/Makefile.am
56    (cd $(PKG_BUILD_DIR); rm -f config.cache; \
57        SHELL="$(BASH)" \
58        $(TARGET_CONFIGURE_OPTS) \
59        $(PKG_BUILD_DIR)/configure \
60            $(TARGET_CONFIGURE_ARGS) \
61            --build=$(GNU_HOST_NAME) \
62            --host=$(REAL_GNU_TARGET_NAME) \
63            --target=$(REAL_GNU_TARGET_NAME) \
64            --enable-languages=$(TARGET_LANGUAGES) \
65            --enable-shared \
66            --disable-__cxa_atexit \
67            --enable-target-optspace \
68            --with-gnu-ld \
69            --disable-nls \
70            --disable-libmudflap \
71            --disable-multilib \
72            --with-gmp=$(STAGING_DIR)/usr \
73            --with-mpc=$(STAGING_DIR)/usr \
74            --with-mpfr=$(STAGING_DIR)/usr \
75            --prefix=/usr \
76            $(EXTRA_TARGET) \
77            $(SOFT_FLOAT_CONFIG_OPTION) \
78            $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
79    );
80endef
81
82define Build/Compile
83    export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
84            DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
85endef
86
87define Package/gcc-mips/install
88    $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
89    cp -ar $(PKG_INSTALL_DIR)/usr/{include,libexec} $(1)/usr
90    cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},gccbug,cpp,gcov} $(1)/usr/bin
91    ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
92    ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
93    ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
94    ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
95    ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
96    cp -a $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
97    cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
98    cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
99    cp -a $(TOOLCHAIN_DIR)/lib/*.{a,o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
100endef
101
102define Package/gcc-mips/postinst
103#!/bin/sh
104#we use some files from host's openwrt toolchain for gcc-mips package,
105#and the host's gcc version (linaro) is now 4.5.4.
106#this will be fixed when we catch up with openwrt upstream,
107#workaround for now
108for i in $$(find $${IPKG_INSTROOT}/usr/lib/gcc/mipsel-openwrt-linux-uclibc/4.5.4 -type f); do
109    ln -s ../4.5.4/$${i##*/} $${i/4.5.4/4.5.2}
110done
111endef
112
113$(eval $(call BuildPackage,gcc-mips))
114

Archive Download this file



interactive