All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	 Doug Goldstein <cardoe@cardoe.com>,
	 Stefano Stabellini <sstabellini@kernel.org>,
	 Anthony PERARD <anthony.perard@citrix.com>,
	 Michal Orzel <michal.orzel@amd.com>,
	 Oleksii Kurochko <oleksii.kurochko@gmail.com>
Subject: Re: [PATCH 5/6] CI: Fix build script when CROSS_COMPILE is in use
Date: Tue, 3 Jan 2023 17:20:51 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2301031720400.4079@ubuntu-linux-20-04-desktop> (raw)
In-Reply-To: <20221230003848.3241-6-andrew.cooper3@citrix.com>

On Fri, 30 Dec 2022, Andrew Cooper wrote:
> Some testcases use a cross compiler.  Presently it's only arm32 and due to
> previous cleanup the only thing which is now wrong is printing the compiler
> version at the start of day.
> 
> Construct $cc to match what `make` will eventually choose given CROSS_COMPILE,
> taking care not to modify $CC.  Use $cc throughout the rest of the script.
> 
> Also correct the compiler detection logic.  Plain "gcc" was wrong, and
> "clang"* was a bodge highlighting the issue, but neither survive the
> CROSS_COMPILE correction.  Instead, construct cc_is_{gcc,clang} booleans like
> we do elsewhere in the build system, by querying the --version text for gcc or
> clang.
> 
> While making this change, adjust cc_ver to be calculated once at the same time
> as cc_is_* are calculated.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> CC: Doug Goldstein <cardoe@cardoe.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Anthony PERARD <anthony.perard@citrix.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
>  automation/scripts/build | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/automation/scripts/build b/automation/scripts/build
> index 4c6d1f3b70bc..206312ecc7d0 100755
> --- a/automation/scripts/build
> +++ b/automation/scripts/build
> @@ -2,13 +2,12 @@
>  
>  test -f /etc/os-release && cat "$_"
>  
> -$CC --version
> +# Construct $cc such that it matches what `make` will chose when taking
> +# CROSS_COMPILE into account.  Do not modify $CC directly, as that will cause
> +# `make` to double-account CROSS_COMPILE.
> +cc="${CROSS_COMPILE}${CC}"
>  
> -# Express the compiler version as an integer.  e.g. GCC 4.9.2 => 0x040902
> -cc-ver()
> -{
> -    $CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }'
> -}
> +$cc --version
>  
>  # random config or default config
>  if [[ "${RANDCONFIG}" == "y" ]]; then
> @@ -50,7 +49,14 @@ else
>      cfgargs=()
>      cfgargs+=("--enable-docs")
>  
> -    if [[ "${CC}" == "clang"* ]]; then
> +    # booleans for which compiler is in use
> +    cc_is_gcc="$($cc --version | grep -q gcc && echo "y" || :)"
> +    cc_is_clang="$($cc --version | grep -q clang && echo "y" || :)"
> +
> +    # The compiler version as an integer.  e.g. GCC 4.9.2 => 0x040902
> +    cc_ver="$($cc -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }')"
> +
> +    if [[ "${cc_is_clang}" == "y" ]]; then
>          # SeaBIOS cannot be built with clang
>          cfgargs+=("--with-system-seabios=/usr/share/seabios/bios.bin")
>          # iPXE cannot be built with clang
> @@ -73,7 +79,7 @@ else
>      fi
>  
>      # SeaBIOS requires GCC 4.6 or later
> -    if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then
> +    if [[ "${cc_is_gcc}" == "y" && "${cc_ver}" -lt 0x040600 ]]; then
>          cfgargs+=("--with-system-seabios=/bin/false")
>      fi
>  
> -- 
> 2.11.0
> 


  reply	other threads:[~2023-01-04  1:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  0:38 [PATCH 0/6] CI: Fixes/cleanup in preparation for RISCV Andrew Cooper
2022-12-30  0:38 ` [PATCH 1/6] CI: Drop automation/configs/ Andrew Cooper
2023-01-02 13:57   ` Michal Orzel
2023-01-04  1:08   ` Stefano Stabellini
2022-12-30  0:38 ` [PATCH 2/6] CI: Remove guesswork about which artefacts to preserve Andrew Cooper
2023-01-02 14:00   ` Michal Orzel
2023-01-04 12:12     ` Andrew Cooper
2023-01-04 12:18       ` Michal Orzel
2023-01-04  1:10   ` Stefano Stabellini
2023-01-04  1:18     ` Andrew Cooper
2023-01-04  1:22       ` Stefano Stabellini
2022-12-30  0:38 ` [PATCH 3/6] CI: Only calculate ./configure args if needed Andrew Cooper
2023-01-02 14:01   ` Michal Orzel
2023-01-04  1:12   ` Stefano Stabellini
2022-12-30  0:38 ` [PATCH 4/6] CI: Express HYPERVISOR_ONLY in build.yml Andrew Cooper
2022-12-30 10:04   ` Oleksii
2023-01-02 14:05   ` Michal Orzel
2023-01-04  1:15   ` Stefano Stabellini
2023-01-04  1:27     ` Andrew Cooper
2023-01-04  1:36       ` Stefano Stabellini
2023-01-04  1:41         ` Andrew Cooper
2023-01-04  1:48           ` Stefano Stabellini
2023-01-04  1:51             ` Andrew Cooper
2023-01-04  1:55               ` Stefano Stabellini
2022-12-30  0:38 ` [PATCH 5/6] CI: Fix build script when CROSS_COMPILE is in use Andrew Cooper
2023-01-04  1:20   ` Stefano Stabellini [this message]
2022-12-30  0:38 ` [PATCH 6/6] CI: Simplify the MUSL check Andrew Cooper
2023-01-04  1:22   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2301031720400.4079@ubuntu-linux-20-04-desktop \
    --to=sstabellini@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=cardoe@cardoe.com \
    --cc=michal.orzel@amd.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.