toolchain/gcc: use STAGING_DIR_HOST instead of hardcoding default
[openwrt/staging/nbd.git] / toolchain / gcc / common.mk
index 7fb30285aa80f5b4046e8cdd7bda2a4e92557ab8..7eae855eea42c7ba1d4a2166cf615b0ddcc0d8a1 100644 (file)
@@ -23,28 +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),5.5.0)
-  PKG_HASH:=530cea139d82fe542b358961130c69cfde8b3d14556370b65823d2f91f0ced87
+ifeq ($(PKG_VERSION),11.3.0)
+  PKG_HASH:=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39
 endif
 
-ifeq ($(PKG_VERSION),7.5.0)
-  PKG_HASH:=b81946e7f01f90528a1f7352ab08cc602b9ccc05d4e44da4bd501c5a189ee661
+ifeq ($(PKG_VERSION),12.2.0)
+  PKG_HASH:=e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff
 endif
 
-ifeq ($(PKG_VERSION),8.4.0)
-  PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
-endif
-
-ifeq ($(PKG_VERSION),9.3.0)
-  PKG_HASH:=71e197867611f6054aa1119b13a0c0abac12834765fe2d81f35ac57f84f742d1
-endif
-
-PATCH_DIR=../patches/$(GCC_VERSION)
+PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
 
 BUGURL=http://bugs.openwrt.org/
 PKGVERSION=OpenWrt GCC $(PKG_VERSION) $(REVISION)
@@ -79,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
@@ -104,6 +97,7 @@ GCC_CONFIGURE:= \
                --disable-multilib \
                --disable-libmpx \
                --disable-nls \
+               --disable-libssp \
                $(GRAPHITE_CONFIGURE) \
                --with-host-libstdcxx=-lstdc++ \
                $(SOFT_FLOAT_CONFIG_OPTION) \
@@ -111,12 +105,15 @@ GCC_CONFIGURE:= \
                $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
                        --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
                $(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
-               --with-gmp=$(TOPDIR)/staging_dir/host \
-               --with-mpfr=$(TOPDIR)/staging_dir/host \
-               --with-mpc=$(TOPDIR)/staging_dir/host \
+               $(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--with-abi=elfv2)) \
+               --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
+               --enable-__cxa_atexit \
+               --enable-libstdcxx-dual-abi \
+               --with-default-libstdcxx-abi=new
 ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
   GCC_CONFIGURE += --with-mips-plt
 endif
@@ -131,14 +128,6 @@ ifneq ($(CONFIG_GCC_DEFAULT_SSP),)
                --enable-default-ssp
 endif
 
-ifneq ($(CONFIG_GCC_LIBSSP),)
-  GCC_CONFIGURE+= \
-               --enable-libssp
-else
-  GCC_CONFIGURE+= \
-               --disable-libssp
-endif
-
 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
   GCC_CONFIGURE+= \
                --enable-biarch \
@@ -188,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)
@@ -196,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