[OE-core] [PATCH 1/4] compiler-options.bbclass: provide and validate options

Juro Bystricky juro.bystricky at intel.com
Wed Dec 13 21:31:13 UTC 2017


As we may be using external toolchains, we cannot assume
various compiler options to be valid.

Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
 meta/classes/compiler-options.bbclass | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 meta/classes/compiler-options.bbclass

diff --git a/meta/classes/compiler-options.bbclass b/meta/classes/compiler-options.bbclass
new file mode 100644
index 0000000..fdd45e8
--- /dev/null
+++ b/meta/classes/compiler-options.bbclass
@@ -0,0 +1,24 @@
+
+# Some compiler options are not universal and using them when not
+# supported can cause build errors.
+#
+# Check for a compiler option -ffile-prefix-map.
+# This option is present in OE-core GCC, but may not be present when
+# using external toolchains.
+#
+# The option can remap any hard-coded __FILE__ typically containing build
+# host path to a reproducible value, with the absolute build-host path
+# stripped. This is essential in order to achieve reproducible builds.
+#
+# Typical usage:
+#
+#    inherit compiler-options
+#    cc_extra=$(file_prefix_map_option_supported ${CC})
+#    oe_runmake CFLAGS="${CFLAGS} $cc_extra"
+#
+
+file_prefix_map_option_supported () {
+	if $1 -Q --help=joined | grep -q "\-ffile-prefix-map=<old=new>"; then
+		echo "-ffile-prefix-map=${S}=/${BP}/"
+	fi
+}
-- 
2.7.4




More information about the Openembedded-core mailing list