[OE-core] [PATCH 1/4] compiler-options.bbclass: provide and validate options
Khem Raj
raj.khem at gmail.com
Tue Jan 23 22:01:55 UTC 2018
On 12/13/17 3:31 PM, Juro Bystricky wrote:
> As we may be using external toolchains, we cannot assume
> various compiler options to be valid.
>
While looking through my backlog :), I think the idea is fine but
implementation can be a bit more generic. e.g. a common function to
probe the compiler for a given option then adding/removing it from
compiler commandline.
> 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
> +}
>
More information about the Openembedded-core
mailing list