toolchain/binutils: exclude .rej files when unpacking the tarball
[openwrt/openwrt.git] / toolchain / binutils / Makefile
index 925478c..f6889cb 100644 (file)
@@ -1,5 +1,5 @@
-# 
-# Copyright (C) 2006-2009 OpenWrt.org
+#
+# Copyright (C) 2006-2013 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,77 +8,110 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=binutils
 PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION))
+BIN_VERSION:=$(PKG_VERSION)
 
 PKG_SOURCE_URL:=@GNU/binutils/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 
-ifeq ($(PKG_VERSION),2.17)
-  PKG_MD5SUM:=e26e2e06b6e4bf3acf1dc8688a94c0d1
-endif
-ifeq ($(PKG_VERSION),2.18)
-  PKG_MD5SUM:=9d22ee4dafa3a194457caf4706f9cf01
-endif
-ifeq ($(PKG_VERSION),2.19)
-  PKG_MD5SUM:=17a52219dee5a76c1a9d9b0bfd337d66
-endif
-ifeq ($(PKG_VERSION),2.19.1)
-  PKG_MD5SUM:=09a8c5821a2dfdbb20665bc0bd680791
-endif
+TAR_OPTIONS += --exclude='*.rej'
 
-PATCH_DIR:=./patches/$(PKG_VERSION)
+ifeq ($(PKG_VERSION),2.27)
+  PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
+endif
 
-REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
-STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
-BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
+ifeq ($(PKG_VERSION),2.29.1)
+  PKG_HASH:=1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc
+endif
 
-override CONFIG_AUTOREBUILD=
+ifeq ($(PKG_VERSION),2.30)
+  PKG_HASH:=efeade848067e9a03f1918b1da0d37aaffa0b0127a06b5e9236229851d9d0c09
+endif
 
-include $(INCLUDE_DIR)/host-build.mk
+ifneq ($(CONFIG_BINUTILS_VERSION_2_29_ARC),)
+  PKG_REV:=arc-2017.09-release
+  PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_REV)/
+  PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.gz
+  PKG_HASH:=2ea086fd5521e942926dd6ff6922ce31c29ee7ffc754fca3d06385e0f27600f8
+  BINUTILS_DIR:=$(PKG_NAME)-gdb-$(PKG_REV)
+  HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
+endif
 
-EXTRA_TARGET=$(if $(CONFIG_EXTRA_TARGET_ARCH),--enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX))
+HOST_BUILD_PARALLEL:=1
 
-ifneq ($(CONFIG_SSP_SUPPORT),)
-       LIB_SSP:=--enable-libssp
-else
-       LIB_SSP:=--disable-libssp
-endif
+PATCH_DIR:=./patches/$(PKG_VERSION)
 
-define Build/Prepare
-       $(call Build/Prepare/Default)
-       ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
-       $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/
-endef
+include $(INCLUDE_DIR)/toolchain-build.mk
 
-define Build/Configure
-       (cd $(PKG_BUILD_DIR); \
-               ./configure \
-               --prefix=$(TOOLCHAIN_DIR)/usr \
+BINUTILS_CONFIGURE:= \
+       ./configure \
+               --prefix=$(TOOLCHAIN_DIR) \
                --build=$(GNU_HOST_NAME) \
                --host=$(GNU_HOST_NAME) \
                --target=$(REAL_GNU_TARGET_NAME) \
                --with-sysroot=$(TOOLCHAIN_DIR) \
+               --enable-deterministic-archives \
+               --enable-plugins \
                --disable-multilib \
                --disable-werror \
                --disable-nls \
-               $(LIB_SSP) \
-               $(EXTRA_TARGET) \
+               --disable-sim \
+               --disable-gdb \
+               $(GRAPHITE_CONFIGURE) \
                $(SOFT_FLOAT_CONFIG_OPTION) \
-               $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) \
+               $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) 
+
+ifneq ($(CONFIG_SSP_SUPPORT),)
+  BINUTILS_CONFIGURE+= \
+               --enable-libssp
+else
+  BINUTILS_CONFIGURE+= \
+               --disable-libssp
+endif
+
+ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
+  BINUTILS_CONFIGURE+= \
+               --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
+endif
+
+define Host/Prepare
+       $(call Host/Prepare/Default)
+       ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
+       $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
+       $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
+endef
+
+define Host/Configure
+       (cd $(HOST_BUILD_DIR); \
+               $(BINUTILS_CONFIGURE) \
        );
 endef
 
-define Build/Compile
-       $(MAKE) -C $(PKG_BUILD_DIR) all
+define Host/Compile
+       +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
 endef
 
-define Build/Install
-       $(MAKE) -C $(PKG_BUILD_DIR) install
-       $(CP) $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
+define Host/Install
+       mkdir -p $(TOOLCHAIN_DIR)/initial
+       $(MAKE) -C $(HOST_BUILD_DIR) \
+               prefix=$(TOOLCHAIN_DIR)/initial \
+               install
+       $(MAKE) -C $(HOST_BUILD_DIR) \
+               prefix=$(TOOLCHAIN_DIR) \
+               install
+       $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
+       $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
+       $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(HOST_BUILD_PREFIX)/bin/readelf
+       # ARC gcc requires extlib.
+       # If extlib is not available in "initial" folder
+       # initial gcc will fail to build libc.
+       if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
+               $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
+       fi
 endef
 
-define Build/Clean
+define Host/Clean
        rm -rf \
-               $(PKG_BUILD_DIR) \
+               $(HOST_BUILD_DIR) \
                $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
 endef