From 60a609bec872a625faad1c7272c73365ad619559 Mon Sep 17 00:00:00 2001 From: Tomas Volf <~@wolfsden.cz> Date: Thu, 9 May 2024 01:42:50 +0200 Subject: [PATCH] hack: Support picking cc and cpp via environment variables. Until now `cc' was hard-coded as the only compiler used. Supporting selecting the compiler and preprocessor to be used via environment variables makes life easier for distributors, so this commit mimics how podman does it in its hack/* scripts. Signed-off-by: Tomas Volf <~@wolfsden.cz> --- hack/btrfs_installed_tag.sh | 2 +- hack/btrfs_tag.sh | 2 +- hack/libsubid_tag.sh | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hack/btrfs_installed_tag.sh b/hack/btrfs_installed_tag.sh index c4d99f37..f2f2b33c 100755 --- a/hack/btrfs_installed_tag.sh +++ b/hack/btrfs_installed_tag.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -cc -E - > /dev/null 2> /dev/null << EOF +${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF #include EOF if test $? -ne 0 ; then diff --git a/hack/btrfs_tag.sh b/hack/btrfs_tag.sh index 59cb969a..ea753d4d 100755 --- a/hack/btrfs_tag.sh +++ b/hack/btrfs_tag.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -cc -E - > /dev/null 2> /dev/null << EOF +${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF #include EOF if test $? -ne 0 ; then diff --git a/hack/libsubid_tag.sh b/hack/libsubid_tag.sh index 0f98e061..b788796c 100755 --- a/hack/libsubid_tag.sh +++ b/hack/libsubid_tag.sh @@ -5,7 +5,8 @@ fi tmpdir="$PWD/tmp.$RANDOM" mkdir -p "$tmpdir" trap 'rm -fr "$tmpdir"' EXIT -cc -o "$tmpdir"/libsubid_tag -x c - -l subid > /dev/null 2> /dev/null << EOF +${CC:-cc} ${CPPFLAGS} ${CFLAGS} -o "$tmpdir"/libsubid_tag -x c - -l subid \ + > /dev/null 2> /dev/null << EOF #include #include int main() {