From 6eedb570a29c91c8c47dbb2132a0414ad24f089f Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 18 Apr 2021 09:13:16 +0200 Subject: [PATCH] Ports: Enable building ports with ccache --- Ports/.hosted_defs.sh | 1 + Ports/.port_include.sh | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Ports/.hosted_defs.sh b/Ports/.hosted_defs.sh index de8d3b92ec..64691c5097 100644 --- a/Ports/.hosted_defs.sh +++ b/Ports/.hosted_defs.sh @@ -9,5 +9,6 @@ export PATH="${SERENITY_ROOT}/Toolchain/Local/${SERENITY_ARCH}/bin:${PATH}" export PKG_CONFIG_DIR="" export PKG_CONFIG_SYSROOT_DIR="${SERENITY_BUILD_DIR}/Root" export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/usr/lib/pkgconfig/:${PKG_CONFIG_SYSROOT_DIR}/usr/local/lib/pkgconfig" +enable_ccache DESTDIR="${SERENITY_BUILD_DIR}/Root" diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index eb7c2edacf..0f6e2b084c 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -21,6 +21,13 @@ maybe_source() { fi } +enable_ccache() { + if command -v ccache &>/dev/null; then + export CC="ccache ${CC}" + export CXX="ccache ${CXX}" + fi +} + target_env() { maybe_source "${SCRIPT}/.hosted_defs.sh" } @@ -36,6 +43,7 @@ host_env() { export PKG_CONFIG_DIR="${HOST_PKG_CONFIG_DIR}" export PKG_CONFIG_SYSROOT_DIR="${HOST_PKG_CONFIG_SYSROOT_DIR}" export PKG_CONFIG_LIBDIR="${HOST_PKG_CONFIG_LIBDIR}" + enable_ccache } packagesdb="${DESTDIR}/usr/Ports/packages.db"