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/file/gen.lua | |
| parent | cb362b531d79708a259bbf070dee5104fd63df08 (diff) | |
Rewrite ninja generation scripts in Lua
Diffstat (limited to 'pkg/file/gen.lua')
| -rw-r--r-- | pkg/file/gen.lua | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/pkg/file/gen.lua b/pkg/file/gen.lua new file mode 100644 index 00000000..dc1074d1 --- /dev/null +++ b/pkg/file/gen.lua @@ -0,0 +1,61 @@ +local version = '5.32' +cflags{ + '-Wall', + '-D HAVE_CONFIG_H', + [[-D 'MAGIC="/share/file/magic"']], + '-D _GNU_SOURCE', + '-I include', + '-I $dir', + '-I $outdir/include', + '-I $builddir/pkg/zlib/include', +} + +build('sed', '$outdir/include/magic.h', '$srcdir/src/magic.h.in', { + expr='s,X.YY,'..version:gsub('%.', '')..',', +}) + +build('sed', '$outdir/file.1', '$srcdir/doc/file.man', { + expr={ + '-e s,__CSECTION__,1,g', + '-e s,__FSECTION__,5,g', + '-e s,__VERSION__,'..version..',g', + '-e s,__MAGIC__,/share/file/magic,g', + }, +}) + +pkg.hdrs = {'$outdir/include/magic.h'} +pkg.deps = {'$dir/headers', 'pkg/zlib/headers'} + +lib('libmagic.a', [[src/( + magic.c + apprentice.c + softmagic.c + ascmagic.c + encoding.c + compress.c + is_tar.c + readelf.c + print.c + fsmagic.c + funcs.c + apptype.c + der.c + cdf.c + cdf_time.c + readcdf.c + + fmtcheck.c +)]]) + +exe('file', {'src/file.c', 'libmagic.a', '$builddir/pkg/zlib/libz.a'}) +file('bin/file', '755', '$outdir/file') +man{'$outdir/file.1'} + +rule('magic', 'cd $outdir && file -C -m magic') +build('magic', '$outdir/magic.mgc', {'|', + copy('$outdir/magic', '$srcdir/magic/Magdir', lines('magic.txt')), + copy('$outdir/magic', '$srcdir/magic', {'Header', 'Localstuff'}), +}) +file('share/file/magic.mgc', '644', '$outdir/magic.mgc') + +fetch 'git' |
