diff options
Diffstat (limited to 'pkg/file')
| -rw-r--r-- | pkg/file/gen.lua | 61 | ||||
| -rw-r--r-- | pkg/file/gen.rc | 59 |
2 files changed, 61 insertions, 59 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' diff --git a/pkg/file/gen.rc b/pkg/file/gen.rc deleted file mode 100644 index 927f5818..00000000 --- a/pkg/file/gen.rc +++ /dev/null @@ -1,59 +0,0 @@ -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 '$outdir'/include/magic.h sed '$srcdir'/src/magic.h.in ; with\ - expr s,X.YY,`{echo $version | tr -d .}^, -phony headers '$outdir'/include/magic.h - -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 - -phony deps ('$dir' pkg/zlib)^/headers - -lib libmagic.a -d '$dir'/deps 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 -d '$dir'/headers src/file.c libmagic.a '$builddir/pkg/zlib/libz.a' -file bin/file '$outdir'/file 755 -man -d '$outdir' 1 file.1 - -srcs=`{grep -v '^#' magic.txt} -for(src in $srcs) build '$outdir'/magic/$src copy '$srcdir'/magic/Magdir/$src -for(src in Header Localstuff) build '$outdir'/magic/$src copy '$srcdir'/magic/$src -magic_outs=magic/^(Header Localstuff $srcs) - -rule magic 'cd $outdir && file -C -m magic' -build '$outdir'/magic.mgc magic '|' '$outdir'/$magic_outs -file share/file/magic.mgc '$outdir'/magic.mgc 644 - -fetch git |
