From 83032395e951148196faa2ac187f01751614e567 Mon Sep 17 00:00:00 2001 From: Artur Sinila Date: Thu, 6 May 2021 11:31:58 +0300 Subject: [PATCH] xbps-src: add sccache support --- README.md | 4 +++- common/build-helper/rust.sh | 4 ++++ common/xbps-src/shutils/chroot.sh | 2 +- srcpkgs/base-chroot/template | 6 +++--- xbps-src | 10 +++++++++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 315e6858bfaf..5a985360292f 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,7 @@ The following directory hierarchy is used with a default configuration file: |- hostdir | |- binpkgs ... | |- ccache ... + | |- sccache ... | |- distcc- ... | |- repocache ... | |- sources ... @@ -218,6 +219,7 @@ The description of these directories is as follows: - `builddir`: to unpack package source tarballs and where packages are built. - `destdir`: to install packages, aka **fake destdir**. - `hostdir/ccache`: to store ccache data if the `XBPS_CCACHE` option is enabled. + - `hostdir/sccache`: to store sccache data if the `XBPS_SCCACHE` option is enabled. - `hostdir/distcc-`: to store distcc data if the `XBPS_DISTCC` option is enabled. - `hostdir/repocache`: to store binary packages from remote repositories. - `hostdir/sources`: to store package sources. @@ -443,7 +445,7 @@ The default masterdir is created in the current working directory, i.e `void-pac ### Remaking the masterdir -If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a masterdir with two simple commands (please note that `zap` keeps your `ccache/distcc/host` directories intact): +If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a masterdir with two simple commands (please note that `zap` keeps your `ccache/sccache/distcc/host` directories intact): $ ./xbps-src zap $ ./xbps-src binary-bootstrap diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh index 431cb5f0fd43..994a66916b26 100644 --- a/common/build-helper/rust.sh +++ b/common/build-helper/rust.sh @@ -4,6 +4,10 @@ export CARGO_BUILD_JOBS="$XBPS_MAKEJOBS" export CARGO_HOME="/host/cargo" +if [ "$XBPS_SCCACHE" = "yes" ]; then + export RUSTC_WRAPPER="sccache" +fi + if [ "$CROSS_BUILD" ]; then # Define equivalent of TOML config in environment # [target.${RUST_TARGET}] diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh index c7ada3151618..735dcfebd12f 100644 --- a/common/xbps-src/shutils/chroot.sh +++ b/common/xbps-src/shutils/chroot.sh @@ -88,7 +88,7 @@ PATH=/void-packages:/usr/bin exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \ ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \ - CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \ + CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \ PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h _EOF diff --git a/srcpkgs/base-chroot/template b/srcpkgs/base-chroot/template index 78f6d0cc2a1d..cf4f8504de1e 100644 --- a/srcpkgs/base-chroot/template +++ b/srcpkgs/base-chroot/template @@ -1,7 +1,7 @@ # Template file for 'base-chroot' pkgname=base-chroot -version=0.66 -revision=3 +version=0.67 +revision=1 bootstrap=yes build_style=meta short_desc="Minimal set of packages required for chroot with xbps-src" @@ -17,6 +17,6 @@ esac depends+=" base-files binutils gcc gcc-ada libada-devel patch sed findutils diffutils make gzip coreutils - file bsdtar ccache xbps mpfr ncurses libreadline8 + file bsdtar ccache rust-sccache>=0.2.15 xbps mpfr ncurses libreadline8 chroot-bash chroot-grep chroot-gawk chroot-distcc chroot-util-linux chroot-git" diff --git a/xbps-src b/xbps-src index c3cd7e5db10b..d387b7a890d6 100755 --- a/xbps-src +++ b/xbps-src @@ -629,7 +629,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \ XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \ XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \ XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \ - XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \ + XBPS_CHECK_PKGS XBPS_CCACHE XBPS_SCCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \ XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \ XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \ XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \ @@ -672,6 +672,14 @@ if [ "$XBPS_CCACHE" ]; then mkdir -p $CCACHE_DIR fi +# +# Set up sccache +# +if [ "$XBPS_SCCACHE" ]; then + export SCCACHE_DIR="$XBPS_HOSTDIR/sccache" + mkdir -p $SCCACHE_DIR +fi + # # Set up distcc #