[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] ccache with autotools
From: |
Greg Chicares |
Subject: |
[lmi] ccache with autotools |
Date: |
Thu, 23 Feb 2023 01:06:14 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 |
AIUI, the recommended way to use ccache with autotools is to
override $CC and $CXX. However, in the cross-compilation case,
$CC and $CXX aren't necessarily specified. Is there a way to
accomplish this less bletcherously than as shown below?
diff --git a/install_wx.sh b/install_wx.sh
index 6129ff0e7..fef6add43 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -115,12 +115,21 @@ mkdir --parents "$build_dir"
cd "$build_dir"
printf 'Building %s with %s for %s.\n' "wx" "$LMI_COMPILER" "$LMI_TRIPLET"
+compiler_prefix="ccache "
+case "$LMI_TRIPLET" in
+ *-*-cygwin*|*-*-mingw*)
+ compiler_prefix="${compiler_prefix}x86_64-w64-mingw32-"
+ ;;
+esac
+
case "$LMI_COMPILER" in
(gcc)
valid_math="-frounding-math -fsignaling-nans"
# 'config_options' must not be double-quoted
# shellcheck disable=SC2086
"$wx_dir"/configure $config_options \
+ CC="${compiler_prefix}gcc" \
+ CXX="${compiler_prefix}g++" \
CPPFLAGS="-I$prefix/include" \
CFLAGS="$wx_cc_flags $valid_math" \
CXXFLAGS="$wx_cxx_flags $valid_math" \
@@ -132,8 +141,8 @@ case "$LMI_COMPILER" in
# 'config_options' must not be double-quoted
# shellcheck disable=SC2086
"$wx_dir"/configure $config_options \
- CC=clang \
- CXX=clang++ \
+ CC="${compiler_prefix}clang" \
+ CXX="${compiler_prefix}clang++" \
CPPFLAGS="-I$prefix/include" \
CFLAGS="$wx_cc_flags $valid_math" \
CXXFLAGS="$wx_cxx_flags $valid_math -stdlib=libc++" \
- [lmi] ccache with autotools,
Greg Chicares <=