From 242a6d57396ad94fe1401a374cb741f8375d8322 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 5 Apr 2016 17:29:09 -0700 Subject: [PATCH] build: use ccache wrappers rather than setting CC/CXX Taken from https://github.com/ceph/ceph/pull/8461 - works around a bug in distutils (https://bugs.python.org/issue8027) Signed-off-by: Josh Durgin --- build-ceph-deb-native.sh | 6 +++++- build-ceph-deb.sh | 6 +++++- build-ceph-gcov.sh | 6 +++++- build-ceph-notcmalloc.sh | 6 +++++- build-ceph-rpm.sh | 6 +++++- build-ceph.sh | 6 +++++- build-kernel-deb.sh | 6 +++++- build-kernel-raw.sh | 6 +++++- build-kernel-rpm.sh | 6 +++++- 9 files changed, 45 insertions(+), 9 deletions(-) diff --git a/build-ceph-deb-native.sh b/build-ceph-deb-native.sh index a4c12c0..8b3a6d2 100755 --- a/build-ceph-deb-native.sh +++ b/build-ceph-deb-native.sh @@ -46,7 +46,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph-deb.sh b/build-ceph-deb.sh index 146b0b3..cf21eb6 100755 --- a/build-ceph-deb.sh +++ b/build-ceph-deb.sh @@ -46,7 +46,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph-gcov.sh b/build-ceph-gcov.sh index 31ccf8a..138e9dd 100755 --- a/build-ceph-gcov.sh +++ b/build-ceph-gcov.sh @@ -44,7 +44,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph-notcmalloc.sh b/build-ceph-notcmalloc.sh index 049720e..bc31da9 100755 --- a/build-ceph-notcmalloc.sh +++ b/build-ceph-notcmalloc.sh @@ -45,7 +45,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph-rpm.sh b/build-ceph-rpm.sh index b1b3818..8daab87 100755 --- a/build-ceph-rpm.sh +++ b/build-ceph-rpm.sh @@ -72,7 +72,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-ceph.sh b/build-ceph.sh index 006a560..6680fbb 100755 --- a/build-ceph.sh +++ b/build-ceph.sh @@ -50,7 +50,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-kernel-deb.sh b/build-kernel-deb.sh index 75c9834..a9e93f0 100755 --- a/build-kernel-deb.sh +++ b/build-kernel-deb.sh @@ -17,7 +17,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-kernel-raw.sh b/build-kernel-raw.sh index 76a2bce..142e840 100755 --- a/build-kernel-raw.sh +++ b/build-kernel-raw.sh @@ -19,7 +19,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 diff --git a/build-kernel-rpm.sh b/build-kernel-rpm.sh index 0141ac6..cb0e2f5 100755 --- a/build-kernel-rpm.sh +++ b/build-kernel-rpm.sh @@ -40,7 +40,11 @@ if command -v ccache >/dev/null; then if [ ! -e "$CCACHE_DIR" ]; then echo "$0: have ccache but cache directory does not exist: $CCACHE_DIR" 1>&2 else - set -- CC='ccache gcc' CXX='ccache g++' + CCACHE_PATH="$PATH" + for d in /usr/{lib64,lib,lib32,libexec}/ccache{,/bin} ; do + test -d "$d" && test -x "$d/g++" && CCACHE_PATH="$d:$PATH" && break + done + export PATH="$CCACHE_PATH" fi else echo "$0: no ccache found, compiles will be slower." 1>&2 -- 2.39.5