linux-qubasis

linux oasis port as a qubes template

git clone https://9o.is/git/linux-qubasis.git

commit 2b583ff0caa34425f63841609fd5e95d058636e8
parent 88b8b88c5d869814eb4e06484969b307499fcc23
Author: Jul <jul@9o.is>
Date:   Mon, 25 Aug 2025 20:44:33 +0800

add less

Diffstat:
Mgen.sh | 1+
Mninja/functions.sh | 27+++++++++++++++++++++++----
Aninja/rsp.awk | 35+++++++++++++++++++++++++++++++++++
Mninja/rules.ninja | 4++++
Apkg/less/gen.sh | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/less/include/defines.h | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/less/version | 4++++
Mpkg/netbsd-curses/gen.sh | 2+-
Mtpl/example/gen.sh | 5+++++
9 files changed, 285 insertions(+), 5 deletions(-)

diff --git a/gen.sh b/gen.sh @@ -16,6 +16,7 @@ setv ldflags $TARGET_LDFLAGS include $basedir/ninja/rules.ninja subgen pkg/abduco +subgen pkg/less subgen pkg/mandoc subgen pkg/netbsd-curses subgen pkg/oksh diff --git a/ninja/functions.sh b/ninja/functions.sh @@ -67,10 +67,18 @@ sym() { } man() { + local src="$1" + local sec="${2-}" + local out="${src##*/}" + + if [ "$sec" ]; then + out="${out%.*}.$sec" + fi + if [ "$GZMAN" = 'true' ]; then - gzip $1 ${1##*/} + gzip $src $out else - copy $1 ${1##*/} + copy $src $out fi } @@ -251,6 +259,7 @@ _ninja_initglobals() { _ninja_buffer_builds= _ninja_buffer_exe= _ninja_buffer_lib= + _ninja_buffer_d= _ninja_buffer_deps= _ninja_buffer_headers= _ninja_buffer_sync= @@ -340,9 +349,12 @@ _ninja_compile() { build cc $obj $src objs="$objs $obj" ;; - *.[ao]|*.a.d) + *.[ao]) objs="$objs $src" ;; + *.a.d) + _ninja_buffer_d="$_ninja_buffer_d $src" + ;; *) printf "Error gen $_ninja_file: unknown file to compile: %s\n" "$src" exit 1 @@ -365,9 +377,16 @@ _ninja_flush_exe() { if [ "$objs" ]; then build link $out $objs + + if [ "$_ninja_buffer_d" ]; then + bind ldlibs @$outdir/rsp/${out##*/} + build awk $outdir/rsp/${out##*/} $_ninja_buffer_d '|' $basedir/ninja/rsp.awk + bind expr '-f $basedir/ninja/rsp.awk' + fi fi _ninja_buffer_exe= + _ninja_buffer_d= } _ninja_flush_lib() { @@ -451,7 +470,7 @@ _ninja_flush_headers() { if [ "$_ninja_buffer_headers" ]; then local src='' for src in $_ninja_buffer_headers; do - build copy $outdir/headers/${src##*/} $src + build copy $outdir/include/${src##*/} $src done build phony $gendir/headers$_ninja_sub "$_ninja_buffer_headers" diff --git a/ninja/rsp.awk b/ninja/rsp.awk @@ -0,0 +1,35 @@ +function line() { + if (match($0, /\.d$/)) + read($0) + else + libs[++n] = $0 +} + +function read(name) { + for (;;) { + ret = getline < name + if (ret < 0) { + print "failed to read line from " name > "/proc/self/fd/2" + exit(1) + } + if (ret == 0) + break + line() + } + close(name) +} + +{line()} + +END { + for (i = n; i > 0; --i) { + lib = libs[i] + if (lib in seen) + continue + seen[lib] = 1 + uniq[++m] = lib + } + for (i = m; i > 0; --i) + print uniq[i] +} + diff --git a/ninja/rules.ninja b/ninja/rules.ninja @@ -38,6 +38,10 @@ rule gzip command = gzip -c -9 -n <$in >$out description = GZIP $out +rule awk + command = awk $expr $in >$out + description = AWK $out + rule rsp command = ln -f $rspfile $out description = RSP $out diff --git a/pkg/less/gen.sh b/pkg/less/gen.sh @@ -0,0 +1,68 @@ +cflags -std=c99 \ + -D _XOPEN_SOURCE=700 \ + -I $dir/include \ + -I $builddir/pkg/netbsd-curses/include \ + -Wno-type-limits \ + -Wno-maybe-uninitialized \ + -Wno-sign-compare \ + -Wno-unused-parameter + +deps netbsd-curses/headers + +compile lesskey_parse.c +compile version.c +compile xbuf.c +sync lesskey_parse.c +sync version.c +sync xbuf.c + +exe less brac.c \ + ch.c \ + charset.c \ + cmdbuf.c \ + command.c \ + cvt.c \ + decode.c \ + edit.c \ + evar.c \ + filename.c \ + forwback.c \ + help.c \ + ifile.c \ + input.c \ + jump.c \ + line.c \ + linenum.c \ + lsystem.c \ + main.c \ + mark.c \ + optfunc.c \ + option.c \ + opttbl.c \ + os.c \ + output.c \ + pattern.c \ + position.c \ + prompt.c \ + screen.c \ + search.c \ + signal.c \ + tags.c \ + ttyin.c \ + $objdir/lesskey_parse.c.o \ + $objdir/version.c.o \ + $objdir/xbuf.c.o \ + $builddir/pkg/netbsd-curses/libcurses.a.d + +exe lessecho lessecho.c \ + $objdir/version.c.o + +exe lesskey lesskey.c \ + $objdir/lesskey_parse.c.o \ + $objdir/version.c.o \ + $objdir/xbuf.c.o + +sym more less +man less.nro 1 +man lessecho.nro 1 +man lesskey.nro 1 diff --git a/pkg/less/include/defines.h b/pkg/less/include/defines.h @@ -0,0 +1,144 @@ +#define SYSDIR "/etc" + +#define SECURE SECURE_COMPILE +#define SHELL_ESCAPE (!SECURE) +#define EXAMINE (!SECURE) +#define TAB_COMPLETE_FILENAME (!SECURE) +#define CMD_HISTORY 1 +#define HILITE_SEARCH 1 +#define EDITOR (!SECURE) +#define TAGS (!SECURE) +#define USERFILE (!SECURE) +#define GLOB (!SECURE) +#define PIPEC (!SECURE && HAVE_POPEN) +#define LOGFILE (!SECURE) +#define GNU_OPTIONS 1 +#define ONLY_RETURN 0 +#define LESSKEYFILE ".less" +#define LESSKEYFILE_SYS SYSDIR "/sysless" +#define DEF_LESSKEYINFILE ".lesskey" +#define LESSKEYINFILE_SYS SYSDIR "/syslesskey" +#define LESSHISTFILE ".lesshst" +#define MSDOS_COMPILER 0 +#define PATHNAME_SEP "/" +#define TGETENT_OK 1 +#define HAVE_ANSI_PROTOS 1 +#define HAVE_SYS_TYPES_H 1 +/* #undef HAVE_SGSTAT_H */ +#define HAVE_PERROR 1 +#define HAVE_TIME 1 +#define HAVE_SHELL 1 +#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~{}," +#define DEF_METAESCAPE "\\" +#define HAVE_DUP 1 +#define HAVE_MEMCPY 1 +#define HAVE_STRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_LESSKEYSRC 1 +#if 0 /* old sizes for small memory machines */ +#define CMDBUF_SIZE 512 /* Buffer for multichar commands */ +#define UNGOT_SIZE 100 /* Max chars to unget() */ +#define LINEBUF_SIZE 1024 /* Max size of line in input file */ +#define OUTBUF_SIZE 1024 /* Output buffer */ +#define PROMPT_SIZE 200 /* Max size of prompt string */ +#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ +#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ +#define TAGLINE_SIZE 512 /* Max size of line in tags file */ +#define TABSTOP_MAX 32 /* Max number of custom tab stops */ +#else /* more reasonable sizes for modern machines */ +#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */ +#define UNGOT_SIZE 200 /* Max chars to unget() */ +#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */ +#define OUTBUF_SIZE 1024 /* Output buffer */ +#define PROMPT_SIZE 2048 /* Max size of prompt string */ +#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ +#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ +#define TAGLINE_SIZE 1024 /* Max size of line in tags file */ +#define TABSTOP_MAX 128 /* Max number of custom tab stops */ +#endif +#define RETSIGTYPE void +#define EDIT_PGM "vi" +#define HAVE_CONST 1 +#define HAVE_CTYPE_H 1 +#define HAVE_ERRNO 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCHMOD 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FILENO 1 +#define HAVE_FSYNC 1 +/* #undef HAVE_GNU_REGEX */ +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +/* #undef HAVE_LINUX_MAGIC_H */ +#define HAVE_LOCALE 1 +#define HAVE_NANOSLEEP 1 +/* #undef HAVE_NCURSESW_TERMCAP_H */ +/* #undef HAVE_NCURSES_TERMCAP_H */ +#define HAVE_OSPEED 1 +/* #undef HAVE_PCRE */ +/* #undef HAVE_PCRE2 */ +#define HAVE_POLL 1 +#define HAVE_POPEN 1 +#define HAVE_POSIX_REGCOMP 1 +/* #undef HAVE_PROCFS */ +#define HAVE_REALPATH 1 +/* #undef HAVE_REGCMP */ +/* #undef HAVE_REGEXEC2 */ +/* #undef HAVE_RE_COMP */ +#define HAVE_SIGEMPTYSET 1 +#define HAVE_SIGPROCMASK 1 +/* #undef HAVE_SIGSETMASK */ +#define HAVE_SIGSET_T 1 +#define HAVE_SNPRINTF 1 +#define HAVE_STAT 1 +#define HAVE_STAT_INO 1 +/* #undef HAVE_STDCKDINT_H */ +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRERROR 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRSIGNAL 1 +#define HAVE_SYSTEM 1 +#define HAVE_SYS_ERRLIST 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_STAT_H 1 +/* #undef HAVE_SYS_STREAM_H */ +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_WAIT_H 1 +#define HAVE_TERMCAP_H 1 +#define HAVE_TERMIOS_FUNCS 1 +#define HAVE_TERMIOS_H 1 +/* #undef HAVE_TERMIO_H */ +#define HAVE_TIME_H 1 +#define HAVE_TIME_T 1 +#define HAVE_TTYNAME 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UPPER_LOWER 1 +#define HAVE_USLEEP 1 +/* #undef HAVE_V8_REGCOMP */ +#define HAVE_VALUES_H 1 +#define HAVE_VOID 1 +#define HAVE_WCTYPE 1 +#define HAVE_WCTYPE_H 1 +#define HAVE__SETJMP 1 +/* #undef MUST_DEFINE_ERRNO */ +/* #undef MUST_DEFINE_OSPEED */ +/* #undef NO_REGEX */ +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "less" +#define PACKAGE_STRING "less 1" +#define PACKAGE_TARNAME "less" +#define PACKAGE_URL "" +#define PACKAGE_VERSION "1" +#define SECURE_COMPILE 0 +/* #undef STAT_MACROS_BROKEN */ +#define STDC_HEADERS 1 +/* #undef _FILE_OFFSET_BITS */ +/* #undef _LARGE_FILES */ +/* #undef const */ +/* #undef off_t */ +/* #undef size_t */ +#define LINENUM_POOL 1024 + diff --git a/pkg/less/version b/pkg/less/version @@ -0,0 +1,4 @@ +method=curl +url=https://www.greenwoodsoftware.com/less/less-679.tar.gz +sha256=9b68820c34fa8a0af6b0e01b74f0298bcdd40a0489c61649b47058908a153d78 +rel=0 diff --git a/pkg/netbsd-curses/gen.sh b/pkg/netbsd-curses/gen.sh @@ -67,7 +67,7 @@ tools() { subninja tools tic deps/compiled_terms.c -Sx dumb -tic deps/terminfo.cdb -x +tic terminfo -x nbperf genhash deps/hash.c lib/libterminfo/term.h nbperf genthash deps/termcap_hash.c lib/libterminfo/termcap_map.c diff --git a/tpl/example/gen.sh b/tpl/example/gen.sh @@ -218,3 +218,8 @@ pkg mandoc apropos bin/apropos \ mdoc.7.gz $MANDIR/man7/mdoc.7.gz \ roff.7.gz $MANDIR/man7/roff.7.gz \ tbl.7.gz $MANDIR/man7/tbl.7.gz + +pkg netbsd-curses terminfo share/misc/terminfo + +pkg less less bin/less \ + less.1.gz $MANDIR/man1/less.1.gz