diff options
| author | Michael Forney <mforney@mforney.org> | 2016-06-27 01:23:03 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-06-27 01:23:03 -0700 |
| commit | 076e97aee176afce9c51eef9c5cd39bbf0609b92 (patch) | |
| tree | 5a5c6d9538642e53988d79efc45c38194e99f045 | |
| parent | 1f48964d15334a14de99fb4985077e3523f6f9ef (diff) | |
Reformulate "let" helper into "with"
| -rw-r--r-- | core/e2fsprogs/gen.rc | 10 | ||||
| -rw-r--r-- | core/file/gen.rc | 12 | ||||
| -rw-r--r-- | core/git/gen.rc | 2 | ||||
| -rw-r--r-- | core/iproute2/gen.rc | 4 | ||||
| -rw-r--r-- | core/kbd/gen.rc | 4 | ||||
| -rw-r--r-- | core/openssh/gen.rc | 5 | ||||
| -rw-r--r-- | core/perp/gen.rc | 8 | ||||
| -rw-r--r-- | desktop/libffi/gen.rc | 4 | ||||
| -rw-r--r-- | desktop/pixman/gen.rc | 11 | ||||
| -rw-r--r-- | desktop/wayland/gen.rc | 10 | ||||
| -rw-r--r-- | extra/libevent/gen.rc | 4 | ||||
| -rw-r--r-- | extra/libnl/gen.rc | 5 | ||||
| -rw-r--r-- | extra/pcre/gen.rc | 4 | ||||
| -rw-r--r-- | extra/sshfs/gen.rc | 4 | ||||
| -rw-r--r-- | extra/transmission/gen.rc | 4 | ||||
| -rw-r--r-- | ninja.rc | 26 |
16 files changed, 58 insertions, 59 deletions
diff --git a/core/e2fsprogs/gen.rc b/core/e2fsprogs/gen.rc index e92032d6..1d58f54d 100644 --- a/core/e2fsprogs/gen.rc +++ b/core/e2fsprogs/gen.rc @@ -16,14 +16,14 @@ set subst\ fn et { et=$1 src='$outdir'/$2 hdr='$outdir'/$3 - let expr '-f $srcdir/lib/et/et_c.awk -v outfile=/dev/stdout outfn='`{basename $src} --\ - build $src awk $et '|' '$srcdir'/lib/et/et_c.awk - let expr '-f $srcdir/lib/et/et_h.awk -v outfile=/dev/stdout outfn='`{basename $hdr} --\ - build $hdr awk $et '|' '$srcdir'/lib/et/et_h.awk + build $src awk $et '|' '$srcdir'/lib/et/et_c.awk ; with\ + expr '-f $srcdir/lib/et/et_c.awk -v outfile=/dev/stdout outfn='`{basename $src} + build $hdr awk $et '|' '$srcdir'/lib/et/et_h.awk ; with\ + expr '-f $srcdir/lib/et/et_h.awk -v outfile=/dev/stdout outfn='`{basename $hdr} } fn subst { - let expr '$subst' -- build '$outdir'/$1 sed '$srcdir'/$2 + build '$outdir'/$1 sed '$srcdir'/$2 ; with expr '$subst' } fn man { diff --git a/core/file/gen.rc b/core/file/gen.rc index 84f672ce..032f96a9 100644 --- a/core/file/gen.rc +++ b/core/file/gen.rc @@ -19,12 +19,16 @@ for(src in $srcs) build '$outdir'/magic/$src copy '$srcdir'/magic/Magdir/$src rule magic 'cd $outdir && file -C -m magic' build '$outdir'/magic.mgc magic '|' '$outdir'/$magic_outs -let expr s@X.YY@`{echo $version | tr -d .}^@ --\ - build '$outdir'/include/magic.h sed '$srcdir'/src/magic.h.in +build '$outdir'/include/magic.h sed '$srcdir'/src/magic.h.in ; with\ + expr s,X.YY,`{echo $version | tr -d .}^, phony headers include/magic.h -let expr '-e s@__CSECTION__@1@g -e s@__FSECTION__@5@g -e s@__VERSION__@'$version'@g -e s@__MAGIC__@/share/file/magic@g' --\ - build '$outdir'/file.1 sed '$srcdir'/doc/file.man +build '$outdir'/file.1 sed '$srcdir'/doc/file.man ; exprs=(\ + -e s,__CSECTION__,1,g\ + -e s,__FSECTION__,5,g\ + -e s,__VERSION__,$version,g\ + -e s,__MAGIC__,/share/file/magic,g\ +) with expr $"exprs lib libmagic.a -d 'phony/$dir/headers phony/core/zlib/headers' src/^(\ magic.c\ diff --git a/core/git/gen.rc b/core/git/gen.rc index 0c77eba4..a5f5ad29 100644 --- a/core/git/gen.rc +++ b/core/git/gen.rc @@ -12,7 +12,7 @@ build '$outdir'/common-cmds.h cmdlist '$srcdir'/command-list.txt '|' '$srcdir'/$ deps=phony/core/^(curl libressl zlib)^/headers -let cflags '$cflags ''-DPREFIX=""''' -- cc exec_cmd.c +cc exec_cmd.c ; with cflags '$cflags ''-DPREFIX=""''' # src/Makefile:/^LIB_OBJS.\+= lib libgit.a -d $"deps\ diff --git a/core/iproute2/gen.rc b/core/iproute2/gen.rc index df9b26e5..77f88cea 100644 --- a/core/iproute2/gen.rc +++ b/core/iproute2/gen.rc @@ -44,7 +44,7 @@ man=(\ )\ ) for(man in man/man8/$man.8) file share/$man '$srcdir'/$man 644 for(man in ip-address ip-link ip-route) { - let expr 's,@SYSCONFDIR@,/etc,g' --\ - build '$outdir'/$man.8 sed '$srcdir'/man/man8/$man.8.in + build '$outdir'/$man.8 sed '$srcdir'/man/man8/$man.8.in ; with\ + expr s,@SYSCONFDIR@,/etc,g file share/man/man8/$man.8 '$outdir'/$man.8 644 } diff --git a/core/kbd/gen.rc b/core/kbd/gen.rc index 6b78a6f9..4813c739 100644 --- a/core/kbd/gen.rc +++ b/core/kbd/gen.rc @@ -39,8 +39,8 @@ fn x { file bin/$exe '$outdir'/$exe 755 if(~ $sect ?~) { sect=`{printf %s $sect | cut -c -1} - let expr s,@DATADIR@,/share/kbd,g --\ - build '$outdir'/$exe.$sect sed '$srcdir'/docs/man/man$sect/$exe.$sect.in + build '$outdir'/$exe.$sect sed '$srcdir'/docs/man/man$sect/$exe.$sect.in ; with\ + expr s,@DATADIR@,/share/kbd,g man='$outdir'/$exe.$sect } if not man='$srcdir'/docs/man/man$sect/$exe.$sect diff --git a/core/openssh/gen.rc b/core/openssh/gen.rc index 958b76a1..bb3eeb18 100644 --- a/core/openssh/gen.rc +++ b/core/openssh/gen.rc @@ -7,14 +7,13 @@ cflags\ -I '$srcdir' \ -I '$srcdir'/openbsd-compat\ -defs=(\ +build '$outdir'/umac128.c.o cc '$srcdir'/umac.c ; defs=(\ '-DUMAC_OUTPUT_LEN=16' \ '-Dumac_new=umac128_new' \ '-Dumac_update=umac128_update' \ '-Dumac_final=umac128_final' \ '-Dumac_delete=umac128_delete' \ -) let cflags '$cflags '$"defs --\ - build '$outdir'/umac128.c.o cc '$srcdir'/umac.c +) with cflags '$cflags '$"defs lib libopenbsd-compat.a openbsd-compat/^(\ base64.c basename.c bcrypt_pbkdf.c bindresvport.c blowfish.c daemon.c\ diff --git a/core/perp/gen.rc b/core/perp/gen.rc index 1a6a7609..78d0ab28 100644 --- a/core/perp/gen.rc +++ b/core/perp/gen.rc @@ -17,8 +17,8 @@ rule rlimit '$outdir/mk_rlimit >$out.tmp && mv $out.tmp $out' build '$outdir'/rlimit_defs.c.in rlimit '|' '$outdir'/mk_rlimit rule sysstr '$outdir/mksysstr $type >$out.tmp && mv $out.tmp $out' -let type errno -- build '$outdir'/sysstr_errno.c.in sysstr '|' '$outdir'/mksysstr -let type signo -- build '$outdir'/sysstr_signo.c.in sysstr '|' '$outdir'/mksysstr +build '$outdir'/sysstr_errno.c.in sysstr '|' '$outdir'/mksysstr ; with type errno +build '$outdir'/sysstr_signo.c.in sysstr '|' '$outdir'/mksysstr ; with type signo phony internal_headers outvec_STDOUT.h rlimit_defs.c.in sysstr_^(errno signo)^.c.in @@ -70,8 +70,8 @@ fn x { x perp perpd perpd.c perpd_conn.c perpd_svdef.c -let cflags '$cflags -D ''TINYLOG_ZIP="/bin/gzip"'' -D ''ZIP_EXT=".gz"''' --\ - cc perp/tinylog.c +cc perp/tinylog.c ; with\ + cflags '$cflags -D ''TINYLOG_ZIP="/bin/gzip"'' -D ''ZIP_EXT=".gz"''' x perp tinylog tinylog.c.o for(exe in perp^(boot ctl hup ls ok stat)) x perp $exe $exe.c diff --git a/desktop/libffi/gen.rc b/desktop/libffi/gen.rc index 9638e1bd..fa073b8e 100644 --- a/desktop/libffi/gen.rc +++ b/desktop/libffi/gen.rc @@ -4,13 +4,13 @@ cflags\ -I '$outdir'/include\ -I '$srcdir'/include -exprs=(\ +build '$outdir'/include/ffi.h sed '$srcdir'/include/ffi.h.in ; exprs=(\ -e s,@VERSION@,3.2.1,\ -e s,@TARGET@,X86_64,\ -e s,@HAVE_LONG_DOUBLE@,1,\ -e s,@HAVE_LONG_DOUBLE_VARIANT@,0,\ -e s,@FFI_EXEC_TRAMPOLINE_TABLE@,0,\ -) let expr $"exprs -- build '$outdir'/include/ffi.h sed '$srcdir'/include/ffi.h.in +) with expr $"exprs build '$outdir'/include/ffitarget.h copy '$srcdir'/src/x86/ffitarget.h hdrs=include/^(ffi.h ffitarget.h) diff --git a/desktop/pixman/gen.rc b/desktop/pixman/gen.rc index ad424741..1c853ec5 100644 --- a/desktop/pixman/gen.rc +++ b/desktop/pixman/gen.rc @@ -4,12 +4,11 @@ cflags\ -I '$dir' \ -I '$outdir'/include -exprs=(\ +build '$outdir'/include/pixman-version.h sed '$srcdir'/pixman/pixman-version.h.in ; exprs=(\ -e s,@PIXMAN_VERSION_MAJOR@,0,\ -e s,@PIXMAN_VERSION_MINOR@,34,\ -e s,@PIXMAN_VERSION_MICRO@,0,\ -) let expr $"exprs --\ - build '$outdir'/include/pixman-version.h sed '$srcdir'/pixman/pixman-version.h.in +) with expr $"exprs build '$outdir'/include/pixman.h copy '$srcdir'/pixman/pixman.h phony headers '$outdir'/include/^(pixman.h pixman-version.h) @@ -18,9 +17,9 @@ deps='phony/$dir/headers' # processor-specific features cflags -D 'USE_SSE2=1' -D 'USE_SSSE3=1' -D 'USE_X86_MMX=1' -let cflags '$cflags -mmmx -Winline' -- cc pixman/pixman-mmx.c || $deps -let cflags '$cflags -msse2 -Winline' -- cc pixman/pixman-sse2.c || $deps -let cflags '$cflags -mssse3 -Winline' -- cc pixman/pixman-ssse3.c || $deps +cc pixman/pixman-mmx.c || $deps ; with cflags '$cflags -mmmx -Winline' +cc pixman/pixman-sse2.c || $deps ; with cflags '$cflags -msse2 -Winline' +cc pixman/pixman-ssse3.c || $deps ; with cflags '$cflags -mssse3 -Winline' cpuobjs=(pixman-mmx.c pixman-sse2.c pixman-ssse3.c)^.o lib libpixman.a -d $"deps pixman/^(\ diff --git a/desktop/wayland/gen.rc b/desktop/wayland/gen.rc index c45eb3e4..63d93444 100644 --- a/desktop/wayland/gen.rc +++ b/desktop/wayland/gen.rc @@ -6,12 +6,12 @@ cflags\ -I '$outdir'/include \ -I '$srcdir'/src -exprs=(\ +build '$outdir'/wayland-version.h sed '$srcdir'/src/wayland-version.h.in ; exprs=(\ -e s,@WAYLAND_VERSION_MAJOR@,1,\ -e s,@WAYLAND_VERSION_MINOR@,11,\ -e s,@WAYLAND_VERSION_MICRO@,0,\ -e s,@WAYLAND_VERSION@,1.11.0,\ -) let expr $"exprs -- build '$outdir'/wayland-version.h sed '$srcdir'/src/wayland-version.h.in +) with expr $"exprs cc src/wayland-util.c cc src/wayland-os.c @@ -22,8 +22,9 @@ exe wayland-scanner -d phony/desktop/expat/headers\ '$builddir'/desktop/expat/libexpat.a for(type in client server) { - let type $type-header -- build '$outdir'/include/wayland-$type-protocol.h\ + build '$outdir'/include/wayland-$type-protocol.h\ wayland_proto '$srcdir'/protocol/wayland.xml + with type $type-header } hdrs=wayland-^(client-core client egl-core egl server-core server util version)^.h for(hdr in $hdrs) build '$outdir'/include/$hdr copy '$srcdir'/src/$hdr @@ -31,8 +32,9 @@ build '$outdir'/include/wayland-cursor.h copy '$srcdir'/cursor/wayland-cursor.h phony headers include/^($hdrs wayland-^(cursor.h (client server)^-protocol.h)) -let type code -- build '$outdir'/wayland-protocol.c\ +build '$outdir'/wayland-protocol.c\ wayland_proto '$srcdir'/protocol/wayland.xml +with type code cc '$outdir'/wayland-protocol.c lib libwayland-server.a -d 'phony/$dir/headers' src/^(\ diff --git a/extra/libevent/gen.rc b/extra/libevent/gen.rc index e84204f0..6910ae5d 100644 --- a/extra/libevent/gen.rc +++ b/extra/libevent/gen.rc @@ -4,8 +4,8 @@ cflags\ -I include\ -idirafter core/openbsd/src/sys -let expr '-f $srcdir/make-event-config.sed' --\ - build '$outdir'/include/event2/event-config.h sed '$dir'/config.h +build '$outdir'/include/event2/event-config.h sed '$dir'/config.h ; with\ + expr '-f $srcdir/make-event-config.sed' phony headers '$outdir'/include/event2/event-config.h diff --git a/extra/libnl/gen.rc b/extra/libnl/gen.rc index 62e0a465..d16e52e8 100644 --- a/extra/libnl/gen.rc +++ b/extra/libnl/gen.rc @@ -27,7 +27,7 @@ hdrs=include/netlink/^(\ utils.h\ ) for(hdr in $hdrs) build '$outdir'/$hdr copy '$srcdir'/$hdr -exprs=(\ +build '$outdir'/include/netlink/version.h sed '$srcdir'/include/netlink/version.h.in ; exprs=(\ -e s,@PACKAGE_STRING@,'''libnl 3.2.27''',\ -e s,@PACKAGE_VERSION@,3.2.27,\ -e s,@MAJ_VERSION@,3,\ @@ -36,8 +36,7 @@ exprs=(\ -e s,@LT_CURRENT@,222,\ -e s,@LT_REVISION@,0,\ -e s,@LT_AGE@,22,\ -) let expr $"exprs --\ - build '$outdir'/include/netlink/version.h sed '$srcdir'/include/netlink/version.h.in +) with expr $"exprs hdrs=($hdrs include/netlink/version.h) phony headers '$outdir'/$hdrs diff --git a/extra/pcre/gen.rc b/extra/pcre/gen.rc index 850d1e30..dfdde386 100644 --- a/extra/pcre/gen.rc +++ b/extra/pcre/gen.rc @@ -5,12 +5,12 @@ cflags\ -I '$srcdir' \ -I '$outdir'/include -exprs=(\ +build '$outdir'/include/pcre.h sed '$srcdir'/pcre.h.in ; exprs=(\ -e s,@PCRE_MAJOR@,8,\ -e s,@PCRE_MINOR@,39,\ -e s,@PCRE_PRERELEASE@,,\ -e s,@PCRE_DATE@,2016-06-14,\ -) let expr $"exprs -- build '$outdir'/include/pcre.h sed '$srcdir'/pcre.h.in +) with expr $"exprs phony headers '$outdir'/include/pcre.h diff --git a/extra/sshfs/gen.rc b/extra/sshfs/gen.rc index 1d45d1f1..38b51725 100644 --- a/extra/sshfs/gen.rc +++ b/extra/sshfs/gen.rc @@ -4,8 +4,8 @@ cflags\ -I extra/libfuse/src/include\ -I '$dir' -let expr 's,__UNMOUNT_COMMAND__,''fusermount -u'',' --\ - build '$outdir'/sshfs.1 sed '$srcdir'/sshfs.1.in +build '$outdir'/sshfs.1 sed '$srcdir'/sshfs.1.in ; with\ + expr 's,__UNMOUNT_COMMAND__,''fusermount -u'',' exe sshfs sshfs.c nocache.c '$builddir'/extra/libfuse/libfuse.a file bin/sshfs '$outdir'/sshfs 755 diff --git a/extra/transmission/gen.rc b/extra/transmission/gen.rc index 7210f40f..9d069df8 100644 --- a/extra/transmission/gen.rc +++ b/extra/transmission/gen.rc @@ -106,8 +106,8 @@ subninja '$dir'/libnatpmp.ninja -idirafter core/openbsd/src/sys hdr='$outdir'/miniupnp/miniupnpcstrings.h - let expr '-e s,OS/version,Linux, -e s,version,,' --\ - build $hdr sed '$srcdir'/third-party/miniupnp/miniupnpcstrings.h.in + build $hdr sed '$srcdir'/third-party/miniupnp/miniupnpcstrings.h.in ; with\ + expr '-e s,OS/version,Linux, -e s,version,,' lib libminiupnp.a -d $hdr third-party/miniupnp/^(\ connecthostport.c\ @@ -7,16 +7,12 @@ fn set { } } -fn let { - vars=() { - while(! ~ $1 --) { - vars=($vars $1' = '$2) - shift 2 - } - shift - $* - printf ' %s\n' $vars +fn with { + while(! ~ $#* 0) { + printf ' %s = %s\n' $1 $2 + shift 2 } + status=() } fn subninja { @@ -30,7 +26,7 @@ fn include { fn rule { name=$1 { shift - let command $"* -- echo rule $name + echo rule $name ; with command $"* } } @@ -120,7 +116,7 @@ fn exe { fn yacc { outs='$outdir'/$1.tab.^(c h) { - let yaccflags '-d -b '$1 -- build $"outs yacc $2 + build $"outs yacc $2 ; with yaccflags '-d -b '$1 } } @@ -131,8 +127,8 @@ fn file { if(fs $dir $1) { out='$builddir/$repo.hash'/$1 mode=`{printf %4s $3 | tr ' ' 0 | tail -c 4} - let args 10$mode' '$1 --\ - build $out githash $2 '|' '$builddir/$repo.stamp' scripts/hash.rc + build $out githash $2 '|' '$builddir/$repo.stamp' scripts/hash.rc ; with\ + args 10$mode' '$1 tree_inputs=($tree_inputs $out) if(! ~ $mode 0755 0644) tree_perms=($tree_perms 10$mode' '$1) @@ -150,8 +146,8 @@ fn sym { ~ $#* 2 if(fs $dir $1) { out='$builddir/$repo.hash'/$1 - let args 120000' '$1' '$2 --\ - build $out githash '|' '$builddir/$repo.stamp' scripts/hash.rc + build $out githash '|' '$builddir/$repo.stamp' scripts/hash.rc ; with\ + args 120000' '$1' '$2 tree_inputs=($tree_inputs $out) } status=() |
