opkg

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

gen.lua (2536B)


      1 cflags({
      2 	'-std=c99', '-Wall', '-Wpedantic', '-Wno-maybe-uninitialized',
      3 	'-D _DEFAULT_SOURCE',
      4 	'-D _BSD_SOURCE',
      5 	'-D _XOPEN_SOURCE=700',
      6 	'-I $outdir',
      7 })
      8 
      9 lib('libutil.a', [[libutil/(
     10 	concat.c
     11 	cp.c
     12 	crypt.c
     13 	ealloc.c
     14 	enmasse.c
     15 	eprintf.c
     16 	eregcomp.c
     17 	estrtod.c
     18 	fnck.c
     19 	fshut.c
     20 	getlines.c
     21 	human.c
     22 	linecmp.c
     23 	md5.c
     24 	memmem.c
     25 	mkdirp.c
     26 	mode.c
     27 	parseoffset.c
     28 	putword.c
     29 	reallocarray.c
     30 	recurse.c
     31 	rm.c
     32 	sha1.c
     33 	sha224.c
     34 	sha256.c
     35 	sha384.c
     36 	sha512.c
     37 	sha512-224.c
     38 	sha512-256.c
     39 	strcasestr.c
     40 	strlcat.c
     41 	strlcpy.c
     42 	strnsubst.c
     43 	strsep.c
     44 	strtonum.c
     45 	unescape.c
     46 	writeall.c
     47 )]])
     48 lib('libutf.a', [[libutf/(
     49 	fgetrune.c
     50 	fputrune.c
     51 	isalnumrune.c
     52 	isalpharune.c
     53 	isblankrune.c
     54 	iscntrlrune.c
     55 	isdigitrune.c
     56 	isgraphrune.c
     57 	isprintrune.c
     58 	ispunctrune.c
     59 	isspacerune.c
     60 	istitlerune.c
     61 	isxdigitrune.c
     62 	lowerrune.c
     63 	rune.c
     64 	runetype.c
     65 	upperrune.c
     66 	utf.c
     67 	utftorunestr.c
     68 )]])
     69 
     70 rule('getconf', '$srcdir/scripts/getconf.sh >$out')
     71 build('getconf', '$outdir/getconf.h', {'|', '$srcdir/scripts/getconf.sh'})
     72 
     73 local cmds = {
     74 	'basename',
     75 	'cal',
     76 	'cat',
     77 	'chgrp',
     78 	'chmod',
     79 	'chown',
     80 	'chroot',
     81 	'cksum',
     82 	'cmp',
     83 	'cols',
     84 	'comm',
     85 	'cp',
     86 	'cron',
     87 	'cut',
     88 	'date',
     89 	'dd',
     90 	'dirname',
     91 	'du',
     92 	'echo',
     93 	'ed',
     94 	'env',
     95 	'expand',
     96 	'expr',
     97 	'false',
     98 	'find',
     99 	'flock',
    100 	'fold',
    101 	'getconf',
    102 	'grep',
    103 	'head',
    104 	'hostname',
    105 	'install',
    106 	'join',
    107 	'kill',
    108 	'link',
    109 	'ln',
    110 	'logger',
    111 	'logname',
    112 	'ls',
    113 	'md5sum',
    114 	'mkdir',
    115 	'mkfifo',
    116 	'mknod',
    117 	'mktemp',
    118 	'mv',
    119 	'nice',
    120 	'nl',
    121 	'nohup',
    122 	'od',
    123 	'paste',
    124 	'pathchk',
    125 	'printenv',
    126 	'printf',
    127 	'pwd',
    128 	'readlink',
    129 	'renice',
    130 	'rev',
    131 	'rm',
    132 	'rmdir',
    133 	'sed',
    134 	'seq',
    135 	'setsid',
    136 	'sha1sum',
    137 	'sha224sum',
    138 	'sha256sum',
    139 	'sha384sum',
    140 	'sha512-224sum',
    141 	'sha512-256sum',
    142 	'sha512sum',
    143 	'sleep',
    144 	'sort',
    145 	'split',
    146 	'sponge',
    147 	-- use strings from binutils
    148 	'sync',
    149 	'tail',
    150 	-- use tar from OpenBSD
    151 	'tee',
    152 	'test',
    153 	'tftp',
    154 	'time',
    155 	'touch',
    156 	'tr',
    157 	'true',
    158 	'tsort',
    159 	'tty',
    160 	'uname',
    161 	'unexpand',
    162 	'uniq',
    163 	'unlink',
    164 	'uudecode',
    165 	'uuencode',
    166 	'wc',
    167 	'which',
    168 	'whoami',
    169 	'yes',
    170 }
    171 for _, cmd in ipairs(cmds) do
    172 	local src = cmd
    173 	if src == 'install' then
    174 		src = 'xinstall'
    175 	end
    176 	local deps
    177 	if cmd == 'getconf' then
    178 		deps = {'$outdir/getconf.h'}
    179 	end
    180 	file('bin/'..cmd, '755', exe(cmd, {src..'.c', 'libutil.a', 'libutf.a'}, deps))
    181 	local out = '$srcdir/'..src..'.1'
    182 	file('share/man/man1/'..cmd..'.1', '644', out)
    183 end
    184 
    185 sym('bin/[', 'test')
    186 
    187 -- TODO: binutils'  config/lib-ld.m4 should use AC_REQUIRE([AC_PROG_EGREP]) and
    188 -- $EGREP instead of egrep.
    189 file('bin/egrep', '755', '$dir/egrep')
    190 
    191 fetch('git')