Skip to content

Commit

Permalink
Enable usage of rust-sccache for cargo builds
Browse files Browse the repository at this point in the history
  • Loading branch information
icp1994 committed Feb 13, 2024
1 parent 09c286f commit ab97e5a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions common/build-helper/rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ else
unset CARGO_BUILD_TARGET
fi

if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
hostmakedepends+=" rust-sccache"
export RUSTC_WRAPPER="/usr/bin/sccache"
export SCCACHE_DIR="${XBPS_HOSTDIR}/sccache"
export SCCACHE_IDLE_TIMEOUT=30
fi

# prevent cargo stripping debug symbols
export CARGO_PROFILE_RELEASE_STRIP=false

Expand Down
4 changes: 2 additions & 2 deletions common/xbps-src/shutils/chroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ 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" \
PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
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

chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
Expand Down
6 changes: 6 additions & 0 deletions etc/defaults.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
#
#XBPS_CCACHE=yes

# [OPTIONAL]
# Enable or disable sccache when building packages. The sccache directory
# is stored in the hostdir, i.e hostdir/sccache.
#
#XBPS_SCCACHE=yes

# [OPTIONAL]
# Enable or disable distcc when building packages. The distcc directory
# is stored in the hostdir, i.e hostdir/distcc.
Expand Down
2 changes: 1 addition & 1 deletion xbps-src
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,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_SCCACHE XBPS_CCACHE 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 \
Expand Down

0 comments on commit ab97e5a

Please sign in to comment.