support/dependencies: add BR2_NEEDS_HOST_GCC_PLUGIN_SUPPORT
authorKamel Bouhara <kamel.bouhara@bootlin.com>
Mon, 6 Jul 2020 15:30:35 +0000 (17:30 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 12 Jul 2020 09:20:27 +0000 (11:20 +0200)
Some packages requires support on the build machine to create gcc
plugins. This commit adds a blind option,
BR2_NEEDS_HOST_GCC_PLUGIN_SUPPORT, which such packages can
select. When this option is enabled, the logic in support/dependencies
verifies that everything needed on the build machine to build gcc
plugins is available.

Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Config.in
support/dependencies/dependencies.sh

index 48fd36ff98ecf38229bcdffc808143f518be0fa3..0104d1319e0d21997876a8155bcee98989fa946b 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -80,6 +80,11 @@ config BR2_HOSTARCH_NEEDS_IA32_COMPILER
 config BR2_NEEDS_HOST_UTF8_LOCALE
        bool
 
+# Hidden boolean selected by packages that need the host to have
+# support for building gcc plugins
+config BR2_NEEDS_HOST_GCC_PLUGIN_SUPPORT
+       bool
+
 source "arch/Config.in"
 
 menu "Build options"
index 98469bd70ce25e725c73a4d197515f63ba7a3e6c..c1bd614edf5413c410902d320f2d68bafeaa070e 100755 (executable)
@@ -240,6 +240,16 @@ if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then
        fi
 fi
 
+if grep ^BR2_NEEDS_HOST_GCC_PLUGIN_SUPPORT=y $BR2_CONFIG ; then
+       if ! echo "#include <gcc-plugin.h>" | $HOSTCXX_NOCCACHE -I$($HOSTCXX_NOCCACHE -print-file-name=plugin)/include -x c++ -c - -o /dev/null ; then
+               echo
+               echo "Your Buildroot configuration needs a host compiler capable of building gcc plugins."
+               echo "If you're running a Debian/Ubuntu distribution, install gcc-X-plugin-dev package."
+               echo "For other distributions, refer to their documentation."
+               exit 1 ;
+       fi
+fi
+
 # Check that the Perl installation is complete enough for Buildroot.
 required_perl_modules="Data::Dumper" # Needed to build host-autoconf
 required_perl_modules="$required_perl_modules ExtUtils::MakeMaker" # Used by host-libxml-parser-perl