[pacman-dev] [RFC PATCH] makepkg: add support for SAMUFLAGS, comparable to MAKEFLAGS

Eli Schwartz eschwartz at archlinux.org
Wed Jul 3 21:57:01 UTC 2019


SAMUFLAGS is recently added to the samurai build tool, an implementation
of the ninja build format (which is a competitor to Makefiles).
Currently, samurai implements support for -v (verbose) and -j
(configuring the number of parallel jobs) and rejects all other
SAMUFLAGS.

Adding SAMUFLAGS support to makepkg will allow users to configure how
many jobs to use when building packages, which is an important
consideration as the ninja build format is becoming fairly popular these
days; meson uses it exclusively, cmake can optionally output it, and it
can often speed up the time a build takes.

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---

Support for SAMUFLAGS is only in git master. See
https://github.com/michaelforney/samurai/pull/21 for discussion about
its implementation.

Submitting patch now for bikeshed purposes, but it "should" be safe to
pull in as there will hopefully be a new samurai release in a week or
two, and I expect this patch will take longer to review anyway, and even
longer for pacman 5.2 :p

Note: this overlaps with the RUSTFLAGS patch, and therefore depends on
it. In the unlikely event that this patch gets accepted *first*, I can
rebase it...

 doc/makepkg.conf.5.asciidoc                 | 9 +++++++--
 etc/makepkg.conf.in                         | 1 +
 scripts/libmakepkg/buildenv.sh.in           | 2 +-
 scripts/libmakepkg/buildenv/makeflags.sh.in | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/doc/makepkg.conf.5.asciidoc b/doc/makepkg.conf.5.asciidoc
index 3f37190d..27e1162e 100644
--- a/doc/makepkg.conf.5.asciidoc
+++ b/doc/makepkg.conf.5.asciidoc
@@ -82,8 +82,13 @@ Options
 	available linker flags.
 
 **MAKEFLAGS=**"makeflags"::
-	This is often used to set the number of jobs used; for example, `-j2`.
-	Other flags that make accepts can also be passed.
+	This is often used to set the number of jobs used in a Makefile; for
+	example, `-j2`. Other flags that make accepts can also be passed.
+
+**SAMUFLAGS=**"samuflags"::
+	This is often used to set the number of jobs used for the samurai build
+	tool; for example, `-j2`. Read linkman:samu[1] for more details on what
+	flags can be passed via `SAMUFLAGS`.
 
 **DEBUG_CFLAGS=**"debug_cflags"::
 	Additional compiler flags appended to `CFLAGS` for use in debugging. Usually
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index caf5114b..c2cd55f9 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -43,6 +43,7 @@ CHOST="@CHOST@"
 #RUSTFLAGS="-C opt-level=2"
 #-- Make Flags: change this for DistCC/SMP systems
 #MAKEFLAGS="-j2"
+#SAMUFLAGS="-j2"
 #-- Debugging flags
 #DEBUG_CFLAGS="-g"
 #DEBUG_CXXFLAGS="-g"
diff --git a/scripts/libmakepkg/buildenv.sh.in b/scripts/libmakepkg/buildenv.sh.in
index 2ecd741e..fa9404d3 100644
--- a/scripts/libmakepkg/buildenv.sh.in
+++ b/scripts/libmakepkg/buildenv.sh.in
@@ -36,5 +36,5 @@ prepare_buildenv() {
 	done
 
 	# ensure all necessary build variables are exported
-	export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST
+	export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS SAMUFLAGS CHOST
 }
diff --git a/scripts/libmakepkg/buildenv/makeflags.sh.in b/scripts/libmakepkg/buildenv/makeflags.sh.in
index 74605c22..52b5aaa6 100644
--- a/scripts/libmakepkg/buildenv/makeflags.sh.in
+++ b/scripts/libmakepkg/buildenv/makeflags.sh.in
@@ -30,6 +30,6 @@ buildenv_functions+=('buildenv_makeflags')
 
 buildenv_makeflags() {
 	if check_option "makeflags" "n"; then
-		unset MAKEFLAGS
+		unset MAKEFLAGS SAMUFLAGS
 	fi
 }
-- 
2.22.0


More information about the pacman-dev mailing list