Revert "toolchain/gcc: use zstd from tools"
[openwrt/staging/dedeckeh.git] / toolchain / gcc / common.mk
index a1950028883676329765129fd9d6dc0faf5a8871..83884dd54c0f4f9aa29fd86e25ddc14ec0550afe 100644 (file)
@@ -23,6 +23,7 @@ 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)
@@ -36,11 +37,15 @@ ifeq ($(PKG_VERSION),10.3.0)
   PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
 endif
 
-ifeq ($(PKG_VERSION),11.2.0)
-  PKG_HASH:=d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b
+ifeq ($(PKG_VERSION),11.3.0)
+  PKG_HASH:=b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39
 endif
 
-PATCH_DIR=../patches/$(GCC_VERSION)
+ifeq ($(PKG_VERSION),12.2.0)
+  PKG_HASH:=e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff
+endif
+
+PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x
 
 BUGURL=http://bugs.openwrt.org/
 PKGVERSION=OpenWrt GCC $(PKG_VERSION) $(REVISION)
@@ -108,13 +113,14 @@ 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)) \
+               $(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 \
                --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
@@ -179,6 +185,13 @@ define Host/SetToolchainInfo
        $(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
 endef
 
+
+ifdef CONFIG_GCC_USE_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)
@@ -187,8 +200,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