Github messages for voidlinux
 help / color / mirror / Atom feed
From: Logarithmus <Logarithmus@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] xbps-src: add sccache support
Date: Thu, 06 May 2021 14:47:34 +0200	[thread overview]
Message-ID: <20210506124734.FJm983MyEr4SIlgy13ZHLZyxNZe3gcHoBBGVXGUh6zI@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-30702@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

There is an updated pull request by Logarithmus against master on the void-packages repository

https://github.com/Logarithmus/void-packages xbps-sccache
https://github.com/void-linux/void-packages/pull/30702

xbps-src: add sccache support
This PR adds support for using `sccache` when building `cargo` crates with `xbps-src`, just like `ccache`.
Unfortunately, this PR is blocked by https://github.com/void-linux/void-packages/pull/29756.


A patch file from https://github.com/void-linux/void-packages/pull/30702.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-xbps-sccache-30702.patch --]
[-- Type: text/x-diff, Size: 6427 bytes --]

From 7525d3bbb99a13f5acb56a03f58653ca18baa42b Mon Sep 17 00:00:00 2001
From: Artur Sinila <freesoftware@logarithmus.dev>
Date: Thu, 6 May 2021 11:31:58 +0300
Subject: [PATCH] xbps-src: add sccache support

---
 README.md                         | 25 ++++++++++++++++++++++++-
 common/build-helper/rust.sh       |  4 ++++
 common/xbps-src/shutils/chroot.sh |  2 +-
 etc/defaults.conf                 |  8 ++++++++
 xbps-src                          | 10 +++++++++-
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 315e6858bfaf..6874991c08ca 100644
--- a/README.md
+++ b/README.md
@@ -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)
@@ -201,6 +203,7 @@ The following directory hierarchy is used with a default configuration file:
             |- hostdir
             |  |- binpkgs ...
             |  |- ccache ...
+            |  |- sccache ...
             |  |- distcc-<arch> ...
             |  |- repocache ...
             |  |- sources ...
@@ -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.
@@ -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
 
@@ -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
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/etc/defaults.conf b/etc/defaults.conf
index 6147954a18af..5ab84a8eacc8 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -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.
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
 #

  parent reply	other threads:[~2021-05-06 12:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06  9:33 [PR PATCH] " Logarithmus
2021-05-06 10:16 ` [PR REVIEW] " q66
2021-05-06 10:24 ` Logarithmus
2021-05-06 10:24 ` Logarithmus
2021-05-06 10:26 ` Logarithmus
2021-05-06 10:48 ` q66
2021-05-06 12:19 ` Logarithmus
2021-05-06 12:23 ` Logarithmus
2021-05-06 12:28 ` Piraty
2021-05-06 12:39 ` [PR REVIEW] " q66
2021-05-06 12:40 ` q66
2021-05-06 12:45 ` [PR PATCH] [Updated] " Logarithmus
2021-05-06 12:45 ` [PR REVIEW] " q66
2021-05-06 12:47 ` Logarithmus [this message]
2021-05-06 12:54 ` ericonr
2021-05-06 12:59 ` Duncaen
2021-05-06 13:36 ` Logarithmus
2021-05-06 13:39 ` [PR PATCH] [Updated] " Logarithmus
2021-05-06 13:39 ` [PR REVIEW] " Logarithmus
2021-05-06 14:07 ` Johnnynator
2021-05-06 14:48 ` Logarithmus
2021-05-06 14:52 ` ericonr
2021-05-06 14:52 ` ericonr
2022-05-19  2:16 ` github-actions
2022-06-03  2:11 ` [PR PATCH] [Closed]: " github-actions

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210506124734.FJm983MyEr4SIlgy13ZHLZyxNZe3gcHoBBGVXGUh6zI@z \
    --to=logarithmus@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).