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/syslinux | |
| parent | cb362b531d79708a259bbf070dee5104fd63df08 (diff) | |
Rewrite ninja generation scripts in Lua
Diffstat (limited to 'pkg/syslinux')
| -rw-r--r-- | pkg/syslinux/gen.lua | 50 | ||||
| -rw-r--r-- | pkg/syslinux/gen.rc | 47 |
2 files changed, 50 insertions, 47 deletions
diff --git a/pkg/syslinux/gen.lua b/pkg/syslinux/gen.lua new file mode 100644 index 00000000..a142777c --- /dev/null +++ b/pkg/syslinux/gen.lua @@ -0,0 +1,50 @@ +cflags{ + '-I $dir', + '-I $outdir', + '-I $srcdir/libinstaller', + + -- NOTE: we should only have to include $srcdir/libinstaller, but + -- BSD pax/tar transforms symlink targets as well as filenames, + -- trashing the libinstaller/advconst.h symlink. + '-I $srcdir/com32/include/syslinux', +} + +build('awk', '$outdir/version.h', {'$srcdir/version', '|', '$dir/version.awk'}, { + expr=[[-f $dir/version.awk -v fmt='#define %s %s']], +}) + +sub('tools.ninja', function() + toolchain 'host' + cflags{'-std=c99', '-pedantic', '-Wall', '-Wextra'} + set('srcdir', '$dir') + exe('bin2c', {'bin2c.c'}) +end) + +rule('bin2c', '$outdir/bin2c $args <$in >$out.tmp && mv $out.tmp $out') +function bin2c(bin, args) + local name = args[1] + build('bin2c', '$outdir/'..name..'.c', { + '$srcdir/'..bin, '|', '$outdir/bin2c', + }, {args=args}) +end + +bin2c('bios/core/ldlinux.bss', {'syslinux_bootsect'}) +bin2c('bios/core/ldlinux.sys', {'syslinux_ldlinux', '512'}) +bin2c('bios/com32/elflink/ldlinux/ldlinux.c32', {'syslinux_ldlinuxc32'}) + +exe('bin/extlinux', [[ + extlinux/(main.c mountinfo.c) + libinstaller/( + syslxmod.c + syslxopt.c + syslxcom.c + setadv.c + advio.c + ) + $outdir/syslinux_(bootsect ldlinux ldlinuxc32).c +]], {'$outdir/version.h'}) +file('bin/extlinux', '755', '$outdir/bin/extlinux') + +file('lib/syslinux/bios/mbr.bin', '644', '$srcdir/bios/mbr/mbr.bin') + +fetch 'curl' diff --git a/pkg/syslinux/gen.rc b/pkg/syslinux/gen.rc deleted file mode 100644 index e3b5c9fa..00000000 --- a/pkg/syslinux/gen.rc +++ /dev/null @@ -1,47 +0,0 @@ -cflags\ - -I '$dir' \ - -I '$outdir' \ - -I '$srcdir'/libinstaller\ - -I '$srcdir'/com32/include/syslinux -# NOTE: we should only have to include $srcdir/libinstaller, but BSD pax/tar -# transforms symlink targets as well as filenames, trashing the -# libinstaller/advconst.h symlink. - -build '$outdir'/version.h awk '$srcdir'/version '|' '$dir'/version.awk ; with\ - expr '-f $dir/version.awk -v fmt=''#define %s %s''' - -{ - toolchain host - cflags '-std=c99' -pedantic -Wall -Wextra - set srcdir '$dir' - exe bin2c bin2c.c -} >tools.ninja ; subninja tools.ninja - -rule bin2c '$outdir/bin2c $args <$in >$out.tmp && mv $out.tmp $out' -fn bin2c { - bin=$1 - name=$2 - shift - build '$outdir'/$name.c bin2c '$srcdir'/$bin '|' '$outdir'/bin2c - with args $"* -} - -bin2c bios/core/ldlinux.bss syslinux_bootsect -bin2c bios/core/ldlinux.sys syslinux_ldlinux 512 -bin2c bios/com32/elflink/ldlinux/ldlinux.c32 syslinux_ldlinuxc32 - -exe bin/extlinux -d '$outdir'/version.h\ - extlinux/^(main.c mountinfo.c)\ - libinstaller/^(\ - syslxmod.c\ - syslxopt.c\ - syslxcom.c\ - setadv.c\ - advio.c\ - )\ - '$outdir'/syslinux_^(bootsect ldlinux ldlinuxc32)^.c -file bin/extlinux '$outdir'/bin/extlinux 755 - -file lib/syslinux/bios/mbr.bin '$srcdir'/bios/mbr/mbr.bin 644 - -fetch curl |
