瀏覽代碼

gcc: Add gcc package from git.openwrt.org/packages.git.

Signed-off-by: Christian Beier <dontmind@freeshell.org>
Christian Beier 10 年之前
父節點
當前提交
799110936e
共有 1 個文件被更改,包括 90 次插入0 次删除
  1. 90
    0
      devel/gcc/Makefile

+ 90
- 0
devel/gcc/Makefile 查看文件

@@ -0,0 +1,90 @@
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
+include $(TOPDIR)/rules.mk
8
+PKG_NAME:=gcc
9
+PKG_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#"))
10
+PKG_RELEASE:=1
11
+PATCH_DIR=$(TOPDIR)/toolchain/gcc/patches/$(PKG_VERSION)
12
+PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
13
+    http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
14
+	    ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
15
+
16
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17
+PKG_MD5SUM:=354853e0b2da90c527e35aabb8d6f1e6
18
+
19
+include $(INCLUDE_DIR)/package.mk
20
+
21
+SEP:=,
22
+TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
23
+EXTRA_TARGET=$(if $(CONFIG_EXTRA_TARGET_ARCH),--enable-biarch --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-uclibc)
24
+
25
+define Package/gcc
26
+  SECTION:=devel
27
+  CATEGORY:=Development
28
+  TITLE:=gcc
29
+  DEPENDS:=@TARGET_x86 @NO_STRIP
30
+endef
31
+
32
+define Package/gcc/description
33
+	build a native toolchain for compiling on target
34
+endef
35
+
36
+define Build/Prepare
37
+	$(call Build/Prepare/Default)
38
+	$(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(PKG_BUILD_DIR)/gcc/version.c
39
+	$(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(PKG_BUILD_DIR)/gcc/version.c
40
+	(cd $(PKG_BUILD_DIR)/libstdc++-v3; autoconf;);
41
+	$(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(PKG_BUILD_DIR)/libstdc++-v3/configure
42
+endef
43
+
44
+define Build/Configure
45
+	(cd $(PKG_BUILD_DIR); rm -f config.cache; \
46
+		SHELL="$(BASH)" \
47
+		$(TARGET_CONFIGURE_OPTS) \
48
+		$(PKG_BUILD_DIR)/configure \
49
+			$(TARGET_CONFIGURE_ARGS) \
50
+			--build=$(GNU_HOST_NAME) \
51
+			--host=$(REAL_GNU_TARGET_NAME) \
52
+			--target=$(REAL_GNU_TARGET_NAME) \
53
+			--enable-languages=$(TARGET_LANGUAGES) \
54
+			--enable-shared \
55
+			--disable-__cxa_atexit \
56
+			--enable-target-optspace \
57
+			--with-gnu-ld \
58
+			--disable-nls \
59
+			--disable-libmudflap \
60
+			--disable-multilib \
61
+			$(EXTRA_TARGET) \
62
+			$(SOFT_FLOAT_CONFIG_OPTION) \
63
+			$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
64
+	);
65
+endef
66
+
67
+define Build/Compile
68
+	export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
69
+			DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
70
+	# Set up the symlinks to enable lying about target name.
71
+	set -e; \
72
+	(cd $(TOOLCHAIN_DIR); \
73
+		ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
74
+		cd bin; \
75
+		for app in $(REAL_GNU_TARGET_NAME)-* ; do \
76
+			ln -sf $$$${app} \
77
+			$(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
78
+		done; \
79
+	);
80
+endef
81
+
82
+define Package/gcc/install
83
+	$(INSTALL_DIR) $(1)/usr/lib/
84
+	cp -r $(PKG_INSTALL_DIR)/* $(1)
85
+	cp -r $(TOOLCHAIN_DIR)/include $(1)/usr/
86
+	cp $(TOOLCHAIN_DIR)/lib/crt* $(1)/usr/lib/
87
+	cp $(TOOLCHAIN_DIR)/lib/libc.so $(1)/usr/lib/
88
+endef
89
+
90
+$(eval $(call BuildPackage,gcc))