gen.lua (4259B)
1 cflags({ 2 '-Wall', '-Wpedantic', 3 '-D _XOPEN_SOURCE=700', 4 '-D TERMINFO_DB', 5 ([[-D '_PATH_TERMINFO="%s/share/misc/terminfo"']]):format(config.prefix), 6 '-I $srcdir/compat', 7 '-I $srcdir/lib/libcurses', 8 '-I $srcdir/lib/libterminfo', 9 '-I $srcdir/lib/libform', 10 '-I $srcdir/lib/libmenu', 11 '-I $srcdir/lib/libpanel', 12 '-I $outdir', 13 }) 14 15 sub('tools.ninja', function() 16 toolchain(config.host) 17 cflags{ 18 '-I $srcdir/compat', 19 '-I $srcdir/lib/libterminfo', 20 } 21 set('outdir', '$outdir/host') 22 23 cc('compat/mi_vector_hash.c') 24 build('cc', '$outdir/hash.c.o', '$outdir/../hash.c') 25 26 exe('nbperf', [[ 27 usr.bin/nbperf/( 28 nbperf.c 29 nbperf-bdz.c nbperf-chm.c nbperf-chm3.c 30 graph2.c graph3.c 31 ) 32 compat/mi_vector_hash.c.o 33 ]]) 34 35 exe('tic', [[ 36 usr.bin/tic/tic.c 37 lib/libterminfo/compile.c 38 compat/cdbw.c 39 compat/mi_vector_hash.c.o 40 hash.c.o 41 ]]) 42 end) 43 44 pkg.hdrs = { 45 copy('$outdir/include', '$srcdir/lib/libcurses', {'curses.h', 'unctrl.h'}), 46 copy('$outdir/include', '$srcdir/lib/libterminfo', {'term.h', 'termcap.h'}), 47 copy('$outdir/include', '$srcdir/lib/libpanel', {'panel.h'}), 48 install=true, 49 } 50 pkg.deps = { 51 '$outdir/compiled_terms.c', 52 '$outdir/termcap_hash.c', 53 '$outdir/hash.c', 54 } 55 56 rule('tic', '$outdir/host/tic $ticflags -o $out $in $terms') 57 build('tic', '$outdir/compiled_terms.c', {'$srcdir/share/terminfo/terminfo', '|', '$outdir/host/tic'}, { 58 ticflags='-Sx', 59 terms='dumb', 60 }) 61 build('tic', '$outdir/terminfo.cdb', {'$srcdir/share/terminfo/terminfo', '|', '$outdir/host/tic'}, { 62 ticflags='-x', 63 }) 64 file('share/misc/terminfo.cdb', '644', '$outdir/terminfo.cdb') 65 66 rule('genhash', 'TOOL_NBPERF=$outdir/host/nbperf $srcdir/lib/libterminfo/genhash $in >$out') 67 build('genhash', '$outdir/hash.c', { 68 '$srcdir/lib/libterminfo/term.h', 69 '|', '$srcdir/lib/libterminfo/genhash', '$outdir/host/nbperf', 70 }) 71 72 rule('genthash', 'TOOL_NBPERF=$outdir/host/nbperf $srcdir/lib/libterminfo/genthash $in >$out') 73 build('genthash', '$outdir/termcap_hash.c', { 74 '$srcdir/lib/libterminfo/termcap_map.c', 75 '|', '$srcdir/lib/libterminfo/genthash', '$outdir/host/nbperf', 76 }) 77 78 lib('libcurses.a', [[ 79 lib/libcurses/( 80 acs.c addbytes.c addch.c addchnstr.c addnstr.c attributes.c 81 background.c bell.c border.c box.c chgat.c clear.c clearok.c 82 clrtobot.c clrtoeol.c color.c copywin.c cr_put.c 83 ctrace.c cur_hash.c curs_set.c 84 curses.c delch.c deleteln.c delwin.c echochar.c erase.c fileio.c 85 flushok.c fullname.c getch.c getstr.c getyx.c id_subwins.c idlok.c 86 idcok.c immedok.c inch.c inchstr.c initscr.c insch.c insdelln.c 87 insertln.c insstr.c instr.c keypad.c keyname.c leaveok.c line.c 88 meta.c mouse.c move.c 89 mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c 90 printw.c putchar.c refresh.c resize.c ripoffline.c scanw.c screen.c 91 scroll.c scrollok.c setterm.c slk.c standout.c syncok.c timeout.c 92 toucholap.c touchwin.c tstp.c tty.c unctrl.c underscore.c version.c 93 94 cchar.c add_wch.c add_wchstr.c addwstr.c echo_wchar.c ins_wch.c 95 ins_wstr.c get_wch.c get_wstr.c in_wch.c in_wchstr.c 96 inwstr.c 97 ) 98 libterminfo.a 99 ]]) 100 file('lib/libcurses.a', '644', '$outdir/libcurses.a') 101 102 lib('libterminfo.a', [[ 103 lib/libterminfo/( 104 term.c ti.c setupterm.c curterm.c tparm.c tputs.c 105 compile.c 106 termcap.c 107 ) 108 compat/cdbr.c 109 compat/mi_vector_hash.c 110 $outdir/hash.c 111 ]]) 112 file('lib/libterminfo.a', '644', '$outdir/libterminfo.a') 113 114 lib('libpanel.a', [[ 115 lib/libpanel/( 116 _deck.c above.c below.c bottom.c del.c getuser.c hidden.c hide.c move.c 117 new.c replace.c setuser.c show.c top.c update.c window.c 118 ) 119 libcurses.a.d 120 ]]) 121 file('lib/libpanel.a', '644', '$outdir/libpanel.a') 122 123 exe('infocmp', [[usr.bin/infocmp/infocmp.c libterminfo.a]]) 124 file('bin/infocmp', '755', '$outdir/infocmp') 125 exe('tabs', [[usr.bin/tabs/tabs.c libterminfo.a]]) 126 file('bin/tabs', '755', '$outdir/tabs') 127 exe('tic', [[usr.bin/tic/tic.c compat/cdbw.c libterminfo.a]]) 128 file('bin/tic', '755', '$outdir/tic') 129 exe('tput', [[usr.bin/tput/tput.c libterminfo.a]]) 130 file('bin/tput', '755', '$outdir/tput') 131 exe('tset', [[usr.bin/tset/(map.c misc.c set.c term.c tset.c) libterminfo.a]]) 132 file('bin/tset', '755', '$outdir/tset') 133 sym('bin/reset', 'tset') 134 135 man({ 136 'usr.bin/infocmp/infocmp.1', 137 'usr.bin/tabs/tabs.1', 138 'usr.bin/tic/tic.1', 139 'usr.bin/tput/tput.1', 140 'usr.bin/tset/tset.1', 141 }) 142 143 fetch('git')