From 1b1772755aa2f37f98edc5fa18ddc9132c555adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Andrea=20Illanes=20Albornoz?= Date: Mon, 20 Mar 2023 18:06:04 +0100 Subject: Implements ccache integration. --- build.sh | 17 +++++++++++++++++ etc/README.md | 2 +- etc/build.usage | 2 +- etc/build.usage.short | 2 +- subr.ex/ex_pkg_env.subr | 11 ++--------- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index 99c97a1b..7402a721 100755 --- a/build.sh +++ b/build.sh @@ -85,6 +85,7 @@ buildp_init() { || ! ex_pkg_load_vars "${_bi_rstatus}" \$ARCH \$BUILD_KIND \ || ! ex_init_prereqs "${_bi_rstatus}" "${DEFAULT_PREREQS}" \ || ! buildp_init_args "${_bi_rstatus}" \ + || ! buildp_init_args_ccache "${_bi_rstatus}" \ || ! ex_init_files \ "${_bi_rstatus}" \ \$ARG_CLEAN_BUILDS \$ARG_DIST \ @@ -188,6 +189,21 @@ buildp_init_args() { return "${_bpia_rc}"; }; # }}} +# {{{ buildp_init_args_ccache($_rstatus) +buildp_init_args_ccache() { + local _bpiac_rstatus="${1#\$}" \ + _bpiac_target=""; + + if [ "${ARG_CCACHE:-0}" -eq 1 ]; then + for _bpiac_target in CROSS HOST NATIVE SOFORT_NATIVE; do + eval "DEFAULT_${_bpiac_target}_CC"=\"ccache \${DEFAULT_${_bpiac_target}_CC}\"; + eval "DEFAULT_${_bpiac_target}_CXX"=\"ccache \${DEFAULT_${_bpiac_target}_CXX}\"; + done; + fi; + + return 0; +}; +# }}} # {{{ buildp_init_getopts_fn(...) buildp_init_getopts_fn() { local _bpigf_rc=0 _bpigf_shiftfl=0; @@ -210,6 +226,7 @@ buildp_init_getopts_fn() { case "${_bpigf_opt}" in --as-needed) ARG_AS_NEEDED=1; _bpigf_shiftfl=1; ;; + --ccache) ARG_CCACHE=1; _bpigf_shiftfl=1; ;; --debug-minipx) ARG_DEBUG_MINIPIX=1; _bpigf_shiftfl=1; ;; --help) _bpigf_shiftfl=1; ;; --reset-state) ARG_RESET_PKG=1; _bpigf_shiftfl=1; ;; diff --git a/etc/README.md b/etc/README.md index 5fa748db..ef03485b 100644 --- a/etc/README.md +++ b/etc/README.md @@ -811,7 +811,7 @@ usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[ [-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]] [-R] [-v] [-V [+]tag|pat[,..]] - [--as-needed] [--debug-minipix] [--reset-state] [--roar] + [--as-needed] [--ccache] [--debug-minipix] [--reset-state] [--roar] [--theme theme] [[=]|=[ ..]] -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64. diff --git a/etc/build.usage b/etc/build.usage index ccba4be9..89bc2a41 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -3,7 +3,7 @@ [-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]] [-R] [-v] [-V [+]tag|pat[,..]] - [--as-needed] [--debug-minipix] [--reset-state] [--roar] + [--as-needed] [--ccache] [--debug-minipix] [--reset-state] [--roar] [--theme theme] [[=]<group>|<variable name>=<variable override>[ ..]] -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64. diff --git a/etc/build.usage.short b/etc/build.usage.short index db8ee464..579c8d1f 100644 --- a/etc/build.usage.short +++ b/etc/build.usage.short @@ -3,7 +3,7 @@ [-r [*[*[*]]]name[,..][:ALL|LAST|[^|<|<=|>|>=]step,..]] [-R] [-v] [-V [+]tag|pat[,..]] - [--as-needed] [--debug-minipix] [--reset-state] [--roar] + [--as-needed] [--ccache] [--debug-minipix] [--reset-state] [--roar] [--theme theme] [[=]<group>|<variable name>=<variable override>[ ..]] -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64. diff --git a/subr.ex/ex_pkg_env.subr b/subr.ex/ex_pkg_env.subr index f7ed3552..2f394e5b 100644 --- a/subr.ex/ex_pkg_env.subr +++ b/subr.ex/ex_pkg_env.subr @@ -68,8 +68,8 @@ exp_pkg_env_defaults() { # Return: zero (0) on success, non-zero (>0) on failure # exp_pkg_env_set() { - local _eppes_build_vars_default="${1}" _eppes_group_name="${2}" _eppes_pkg_name="${3}" \ - _eppes_cmd_name="" _eppes_lvars="" _eppes_var_prefixes="" _eppes_vars_set="" \ + local _eppes_build_vars_default="${1}" _eppes_group_name="${2}" _eppes_pkg_name="${3}" \ + _eppes_lvars="" _eppes_var_prefixes="" _eppes_vars_set="" \ _eppes_vars_unset="" _eppes_vname="" _eppes_vnames="" IFS IFS0; rtl_set_vars _eppes_vars_set BUILD_TYPE "DEFAULT ${_eppes_group_name} PKG_${_eppes_pkg_name}"; @@ -96,13 +96,6 @@ exp_pkg_env_set() { export "${_eppes_vname}"; done; IFS="${IFS0}"; - for _eppes_vname in AR CC CXX PKG_CONFIG RANLIB; do - if eval [ '"${PKG_'"${_eppes_vname}"':+1}"' = 1 ]\ - && eval [ '"${PKG_'"${_eppes_vname}"'#/}"' = '"${_eppes_cmd_name:=${PKG_'"${_eppes_vname}"'}}"' ]; then - eval PKG_${_eppes_vname}='$(which "${_eppes_cmd_name}")'; - fi; _eppes_cmd_name=""; - done; - return 0; }; -- cgit v1.2.3