opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

gen.lua (3750B)


      1 cflags({
      2 	'-Wall', '-Wno-pointer-sign', '-Wno-maybe-uninitialized', '-Wno-attributes',
      3 	[[-D 'DEF_WEAK(n)=_Static_assert(1, "")']],
      4 	'-I $dir/include',
      5 	'-I $outdir/include',
      6 })
      7 
      8 pkg.hdrs = {
      9 	copy('$outdir/include', '$srcdir/sys', {'sys/queue.h', 'sys/tree.h', 'sys/_null.h'}),
     10 	copy('$outdir/include', '$srcdir/include', {'fts.h', 'vis.h'}),
     11 	copy('$outdir/include', '$srcdir/lib/libutil', {'ohash.h'}),
     12 }
     13 pkg.deps = {'$gendir/headers'}
     14 
     15 -- Link arc4random.c to '$outdir' so that it doesn't include the local
     16 -- arc4random.h
     17 build('copy', '$outdir/lib/libc/crypt/arc4random.c', '$srcdir/lib/libc/crypt/arc4random.c')
     18 build('copy', '$outdir/lib/libc/crypt/arc4random.h', '$srcdir/lib/libcrypto/arc4random/arc4random_linux.h')
     19 build('copy', '$outdir/lib/libc/crypt/chacha_private.h', '$srcdir/lib/libc/crypt/chacha_private.h')
     20 cc('$outdir/lib/libc/crypt/arc4random.c', {
     21 	'$outdir/lib/libc/crypt/arc4random.h',
     22 	'$outdir/lib/libc/crypt/chacha_private.h',
     23 })
     24 
     25 lib('libbsd.a', [[
     26 	lib/libc/(
     27 		crypt/(arc4random.c.o arc4random_uniform.c)
     28 		gen/(fts.c getprogname.c pwcache.c readpassphrase.c setprogname.c unvis.c vis.c warnc.c vwarnc.c)
     29 		net/base64.c
     30 		stdlib/(freezero.c recallocarray.c strtonum.c)
     31 		string/(strmode.c timingsafe_bcmp.c timingsafe_memcmp.c)
     32 	)
     33 	lib/libutil/(fmt_scaled.c ohash.c)
     34 ]])
     35 file('lib/libbsd.a', '644', '$outdir/libbsd.a')
     36 
     37 -- diff
     38 exe('diff', 'usr.bin/diff/(diff.c diffdir.c diffreg.c xmalloc.c) libbsd.a')
     39 file('bin/diff', '755', '$outdir/diff')
     40 man({'usr.bin/diff/diff.1'})
     41 
     42 -- doas
     43 yacc('usr.bin/doas/parse', 'usr.bin/doas/parse.y')
     44 cc('$outdir/usr.bin/doas/parse.tab.c', nil, {cflags='$cflags -I $srcdir/usr.bin/doas'})
     45 cc('usr.bin/doas/doas.c', nil, {cflags='$cflags -D _GNU_SOURCE'})
     46 exe('doas', 'usr.bin/doas/(doas.c.o env.c parse.tab.c.o persist.c) libbsd.a')
     47 file('bin/doas', '6755', '$outdir/doas')
     48 man({'usr.bin/doas/doas.1', 'usr.bin/doas/doas.conf.5'})
     49 
     50 -- fmt
     51 file('bin/fmt', '755', exe('fmt', {'usr.bin/fmt/fmt.c', 'libbsd.a'}))
     52 man({'usr.bin/fmt/fmt.1'})
     53 
     54 -- nc
     55 sub('nc.ninja', function()
     56 	cflags({'-isystem $builddir/pkg/libs/libtls-bearssl/include'})
     57 	exe('nc', [[
     58 		usr.bin/nc/(netcat.c atomicio.c socks.c)
     59 		$builddir/pkg/libs/libtls-bearssl/libtls.a.d
     60 		libbsd.a
     61 	]], {'pkg/libs/libtls-bearssl/headers'})
     62 	file('bin/nc', '755', '$outdir/nc')
     63 	man({'usr.bin/nc/nc.1'})
     64 end)
     65 
     66 -- m4
     67 yacc('usr.bin/m4/parser', 'usr.bin/m4/parser.y')
     68 cc('usr.bin/m4/tokenizer.c', {'$outdir/usr.bin/m4/parser.tab.h'}, {cflags='$cflags -I $outdir/usr.bin/m4'})
     69 exe('m4', [[
     70 	usr.bin/m4/(eval.c expr.c look.c main.c misc.c gnum4.c trace.c tokenizer.c.o)
     71 	$outdir/usr.bin/m4/parser.tab.c
     72 	libbsd.a
     73 ]])
     74 file('bin/m4', '755', '$outdir/m4')
     75 man({'usr.bin/m4/m4.1'})
     76 
     77 -- patch
     78 exe('patch', 'usr.bin/patch/(patch.c pch.c inp.c util.c backupfile.c mkpath.c ed.c) libbsd.a')
     79 file('bin/patch', '755', '$outdir/patch')
     80 man({'usr.bin/patch/patch.1'})
     81 
     82 -- pax
     83 exe('pax', [[bin/pax/(
     84 	ar_io.c ar_subs.c buf_subs.c cpio.c file_subs.c ftree.c
     85 	gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c
     86 	tar.c tty_subs.c
     87 ) libbsd.a]])
     88 file('bin/pax', '755', '$outdir/pax')
     89 sym('bin/tar', 'pax')
     90 sym('bin/cpio', 'pax')
     91 man({'bin/pax/pax.1', 'bin/pax/tar.1', 'bin/pax/cpio.1'})
     92 
     93 -- rsync
     94 exe('rsync', [[
     95 	usr.bin/rsync/(
     96 		blocks.c client.c copy.c downloader.c fargs.c flist.c hash.c ids.c
     97 		io.c log.c main.c md4.c misc.c mkpath.c mktemp.c receiver.c rmatch.c
     98 		rules.c sender.c server.c session.c socket.c symlinks.c uploader.c
     99 	)
    100 	libbsd.a
    101 ]])
    102 file('bin/rsync', '755', '$outdir/rsync')
    103 man({'usr.bin/rsync/rsync.1', 'usr.bin/rsync/rsync.5', 'usr.bin/rsync/rsyncd.5'})
    104 
    105 -- xargs
    106 exe('xargs', [[usr.bin/xargs/(xargs.c strnsubst.c) libbsd.a]])
    107 file('bin/xargs', '755', '$outdir/xargs')
    108 man({'usr.bin/xargs/xargs.1'})
    109 
    110 fetch('local')