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/gen.lua | |
| parent | cb362b531d79708a259bbf070dee5104fd63df08 (diff) | |
Rewrite ninja generation scripts in Lua
Diffstat (limited to 'pkg/syslinux/gen.lua')
| -rw-r--r-- | pkg/syslinux/gen.lua | 50 |
1 files changed, 50 insertions, 0 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' |
