Introduce Alternate Toolchain gcc and binutils
Hostboot, OCC and potentially other packages are *VERY* sensitive to
GCC+binutils combinations (specially due to the use of libbfd to feed
the custom linker/loader script). That means that the default buildroot
toolchain can't be easily upgraded without risking hard-to-debug build
and runtime issues that might be caused by the change of the compiler +
binutils combination.
Address this by creating (yet another) GCC + Binutils host packages pair
that can be used, as an alternative to the one provided by buildroot.
Doing so would allow such packages to stay (indefinitely) using their
choice of gcc+binutils, while still allowing buildroot (and the Skiroot
environment) to evolve and use newer versions / releases.
Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
diff --git a/openpower/package/alternate-gcc/Config.in b/openpower/package/alternate-gcc/Config.in
new file mode 100644
index 0000000..fbbd7b2
--- /dev/null
+++ b/openpower/package/alternate-gcc/Config.in
@@ -0,0 +1,22 @@
+config BR2_PACKAGE_ALTERNATE_GCC
+ bool "alternate-gcc"
+ select BR2_PACKAGE_ALTERNATE_BINUTILS
+ help
+ Build gcc for an Alternate Toolchain, for use in
+ certain packages.
+
+
+if BR2_PACKAGE_ALTERNATE_GCC
+
+config BR2_ALTERNATE_GCC_VERSION
+ string "Alternate gcc version"
+ default "8.4.0"
+
+config BR2_ALTERNATE_GCC_EXTRA_CONFIG_OPTIONS
+ string "Extra configure options for Alternate Toolchain GCC"
+ default BR2_EXTRA_GCC_CONFIG_OPTIONS
+ help
+ Any extra options to the Alternate Toolchain's gcc configure script
+ The default is taken from EXTRA_GCC_CONFIG_OPTIONS
+
+endif
diff --git a/openpower/package/alternate-gcc/alternate-gcc.mk b/openpower/package/alternate-gcc/alternate-gcc.mk
new file mode 100644
index 0000000..a2d8ecb
--- /dev/null
+++ b/openpower/package/alternate-gcc/alternate-gcc.mk
@@ -0,0 +1,65 @@
+################################################################################
+#
+# alternate-gcc
+#
+################################################################################
+
+#
+# Based on buildroot/package/gcc/*.mk, but trying to simplify since we're not
+# (yet) going for a general scenario here
+#
+
+ALTERNATE_GCC_VERSION = $(call qstrip,$(BR2_ALTERNATE_GCC_VERSION))
+ALTERNATE_GCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(ALTERNATE_GCC_VERSION)
+ALTERNATE_GCC_SOURCE = gcc-$(ALTERNATE_GCC_VERSION).tar.xz
+
+HOST_ALTERNATE_GCC_SUBDIR = build
+
+HOST_ALTERNATE_GCC_DEPENDENCIES = \
+ host-alternate-binutils \
+ host-gmp \
+ host-mpc \
+ host-mpfr \
+ $(BR_LIBC)
+
+HOST_ALTERNATE_GCC_EXCLUDES = \
+ libjava/* libgo/*
+
+define HOST_ALTERNATE_GCC_CONFIGURE_SYMLINK
+ mkdir -p $(@D)/build
+ ln -sf ../configure $(@D)/build/configure
+endef
+
+HOST_ALTERNATE_GCC_CONF_OPTS += \
+ $(call qstrip,$(BR2_ALTERNATE_GCC_EXTRA_CONFIG_OPTIONS))
+
+define HOST_ALTERNATE_GCC_CONFIGURE_CMDS
+ (cd $(HOST_ALTERNATE_GCC_SRCDIR) && rm -rf config.cache; \
+ CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
+ CXXFLAGS_FOR_TARGET="$(TARGET_CXXFLAGS)" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ LDFLAGS="$(HOST_LDFLAGS)" \
+ MAKEINFO=missing \
+ ./configure \
+ --prefix="$(HOST_DIR)/alternate-toolchain" \
+ --enable-static \
+ --target=$(GNU_TARGET_NAME) \
+ --with-sysroot=$(STAGING_DIR) \
+ --enable-__cxa_atexit \
+ --with-gnu-ld \
+ --disable-libssp \
+ --disable-multilib \
+ --disable-decimal-float \
+ --with-gmp=$(HOST_DIR) \
+ --with-mpc=$(HOST_DIR) \
+ --with-mpfr=$(HOST_DIR) \
+ --enable-languages="c,c++" \
+ --with-build-time-tools=$(HOST_DIR)/alternate-toolchain/$(GNU_TARGET_NAME)/bin \
+ --enable-shared \
+ $(QUIET) $(HOST_ALTERNATE_GCC_CONF_OPTS) \
+ )
+endef
+
+HOST_ALTERNATE_GCC_PRE_CONFIGURE_HOOKS += HOST_ALTERNATE_GCC_CONFIGURE_SYMLINK
+
+$(eval $(host-autotools-package))