aboutsummaryrefslogtreecommitdiff
path: root/core/samurai
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-08-30 11:30:48 +0300
committerCem Keylan <cem@ckyln.com>2021-08-30 11:30:48 +0300
commit718d8642f46293da5d182e631d717428c3d6e7e5 (patch)
treeb82ae9b191569214e3b7acae1a2b2f275623d3ca /core/samurai
parentc6b37618f5edb567d307a95a07da2a042bc17f02 (diff)
downloadrepository-718d8642f46293da5d182e631d717428c3d6e7e5.tar.gz
samurai: move to core
Diffstat (limited to 'core/samurai')
-rwxr-xr-xcore/samurai/build21
-rw-r--r--core/samurai/checksums3
-rw-r--r--core/samurai/files/ninja.in33
-rw-r--r--core/samurai/meta3
-rw-r--r--core/samurai/sources2
-rw-r--r--core/samurai/version1
6 files changed, 63 insertions, 0 deletions
diff --git a/core/samurai/build b/core/samurai/build
new file mode 100755
index 00000000..8503932d
--- /dev/null
+++ b/core/samurai/build
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+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/core/samurai/checksums b/core/samurai/checksums
new file mode 100644
index 00000000..fc23909e
--- /dev/null
+++ b/core/samurai/checksums
@@ -0,0 +1,3 @@
+%BLAKE3
+9f0315f1f6e123eb32c8cdb5fe98bcca1f1d2f4ca2617675476568cf3ddc07da samurai-1.2.tar.gz
+f0012d84a4697d81793f89d5387dbcbd43a43ee8cab93357a8d1082dce0ce3d1 ninja.in
diff --git a/core/samurai/files/ninja.in b/core/samurai/files/ninja.in
new file mode 100644
index 00000000..c648e47c
--- /dev/null
+++ b/core/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/core/samurai/meta b/core/samurai/meta
new file mode 100644
index 00000000..7f8d1339
--- /dev/null
+++ b/core/samurai/meta
@@ -0,0 +1,3 @@
+description: Ninja-compatible build tool written in C99
+license: MIT, Apache-2.0
+maintainer: Cem Keylan <cem@carbslinux.org>
diff --git a/core/samurai/sources b/core/samurai/sources
new file mode 100644
index 00000000..e10d2035
--- /dev/null
+++ b/core/samurai/sources
@@ -0,0 +1,2 @@
+https://github.com/michaelforney/samurai/releases/download/1.2/samurai-1.2.tar.gz
+files/ninja.in
diff --git a/core/samurai/version b/core/samurai/version
new file mode 100644
index 00000000..f76d8346
--- /dev/null
+++ b/core/samurai/version
@@ -0,0 +1 @@
+1.2 1