diff options
| author | Michael Forney <mforney@mforney.org> | 2017-09-17 00:03:34 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2017-09-25 19:23:06 -0700 |
| commit | ba94a8513d9a0aadb3f2c834c74b64aa644c61e8 (patch) | |
| tree | 48ac6c85baa7b9d960b9e1e726a906e61ca60967 /pkg/sbase | |
| parent | cb362b531d79708a259bbf070dee5104fd63df08 (diff) | |
Rewrite ninja generation scripts in Lua
Diffstat (limited to 'pkg/sbase')
| -rw-r--r-- | pkg/sbase/gen.lua | 191 | ||||
| -rw-r--r-- | pkg/sbase/gen.rc | 196 |
2 files changed, 191 insertions, 196 deletions
diff --git a/pkg/sbase/gen.lua b/pkg/sbase/gen.lua new file mode 100644 index 00000000..17d1c5fb --- /dev/null +++ b/pkg/sbase/gen.lua @@ -0,0 +1,191 @@ +cflags{ + '-std=c99', '-pedantic', + '-Wall', '-Wno-maybe-uninitialized', + '-D _DEFAULT_SOURCE', + '-D _BSD_SOURCE', + '-D _XOPEN_SOURCE=700', + '-I $outdir', +} + +lib('libutil.a', [[libutil/( + concat.c + cp.c + crypt.c + ealloc.c + enmasse.c + eprintf.c + eregcomp.c + estrtod.c + fnck.c + fshut.c + getlines.c + human.c + linecmp.c + md5.c + memmem.c + mkdirp.c + mode.c + parseoffset.c + putword.c + reallocarray.c + recurse.c + rm.c + sha1.c + sha224.c + sha256.c + sha384.c + sha512.c + sha512-224.c + sha512-256.c + strcasestr.c + strlcat.c + strlcpy.c + strsep.c + strtonum.c + unescape.c + writeall.c +)]]) +lib('libutf.a', [[libutf/( + fgetrune.c + fputrune.c + isalnumrune.c + isalpharune.c + isblankrune.c + iscntrlrune.c + isdigitrune.c + isgraphrune.c + isprintrune.c + ispunctrune.c + isspacerune.c + istitlerune.c + isxdigitrune.c + lowerrune.c + rune.c + runetype.c + upperrune.c + utf.c + utftorunestr.c +)]]) + +rule('getconf', '$srcdir/getconf.sh >$out.tmp && mv $out.tmp $out') +build('getconf', '$outdir/getconf.h', {'|', '$srcdir/getconf.sh'}) + +local cmds = { + 'basename', + 'cal', + 'cat', + 'chgrp', + 'chmod', + 'chown', + 'chroot', + 'cksum', + 'cmp', + 'cols', + 'comm', + 'cp', + 'cron', + 'cut', + 'date', + 'dirname', + 'du', + 'echo', + 'ed', + 'env', + 'expand', + 'expr', + 'false', + 'find', + 'flock', + 'fold', + 'getconf', + 'grep', + 'head', + 'hostname', + 'install', + 'join', + 'kill', + 'link', + 'ln', + 'logger', + 'logname', + 'ls', + 'md5sum', + 'mkdir', + 'mkfifo', + 'mktemp', + 'mv', + 'nice', + 'nl', + 'nohup', + 'od', + 'paste', + 'pathchk', + 'printenv', + 'printf', + 'pwd', + 'readlink', + 'renice', + 'rev', + 'rm', + 'rmdir', + 'sed', + 'seq', + 'setsid', + 'sha1sum', + 'sha224sum', + 'sha256sum', + 'sha384sum', + 'sha512-224sum', + 'sha512-256sum', + 'sha512sum', + 'sleep', + 'sort', + 'split', + 'sponge', + -- use strings from binutils + 'sync', + 'tail', + -- use tar from OpenBSD + 'tee', + 'test', + 'tftp', + 'time', + 'touch', + 'tr', + 'true', + 'tsort', + 'tty', + 'uname', + 'unexpand', + 'uniq', + 'unlink', + 'uudecode', + 'uuencode', + 'wc', + 'which', + 'whoami', + 'xargs', + 'yes', +} +for _, cmd in ipairs(cmds) do + local src = cmd + if src == 'install' then + src = 'xinstall' + end + local deps + if cmd == 'getconf' then + deps = {'$outdir/getconf.h'} + end + file('bin/'..cmd, '755', exe(cmd, {src..'.c', 'libutil.a', 'libutf.a'}, deps)) + local out = '$outdir/'..cmd..'.1.gz' + build('gzip', out, '$srcdir/'..src..'.1') + file('share/man/man1/'..cmd..'.1.gz', '644', out) +end + +sym('bin/[', 'test') + +-- TODO: binutils' config/lib-ld.m4 should use AC_REQUIRE([AC_PROG_EGREP]) and +-- $EGREP instead of egrep. +file('bin/egrep', '755', '$dir/egrep') + +fetch 'git' diff --git a/pkg/sbase/gen.rc b/pkg/sbase/gen.rc deleted file mode 100644 index c959a793..00000000 --- a/pkg/sbase/gen.rc +++ /dev/null @@ -1,196 +0,0 @@ -cflags\ - '-std=c99' -pedantic\ - -Wall -Wno-maybe-uninitialized\ - -D _DEFAULT_SOURCE\ - -D _BSD_SOURCE\ - -D '_XOPEN_SOURCE=700' \ - -I '$outdir' - -lib libutil.a libutil/^(\ - concat.c\ - cp.c\ - crypt.c\ - ealloc.c\ - enmasse.c\ - eprintf.c\ - eregcomp.c\ - estrtod.c\ - fnck.c\ - fshut.c\ - getlines.c\ - human.c\ - linecmp.c\ - md5.c\ - memmem.c\ - mkdirp.c\ - mode.c\ - parseoffset.c\ - putword.c\ - reallocarray.c\ - recurse.c\ - rm.c\ - sha1.c\ - sha224.c\ - sha256.c\ - sha384.c\ - sha512.c\ - sha512-224.c\ - sha512-256.c\ - strcasestr.c\ - strlcat.c\ - strlcpy.c\ - strsep.c\ - strtonum.c\ - unescape.c\ - writeall.c\ -) -lib libutf.a libutf/^(\ - fgetrune.c\ - fputrune.c\ - isalnumrune.c\ - isalpharune.c\ - isblankrune.c\ - iscntrlrune.c\ - isdigitrune.c\ - isgraphrune.c\ - isprintrune.c\ - ispunctrune.c\ - isspacerune.c\ - istitlerune.c\ - isxdigitrune.c\ - lowerrune.c\ - rune.c\ - runetype.c\ - upperrune.c\ - utf.c\ - utftorunestr.c\ -) - -rule getconf '$srcdir/getconf.sh >$out.tmp && mv $out.tmp $out' -build '$outdir'/getconf.h getconf '|' '$srcdir/getconf.sh' - -fn x { - exe=$1 - shift - - src=$exe - deps=() - switch($exe) { - case install - src=xinstall - case getconf - deps=('||' '$outdir'/getconf.h) - } - - cc $src.c $deps - link $exe $src.c.o libutil.a libutf.a - - file bin/$exe '$outdir'/$exe 755 - build '$outdir'/$exe.1.gz gzip '$srcdir'/$src.1 - man -d '$outdir' 1 $exe.1.gz -} - -x basename -x cal -x cat -x chgrp -x chmod -x chown -x chroot -x cksum -x cmp -x cols -x comm -x cp -x cron -x cut -x date -x dirname -x du -x echo -x ed -x env -x expand -x expr -x false -x find -x flock -x fold -x getconf -x grep -x head -x hostname -x install -x join -x kill -x link -x ln -x logger -x logname -x ls -x md5sum -x mkdir -x mkfifo -x mktemp -x mv -x nice -x nl -x nohup -x od -x paste -x pathchk -x printenv -x printf -x pwd -x readlink -x renice -x rev -x rm -x rmdir -x sed -x seq -x setsid -x sha1sum -x sha224sum -x sha256sum -x sha384sum -x sha512-224sum -x sha512-256sum -x sha512sum -x sleep -x sort -x split -x sponge -# use strings from binutils -x sync -x tail -# use tar from OpenBSD -x tee -x test -x tftp -x time -x touch -x tr -x true -x tsort -x tty -x uname -x unexpand -x uniq -x unlink -x uudecode -x uuencode -x wc -x which -x whoami -x xargs -x yes - -# TODO: Hard links? -sym bin/[ test - -# TODO: binutils' config/lib-ld.m4 should use AC_REQUIRE([AC_PROG_EGREP]) and -# $EGREP instead of egrep. -file bin/egrep '$dir'/egrep 755 - -fetch git |
