Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ See [Contributing](./CONTRIBUTING.md) for a general overview of how to contribut
- [Package build options](#build-options)
- [Sharing and signing your local repositories](#sharing-and-signing)
- [Rebuilding and overwriting existing local packages](#rebuilding)
- [Enabling ccache for caching C and C++ compilation](#ccache)
- [Enabling sccache for caching Rust compilation](#sccache)
- [Enabling distcc for distributed compilation](#distcc)
- [Distfiles mirrors](#distfiles-mirrors)
- [Cross compiling packages for a target architecture](#cross-compiling)
Expand Down Expand Up @@ -201,6 +203,7 @@ The following directory hierarchy is used with a default configuration file:
|- hostdir
| |- binpkgs ...
| |- ccache ...
| |- sccache ...
| |- distcc-<arch> ...
| |- repocache ...
| |- sources ...
Expand All @@ -218,6 +221,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-<arch>`: 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.
Expand Down Expand Up @@ -344,6 +348,25 @@ Reinstalling this package in your target `rootdir` can be easily done too:
> Please note that the `package expression` must be properly defined to explicitly pick up
the package from the desired repository.


<a name="ccache"></a>
### Enabling ccache for caching C and C++ compilation

Add this line to `void-packages/etc/conf` file:

XBPS_CCACHE=yes

<a name="sccache"></a>
### Enabling sccache for caching Rust compilation

Install `rust-sccache` into `void-packages/masterdir/`:

xbps-install -r masterdir/ rust-sccache

Add this line to `void-packages/etc/conf` file:

XBPS_SCCACHE=yes

<a name="distcc"></a>
### Enabling distcc for distributed compilation

Expand Down Expand Up @@ -443,7 +466,7 @@ The default masterdir is created in the current working directory, i.e `void-pac
<a name="remaking-masterdir"></a>
### 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
Expand Down
4 changes: 4 additions & 0 deletions common/build-helper/rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
export CARGO_BUILD_JOBS="$XBPS_MAKEJOBS"
export CARGO_HOME="/host/cargo"

if [ -n "$XBPS_SCCACHE" ]; then
export RUSTC_WRAPPER="sccache"
fi

if [ "$CROSS_BUILD" ]; then
# Define equivalent of TOML config in environment
# [target.${RUST_TARGET}]
Expand Down
2 changes: 1 addition & 1 deletion common/xbps-src/shutils/chroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions etc/defaults.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ 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. In order to use sccache,
# you should install it by running `xbps-install -r masterdir/ rust-sccache`
# in the root directory of `void-packages` repository
#
#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
10 changes: 9 additions & 1 deletion xbps-src
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
#
Expand Down