aboutsummaryrefslogtreecommitdiff
path: root/extra/nawk
diff options
context:
space:
mode:
Diffstat (limited to 'extra/nawk')
-rwxr-xr-xextra/nawk/build17
-rw-r--r--extra/nawk/checksums3
-rw-r--r--extra/nawk/depends1
-rw-r--r--extra/nawk/files/ninja.in52
-rw-r--r--extra/nawk/sources3
5 files changed, 67 insertions, 9 deletions
diff --git a/extra/nawk/build b/extra/nawk/build
index a5c7444d..f66d9693 100755
--- a/extra/nawk/build
+++ b/extra/nawk/build
@@ -1,11 +1,12 @@
#!/bin/sh -e
-yacc -o awkgram.tab.c -H awkgram.tab.h awkgram.y
+printf 'cflags = %s\nldflags = %s\ncc = %s\nyacc = %s\ndestdir = %s\n' \
+ "$CFLAGS -Wall -pedantic -Wcast-qual -O2" \
+ "$LDFLAGS -static" \
+ "${CC:-cc}" \
+ "${YACC:-yacc}" \
+ "$1" |
+cat - ninja.in > build.ninja
-make CFLAGS="$CFLAGS -static"
-clinst -Dm755 "a.out" "$1/usr/bin/nawk"
-ln -s /usr/bin/nawk "$1/usr/bin/awk"
-
-mv awk.1 nawk.1
-clman -d "$1" nawk.1
-ln -s nawk.1 "$1/usr/share/man/man1/awk.1"
+ninja
+ninja install
diff --git a/extra/nawk/checksums b/extra/nawk/checksums
index e69de29b..f266abe1 100644
--- a/extra/nawk/checksums
+++ b/extra/nawk/checksums
@@ -0,0 +1,3 @@
+%BLAKE3
+ae403d804c986443e26cc9130dd7160e28646e73ac3f9a350551c59b207dce0a f9affa922c5.tar.gz
+5d8e49d455712f69025108ddf2e4cd792a4bb37e1ae219641da4767c92e6fa5c ninja.in
diff --git a/extra/nawk/depends b/extra/nawk/depends
new file mode 100644
index 00000000..23d59890
--- /dev/null
+++ b/extra/nawk/depends
@@ -0,0 +1 @@
+samurai make
diff --git a/extra/nawk/files/ninja.in b/extra/nawk/files/ninja.in
new file mode 100644
index 00000000..004f1a20
--- /dev/null
+++ b/extra/nawk/files/ninja.in
@@ -0,0 +1,52 @@
+rule cc
+ command = $cc $cflags -MD -MF $out.d -c -o $out $in
+ description = CC $out
+ depfile = $out.d
+ deps = gcc
+
+rule link
+ command = $cc $ldflags -o $out $in
+ description = LINK $out
+
+rule yacc
+ command = $yacc -o awkgram.tab.c -H awkgram.tab.h awkgram.y
+ description = YACC $out
+
+rule maketab
+ command = ./maketab $in > $out
+
+rule custom
+ command = false
+ description =
+
+rule install-bin
+ command = clinst -Dm755 nawk "$destdir/usr/bin/nawk" && ln -s nawk "$destdir/usr/bin/awk"
+ description = Installing nawk and linking awk
+
+rule install-man
+ command = clman -d $destdir nawk.1 && ln -s nawk.1 "$destdir/usr/share/man/man1/awk.1"
+ description = Installing nawk.1 and linking awk.1
+
+build all: phony nawk
+build nawk: link b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o awkgram.tab.o
+build awkgram.tab.c awkgram.tab.h: yacc awkgram.y | awk.h proto.h
+build b.o: cc b.c
+build main.o: cc main.c
+build parse.o: cc parse.c
+build proctab.o: cc proctab.c
+build tran.o: cc tran.c
+build lib.o: cc lib.c
+build run.o: cc run.c
+build lex.o: cc lex.c
+build awkgram.tab.o: cc awkgram.tab.c
+build proctab.c: maketab awkgram.tab.h | maketab
+build maketab: link maketab.c
+build maketab.o: cc maketab.c | awkgram.tab.h
+build PHONY: phony
+build INSTALL_BIN: install-bin PHONY
+build INSTALL_MAN: install-man PHONY nawk.1
+build install: phony INSTALL_BIN INSTALL_MAN
+build nawk.1: custom awk.1
+ command = cp awk.1 nawk.1
+ description = GEN nawk.1
+default all
diff --git a/extra/nawk/sources b/extra/nawk/sources
index dd509169..1a848046 100644
--- a/extra/nawk/sources
+++ b/extra/nawk/sources
@@ -1 +1,2 @@
-git+https://github.com/onetrueawk/awk
+https://github.com/onetrueawk/awk/archive/f9affa922c5.tar.gz
+files/ninja.in