aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xextra/samurai/build18
-rw-r--r--extra/samurai/checksums4
-rw-r--r--extra/samurai/files/ninja.in33
-rw-r--r--extra/samurai/sources1
4 files changed, 53 insertions, 3 deletions
diff --git a/extra/samurai/build b/extra/samurai/build
index 547d1464..8503932d 100755
--- a/extra/samurai/build
+++ b/extra/samurai/build
@@ -1,7 +1,21 @@
#!/bin/sh -e
-make PREFIX=/usr LDFLAGS="$LDFLAGS -static"
-make PREFIX=/usr DESTDIR="$1" install
+export LDFLAGS="$LDFLAGS -static"
+
+# Samurai is faster than make, so we prefer using it instead if available
+if cpt l -q samurai; then
+ cat - ninja.in <<EOF> build.ninja
+destdir = $1
+cc = ${CC:-cc}
+cflags = -std=c99 -Wall -Wextra -Wpedantic -Wno-unused-parameter $CFLAGS
+ldflags = -static $LDFLAGS
+EOF
+ ninja
+ ninja install
+else
+ make PREFIX=/usr LDFLAGS="$LDFLAGS"
+ make PREFIX=/usr DESTDIR="$1" install
+fi
ln -s samu "$1/usr/bin/ninja"
ln -s samu.1 "$1/usr/share/man/man1/ninja.1"
diff --git a/extra/samurai/checksums b/extra/samurai/checksums
index bdeba085..fc23909e 100644
--- a/extra/samurai/checksums
+++ b/extra/samurai/checksums
@@ -1 +1,3 @@
-3b8cf51548dfc49b7efe035e191ff5e1963ebc4fe8f6064a5eefc5343eaf78a5 samurai-1.2.tar.gz
+%BLAKE3
+9f0315f1f6e123eb32c8cdb5fe98bcca1f1d2f4ca2617675476568cf3ddc07da samurai-1.2.tar.gz
+f0012d84a4697d81793f89d5387dbcbd43a43ee8cab93357a8d1082dce0ce3d1 ninja.in
diff --git a/extra/samurai/files/ninja.in b/extra/samurai/files/ninja.in
new file mode 100644
index 00000000..c648e47c
--- /dev/null
+++ b/extra/samurai/files/ninja.in
@@ -0,0 +1,33 @@
+rule cc
+ command = $cc $cflags -c -o $out $in
+ description = Compiling C object $out
+rule link
+ command = $cc $ldflags -o $out $in
+ description = Linking $out
+rule custom
+ command = $COMMAND
+ description = $DESC
+
+build build.o: cc build.c
+build deps.o: cc deps.c
+build env.o: cc env.c
+build graph.o: cc graph.c
+build htab.o: cc htab.c
+build log.o: cc log.c
+build parse.o: cc parse.c
+build samu.o: cc samu.c
+build scan.o: cc scan.c
+build tool.o: cc tool.c
+build tree.o: cc tree.c
+build util.o: cc util.c
+build samu: link build.o deps.o env.o graph.o htab.o log.o parse.o samu.o scan.o tool.o tree.o util.o
+build install: phony bin-install man-install
+build PHONY: phony
+build bin-install: custom PHONY samu
+ COMMAND = clinst -Dm755 samu $destdir/usr/bin/samu
+ DESC = Installing samu
+build man-install: custom PHONY
+ COMMAND = clman -d $destdir samu.1
+ DESC = Installing manual page samu.1
+
+default samu
diff --git a/extra/samurai/sources b/extra/samurai/sources
index 21221898..e10d2035 100644
--- a/extra/samurai/sources
+++ b/extra/samurai/sources
@@ -1 +1,2 @@
https://github.com/michaelforney/samurai/releases/download/1.2/samurai-1.2.tar.gz
+files/ninja.in