crux-ports

My CRUX Linux ports
Log | Files | Refs | README

commit 7f8d9adc5b1bc307309c22c6fdcde9b509b81062
parent 720e44ce19bf3adb43d32727a53210efc21c5555
Author: Shokara Kou <kou@13f0.net>
Date:   Fri, 13 May 2022 11:35:31 -0400

add standalone mk and rc ports from plan9

Diffstat:
Amk/.footprint | 30++++++++++++++++++++++++++++++
Amk/.md5sum | 2++
Amk/Pkgfile | 20++++++++++++++++++++
Amk/makefile_destdir.patch | 122+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Arc/.footprint | 9+++++++++
Arc/.md5sum | 2++
Arc/Pkgfile | 23+++++++++++++++++++++++
Arc/frobnitzem-globals.patch | 265+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Arc/makefile.patch | 16++++++++++++++++
9 files changed, 489 insertions(+), 0 deletions(-)

diff --git a/mk/.footprint b/mk/.footprint @@ -0,0 +1,30 @@ +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/mk +drwxr-xr-x root/root usr/doc/ +-rw-r--r-- root/root usr/doc/mk.pdf +drwxr-xr-x root/root usr/include/ +-rw-r--r-- root/root usr/include/bio.h +-rw-r--r-- root/root usr/include/fmt.h +-rw-r--r-- root/root usr/include/regexp9.h +-rw-r--r-- root/root usr/include/utf.h +drwxr-xr-x root/root usr/lib/ +-rw-r--r-- root/root usr/lib/libbio.a +-rw-r--r-- root/root usr/lib/libfmt.a +-rw-r--r-- root/root usr/lib/libregexp9.a +-rw-r--r-- root/root usr/lib/libutf.a +drwxr-xr-x root/root usr/share/ +drwxr-xr-x root/root usr/share/man/ +drwxr-xr-x root/root usr/share/man/man1/ +-rw-r--r-- root/root usr/share/man/man1/mk.1.gz +drwxr-xr-x root/root usr/share/man/man3/ +-rw-r--r-- root/root usr/share/man/man3/bio.3.gz +-rw-r--r-- root/root usr/share/man/man3/fmtinstall.3.gz +-rw-r--r-- root/root usr/share/man/man3/isalpharune.3.gz +-rw-r--r-- root/root usr/share/man/man3/print.3.gz +-rw-r--r-- root/root usr/share/man/man3/regexp9.3.gz +-rw-r--r-- root/root usr/share/man/man3/rune.3.gz +-rw-r--r-- root/root usr/share/man/man3/runestrcat.3.gz +drwxr-xr-x root/root usr/share/man/man7/ +-rw-r--r-- root/root usr/share/man/man7/regexp9.7.gz +-rw-r--r-- root/root usr/share/man/man7/utf.7.gz diff --git a/mk/.md5sum b/mk/.md5sum @@ -0,0 +1,2 @@ +4cf585b5076cb487454baee0495e5352 makefile_destdir.patch +f3cd7b91cdece5efe55d41754438e658 mk-with-libs.tgz diff --git a/mk/Pkgfile b/mk/Pkgfile @@ -0,0 +1,20 @@ +# Description: Mk is a simple replacment for make +# URL: https://9fans.github.io/plan9port/unix +# Maintainer: Shokara Kou, kou at 13f0 dot net +# Depends on: + +name=mk +version=1 +release=1 +source=(https://9fans.github.io/plan9port/unix/$name-with-libs.tgz + makefile_destdir.patch) + +build() { + cd $name + + patch -Np1 <$SRC/makefile_destdir.patch + make PREFIX=/usr DESTDIR=$PKG install + + mv -f $PKG/usr/man/* $PKG/usr/share/man/ + rmdir $PKG/usr/man +} diff --git a/mk/makefile_destdir.patch b/mk/makefile_destdir.patch @@ -0,0 +1,122 @@ +diff -ur a/libbio/Makefile b/libbio/Makefile +--- a/libbio/Makefile 2022-05-09 13:46:34.071447416 -0400 ++++ b/libbio/Makefile 2022-05-09 13:47:41.857445218 -0400 +@@ -50,12 +50,12 @@ + all: $(LIB) + + install: $(LIB) +- mkdir -p $(PREFIX)/share/man/man3 +- install -m 0644 bio.3 $(PREFIX)/share/man/man3/bio.3 +- mkdir -p $(PREFIX)/include +- install -m 0644 bio.h $(PREFIX)/include +- mkdir -p $(PREFIX)/lib +- install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) ++ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 ++ install -m 0644 bio.3 $(DESTDIR)$(PREFIX)/share/man/man3/bio.3 ++ mkdir -p $(DESTDIR)$(PREFIX)/include ++ install -m 0644 bio.h $(DESTDIR)$(PREFIX)/include ++ mkdir -p $(DESTDIR)$(PREFIX)/lib ++ install -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) + + bcat: bcat.$O $(LIB) + $(CC) -o bcat bcat.$O $(LIB) -L/usr/local/lib -lfmt -lutf +diff -ur a/libfmt/Makefile b/libfmt/Makefile +--- a/libfmt/Makefile 2022-05-09 13:46:34.072447416 -0400 ++++ b/libfmt/Makefile 2022-05-09 13:48:10.943444275 -0400 +@@ -74,13 +74,13 @@ + all: $(LIB) + + install: $(LIB) +- test -d $(PREFIX)/share/man/man3 || mkdir -p $(PREFIX)/share/man/man3 +- install -m 0644 print.3 $(PREFIX)/share/man/man3/print.3 +- install -m 0644 fmtinstall.3 $(PREFIX)/share/man/man3/fmtinstall.3 +- mkdir -p $(PREFIX)/include +- install -m 0644 fmt.h $(PREFIX)/include/fmt.h +- mkdir -p $(PREFIX)/lib +- install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) ++ test -d $(DESTDIR)$(PREFIX)/share/man/man3 || mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 ++ install -m 0644 print.3 $(DESTDIR)$(PREFIX)/share/man/man3/print.3 ++ install -m 0644 fmtinstall.3 $(DESTDIR)$(PREFIX)/share/man/man3/fmtinstall.3 ++ mkdir -p $(DESTDIR)$(PREFIX)/include ++ install -m 0644 fmt.h $(DESTDIR)$(PREFIX)/include/fmt.h ++ mkdir -p $(DESTDIR)$(PREFIX)/lib ++ install -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) + + $(NAN).$O: nan.h + strtod.$O: nan.h +diff -ur a/libregexp/Makefile b/libregexp/Makefile +--- a/libregexp/Makefile 2022-05-09 13:46:34.071447416 -0400 ++++ b/libregexp/Makefile 2022-05-09 13:48:45.939443140 -0400 +@@ -41,13 +41,13 @@ + all: $(LIB) + + install: $(LIB) +- mkdir -p $(PREFIX)/share/man/man3 $(PREFIX)/man/man7 +- install -m 0644 regexp9.3 $(PREFIX)/share/man/man3/regexp9.3 +- install -m 0644 regexp9.7 $(PREFIX)/man/man7/regexp9.7 +- mkdir -p $(PREFIX)/lib +- install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) +- mkdir -p $(PREFIX)/include +- install -m 0644 regexp9.h $(PREFIX)/include/regexp9.h ++ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 $(DESTDIR)$(PREFIX)/man/man7 ++ install -m 0644 regexp9.3 $(DESTDIR)$(PREFIX)/share/man/man3/regexp9.3 ++ install -m 0644 regexp9.7 $(DESTDIR)$(PREFIX)/man/man7/regexp9.7 ++ mkdir -p $(DESTDIR)$(PREFIX)/lib ++ install -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) ++ mkdir -p $(DESTDIR)$(PREFIX)/include ++ install -m 0644 regexp9.h $(DESTDIR)$(PREFIX)/include/regexp9.h + + test: test.$O $(LIB) + $(CC) -o test test.$O $(LIB) -L/usr/local/lib -lfmt -lutf +diff -ur a/libutf/Makefile b/libutf/Makefile +--- a/libutf/Makefile 2022-05-09 13:46:34.071447416 -0400 ++++ b/libutf/Makefile 2022-05-09 13:49:10.549442342 -0400 +@@ -53,15 +53,15 @@ + all: $(LIB) + + install: $(LIB) +- mkdir -p $(PREFIX)/share/man/man3 $(PREFIX)/man/man7 +- install -c -m 0644 isalpharune.3 $(PREFIX)/share/man/man3/isalpharune.3 +- install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7 +- install -c -m 0644 rune.3 $(PREFIX)/share/man/man3/rune.3 +- install -c -m 0644 runestrcat.3 $(PREFIX)/share/man/man3/runestrcat.3 +- mkdir -p $(PREFIX)/include +- install -c -m 0644 utf.h $(PREFIX)/include/utf.h +- mkdir -p $(PREFIX)/lib +- install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) ++ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3 $(DESTDIR)$(PREFIX)/man/man7 ++ install -c -m 0644 isalpharune.3 $(DESTDIR)$(PREFIX)/share/man/man3/isalpharune.3 ++ install -c -m 0644 utf.7 $(DESTDIR)$(PREFIX)/man/man7/utf.7 ++ install -c -m 0644 rune.3 $(DESTDIR)$(PREFIX)/share/man/man3/rune.3 ++ install -c -m 0644 runestrcat.3 $(DESTDIR)$(PREFIX)/share/man/man3/runestrcat.3 ++ mkdir -p $(DESTDIR)$(PREFIX)/include ++ install -c -m 0644 utf.h $(DESTDIR)$(PREFIX)/include/utf.h ++ mkdir -p $(DESTDIR)$(PREFIX)/lib ++ install -c -m 0644 $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB) + + $(LIB): $(OFILES) + $(AR) $(ARFLAGS) $(LIB) $(OFILES) +diff -ur a/mk/Makefile b/mk/Makefile +--- a/mk/Makefile 2022-05-09 13:46:34.071447416 -0400 ++++ b/mk/Makefile 2022-05-09 13:49:41.475441339 -0400 +@@ -61,13 +61,13 @@ + TGZFILES+=mk.pdf + + install: $(TARG) +- mkdir -p $(PREFIX)/bin +- install -m 0755 mk $(PREFIX)/bin/mk +- cat mk.1 | sed 's;DOCPREFIX;$(PREFIX);g' >mk.1a +- mkdir -p $(PREFIX)/man/man1 +- install -m 0644 mk.1a $(PREFIX)/man/man1/mk.1 +- mkdir -p $(PREFIX)/doc +- install -m 0644 mk.pdf $(PREFIX)/doc/mk.pdf ++ mkdir -p $(DESTDIR)$(PREFIX)/bin ++ install -m 0755 mk $(DESTDIR)$(PREFIX)/bin/mk ++ sed 's;DOCPREFIX;$(PREFIX);g' <mk.1 >mk.1a ++ mkdir -p $(DESTDIR)$(PREFIX)/man/man1 ++ install -m 0644 mk.1a $(DESTDIR)$(PREFIX)/man/man1/mk.1 ++ mkdir -p $(DESTDIR)$(PREFIX)/doc ++ install -m 0644 mk.pdf $(DESTDIR)$(PREFIX)/doc/mk.pdf + + $(LIB): $(OFILES) + $(AR) $(ARFLAGS) $(LIB) $(OFILES) diff --git a/rc/.footprint b/rc/.footprint @@ -0,0 +1,9 @@ +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/rc +drwxr-xr-x root/root usr/lib/ +-rw-r--r-- root/root usr/lib/rcmain +drwxr-xr-x root/root usr/share/ +drwxr-xr-x root/root usr/share/man/ +drwxr-xr-x root/root usr/share/man/man1/ +-rw-r--r-- root/root usr/share/man/man1/rc.1.gz diff --git a/rc/.md5sum b/rc/.md5sum @@ -0,0 +1,2 @@ +dee21069ebf18a311961443314aa4015 destdir.patch +7493a450d80bcd01c5c55a3a2892607e frobnitzem-globals.patch diff --git a/rc/Pkgfile b/rc/Pkgfile @@ -0,0 +1,23 @@ +# Description: standalone Unix port for Plan 9's shell rc +# URL: https://github.com/benavento/rc +# Maintainer: Shokara Kou, kou at 13f0 dot net +# Depends on: + +name=rc +commit=50b729e +version=git-$commit +release=1 +source=(makefile.patch frobnitzem-globals.patch) + +cloneurl=https://github.com/benavento/rc + +build() { + git clone $cloneurl + cd $name + git checkout $commit + + patch -Np1 <$SRC/makefile.patch + patch -Np1 <$SRC/frobnitzem-globals.patch + + make DESTDIR=$PKG PREFIX=/usr install +} diff --git a/rc/frobnitzem-globals.patch b/rc/frobnitzem-globals.patch @@ -0,0 +1,265 @@ +commit 553b6890624d04e64ca0973d8fe86b107cb363b7 +Author: David M. Rogers <predictivestatmech@gmail.com> +Date: Wed Oct 13 11:45:42 2021 -0400 + + Moved global variables into globals.c + +diff --git a/Makefile b/Makefile +index 6de563b..c8b7566 100644 +--- a/Makefile ++++ b/Makefile +@@ -3,6 +3,7 @@ include Make.$(shell uname) + TARG=rc + + OFILES=\ ++ globals.$O \ + code.$O\ + exec.$O\ + getflags.$O\ +diff --git a/code.c b/code.c +index eeaa3ed..876da4b 100644 +--- a/code.c ++++ b/code.c +@@ -15,7 +15,6 @@ char *fnstr(tree*); + void outcode(tree*, int); + void codeswitch(tree*, int); + int iscase(tree*); +-code *codecopy(code*); + void codefree(code*); + + int +diff --git a/exec.c b/exec.c +index 3ad8a0d..a24cd74 100644 +--- a/exec.c ++++ b/exec.c +@@ -6,7 +6,6 @@ + /* + * Start executing the given code at the given pc with the given redirection + */ +-char *argv0="rc"; + + void + start(code *c, int pc, var *local) +diff --git a/exec.h b/exec.h +index 06d2991..fcab495 100644 +--- a/exec.h ++++ b/exec.h +@@ -56,18 +56,22 @@ struct thread{ + tree *treenodes; /* tree nodes created by this process */ + thread *ret; /* who continues when this finishes */ + }; +-thread *runq; ++ + code *codecopy(code*); +-code *codebuf; /* compiler output */ +-int ntrap; /* number of outstanding traps */ +-int trap[NSIG]; /* number of outstanding traps per type */ ++ ++/* globals.c */ ++extern thread *runq; ++extern code *codebuf; /* compiler output */ ++extern int ntrap; /* number of outstanding traps */ ++extern int trap[NSIG]; /* number of outstanding traps per type */ ++extern int eflagok; /* kludge flag so that -e doesn't exit in startup */ ++extern int havefork; ++ + struct builtin{ + char *name; + void (*fnc)(void); + }; + extern struct builtin Builtin[]; +-int eflagok; /* kludge flag so that -e doesn't exit in startup */ +-int havefork; + + void execcd(void), execwhatis(void), execeval(void), execexec(void); + int execforkexec(void); +diff --git a/globals.c b/globals.c +new file mode 100644 +index 0000000..b29bfe3 +--- /dev/null ++++ b/globals.c +@@ -0,0 +1,30 @@ ++#include "rc.h" ++#include "io.h" ++ ++int mypid; ++ ++/* globals associated with lex.c and subr.c */ ++int doprompt = 1; /* is it time for a prompt? */ ++int lastdol; /* was the last token read '$' or '$#' or '"'? */ ++int lastword; /* was the last token read a word or compound word terminator? */ ++char tok[NTOK]; ++int ndot = 0; // FIXME - never decreases? ++int lastc; ++int lastword; ++int kidpid; ++ ++io *rc_err; ++ ++/* globals associated with exec.c */ ++char *promptstr; ++tree *cmdtree; ++thread *runq; ++code *codebuf; /* compiler output */ ++int ntrap; /* number of outstanding traps */ ++int trap[NSIG]; /* number of outstanding traps per type */ ++int eflagok; /* kludge flag so that -e doesn't exit in startup */ ++ ++char *argv0="rc"; ++var *gvar[NVAR]; /* hash for globals */ ++ ++int nerror = 0; /* number of errors encountered during compilation */ +diff --git a/io.h b/io.h +index 21cc6b8..68b9e89 100644 +--- a/io.h ++++ b/io.h +@@ -10,7 +10,7 @@ struct io{ + int fd; + char *bufp, *ebuf, *strp, buf[NBUF]; + }; +-io *err; ++extern io *err; + io *openfd(int), *openstr(void), *opencore(char *, int); + int emptybuf(io*); + void pchr(io*, int); +diff --git a/lex.c b/lex.c +index d2bef32..f1e40e2 100644 +--- a/lex.c ++++ b/lex.c +@@ -3,7 +3,11 @@ + #include "io.h" + #include "getflags.h" + #include "fns.h" +-int getnext(void); ++ ++static int future = EOF; ++static int inquote; ++static int incomm; ++static int getnext(void); + + int + wordchr(int c) +@@ -21,10 +25,6 @@ idchr(int c) + */ + return c>' ' && !strchr("!\"#$%&'()+,-./:;<=>?@[\\]^`{|}~", c); + } +-int future = EOF; +-int doprompt = 1; +-int inquote; +-int incomm; + /* + * Look ahead in the input stream + */ +@@ -52,7 +52,7 @@ advance(void) + * read a character from the input stream + */ + +-int ++static int + getnext(void) + { + int c; +@@ -163,8 +163,6 @@ addutf(char *p, int c) + } + return p; + } +-int lastdol; /* was the last token read '$' or '$#' or '"'? */ +-int lastword; /* was the last token read a word or compound word terminator? */ + + int + yylex(void) +diff --git a/rc.h b/rc.h +index 8a6a5bb..1d87051 100644 +--- a/rc.h ++++ b/rc.h +@@ -53,7 +53,7 @@ tree *mung1(tree*, tree*), *mung2(tree*, tree*, tree*); + tree *mung3(tree*, tree*, tree*, tree*), *epimung(tree*, tree*); + tree *simplemung(tree*), *heredoc(tree*); + void freetree(tree*); +-tree *cmdtree; ++extern tree *cmdtree; + /* + * The first word of any code vector is a reference count. + * Always create a new reference to a code vector by calling codecopy(.). +@@ -64,10 +64,10 @@ union code{ + int i; + char *s; + }; +-char *promptstr; +-int doprompt; ++extern char *promptstr; ++extern int doprompt; + #define NTOK 8192 +-char tok[NTOK]; ++extern char tok[NTOK]; + #define APPEND 1 + #define WRITE 2 + #define READ 3 +@@ -87,7 +87,7 @@ struct var{ + }; + var *vlook(char*), *gvlook(char*), *newvar(char*, var*); + #define NVAR 521 +-var *gvar[NVAR]; /* hash for globals */ ++extern var *gvar[NVAR]; /* hash for globals */ + #define new(type) ((type *)emalloc(sizeof(type))) + void *emalloc(long); + void *Malloc(ulong); +@@ -98,7 +98,7 @@ struct here{ + char *name; + struct here *next; + }; +-int mypid; ++extern int mypid; + /* + * Glob character escape in strings: + * In a string, GLOB must be followed by *?[ or GLOB. +@@ -117,10 +117,13 @@ int mypid; + #define threebyte(c) ((c&0xf0)==0xe0) + #define fourbyte(c) ((c&0xf8)==0xf0) + +-char **argp; +-char **args; +-int nerror; /* number of errors encountered during compilation */ +-int doprompt; /* is it time for a prompt? */ ++extern char *argv0; ++//char **argp; ++//char **args; ++extern int nerror; /* number of errors encountered during compilation */ ++extern int doprompt; /* is it time for a prompt? */ ++extern int lastword, lastdol; ++ + /* + * Which fds are the reading/writing end of a pipe? + * Unfortunately, this can vary from system to system. +@@ -129,14 +132,14 @@ int doprompt; /* is it time for a prompt? */ + */ + #define PRD 0 + #define PWR 1 +-char *Rcmain, *Fdprefix; ++extern char *Rcmain, *Fdprefix; + #define register + /* + * How many dot commands have we executed? + * Used to ensure that -v flag doesn't print rcmain. + */ +-int ndot; ++extern int ndot; + char *getstatus(void); +-int lastc; +-int lastword; +-int kidpid; ++extern int lastc; ++extern int lastword; ++extern int kidpid; +diff --git a/subr.c b/subr.c +index a2d8a18..1fe3b9b 100644 +--- a/subr.c ++++ b/subr.c +@@ -22,7 +22,6 @@ efree(void *p) + free(p); + else pfmt(err, "free 0\n"); + } +-extern int lastword, lastdol; + + void + yyerror(char *m) diff --git a/rc/makefile.patch b/rc/makefile.patch @@ -0,0 +1,16 @@ +diff -ur a/Makefile b/Makefile +--- a/Makefile 2022-05-10 23:02:55.921563498 -0400 ++++ b/Makefile 2022-05-10 23:03:49.446561763 -0400 +@@ -46,9 +46,9 @@ + cmp -s x.tab.h y.tab.h || cp y.tab.h x.tab.h + + install: all rcmain.unix rc.1 +- install -m 755 $(TARG) $(PREFIX)/bin +- install -m 644 rcmain.unix $(PREFIX)/lib/rcmain +- install -m 644 rc.1 $(PREFIX)/share/man/man1 ++ install -Dm755 -t $(DESTDIR)$(PREFIX)/bin $(TARG) ++ install -Dm644 rcmain.unix $(DESTDIR)$(PREFIX)/lib/rcmain ++ install -Dm644 -t $(DESTDIR)$(PREFIX)/share/man/man1 rc.1 + + %: %.c $(HFILES) + $(CC) $(ARCHS) -o $@ $< $(LFLAGS)