toolchain/gcc: use STAGING_DIR_HOST instead of hardcoding default
[openwrt/staging/nbd.git] / toolchain / gcc / common.mk
index bef4fa37f8f90466c304c4a3c836d4912ea5025f..7eae855eea42c7ba1d4a2166cf615b0ddcc0d8a1 100644 (file)
@@ -23,24 +23,21 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=gcc
 GCC_VERSION:=$(call qstrip,$(CONFIG_GCC_VERSION))
 PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))
+GCC_MAJOR_VERSION:=$(word 1,$(subst ., ,$(PKG_VERSION)))
 GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
 
 PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 
-ifeq ($(PKG_VERSION),8.4.0)
-  PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
+ifeq ($(PKG_VERSION),11.3.0)
+  PKG_HASH:=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39
 endif
 
-ifeq ($(PKG_VERSION),10.3.0)
-  PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
+ifeq ($(PKG_VERSION),12.2.0)
+  PKG_HASH:=e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff
 endif
 
-ifeq ($(PKG_VERSION),11.2.0)
-  PKG_HASH:=d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b
-endif
-
-PATCH_DIR=../patches/$(GCC_VERSION)
+PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
 
 BUGURL=http://bugs.openwrt.org/
 PKGVERSION=OpenWrt GCC $(PKG_VERSION) $(REVISION)
@@ -75,7 +72,7 @@ ifdef CONFIG_INSTALL_GCCGO
 endif
 
 ifdef CONFIG_GCC_USE_GRAPHITE
-  GRAPHITE_CONFIGURE:= --with-isl=$(TOPDIR)/staging_dir/host
+  GRAPHITE_CONFIGURE:= --with-isl=$(STAGING_DIR_HOST)
 else
   GRAPHITE_CONFIGURE:= --without-isl --without-cloog
 endif
@@ -109,13 +106,13 @@ GCC_CONFIGURE:= \
                        --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
                $(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
                $(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--with-abi=elfv2)) \
-               --with-gmp=$(TOPDIR)/staging_dir/host \
-               --with-mpfr=$(TOPDIR)/staging_dir/host \
-               --with-mpc=$(TOPDIR)/staging_dir/host \
+               --with-gmp=$(STAGING_DIR_HOST) \
+               --with-mpfr=$(STAGING_DIR_HOST) \
+               --with-mpc=$(STAGING_DIR_HOST) \
                --disable-decimal-float \
                --with-diagnostics-color=auto-if-env \
                --enable-__cxa_atexit \
-               --disable-libstdcxx-dual-abi \
+               --enable-libstdcxx-dual-abi \
                --with-default-libstdcxx-abi=new
 ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
   GCC_CONFIGURE += --with-mips-plt
@@ -180,6 +177,13 @@ define Host/SetToolchainInfo
        $(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
 endef
 
+
+ifeq ($(GCC_MAJOR_VERSION),12)
+       GCC_VERSION_FILE:=gcc/genversion.cc
+else
+       GCC_VERSION_FILE:=gcc/version.c
+endif
+
 ifneq ($(GCC_PREPARE),)
   define Host/Prepare
        $(call Host/SetToolchainInfo)
@@ -188,8 +192,7 @@ ifneq ($(GCC_PREPARE),)
        $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_SOURCE_DIR)/
        $(SED) 's,^MULTILIB_OSDIRNAMES,# MULTILIB_OSDIRNAMES,' $(HOST_SOURCE_DIR)/gcc/config/*/t-*
        $(SED) 'd' $(HOST_SOURCE_DIR)/gcc/DEV-PHASE
-       $(SED) 's, DATESTAMP,,' $(HOST_SOURCE_DIR)/gcc/version.c
-       #(cd $(HOST_SOURCE_DIR)/libstdc++-v3; autoconf;);
+       $(SED) 's, DATESTAMP,,' $(HOST_SOURCE_DIR)/$(GCC_VERSION_FILE)
        $(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(HOST_SOURCE_DIR)/libstdc++-v3/configure
        mkdir -p $(GCC_BUILD_DIR)
   endef