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"