#!/bin/sh # Generate build.ninja that builds the docs/stats/… corpusdir=corpus layouts="ar-lulua ar-asmo663 ar-linux ar-malas ar-phonetic ar-osman ar-khorshid ar-osx ar-idlebi ar-alramly" layoutsXmodmap="ar-lulua" corpora="`ls ${corpusdir}`" cat < \$out rule render-svg command = lulua-render -l \$layout svg \$out rule render-svg-heat command = lulua-render -l \$layout svg --heatmap=\$in \$out rule render-xmodmap command = lulua-render -l \$layout xmodmap \$out rule analyze-heat command = lulua-analyze -l \$layout keyheatmap < \$in > \$out rule write-bbcarabic command = find \$in | lulua-write \$layout file brotli tar bbcarabic | lulua-analyze combine > \$out pool = write rule write-aljazeera command = find \$in | lulua-write \$layout file brotli tar aljazeera | lulua-analyze combine > \$out pool = write rule write-epub command = find \$in | lulua-write \$layout epub | lulua-analyze combine > \$out pool = write rule write-tanzil command = find \$in | lulua-write \$layout file text | lulua-analyze combine > \$out pool = write rule write-tei2 command = find \$in | lulua-write \$layout file brotli tar xml tei2 | lulua-analyze combine > \$out pool = write rule write-opensubtitles command = find \$in | lulua-write \$layout file brotli tar xml opensubtitles | lulua-analyze combine > \$out pool = write rule write-arwiki command = \$wikiextractor -ns 0 --json -o - \$in 2>/dev/null | jq .text | lulua-write \$layout json | lulua-analyze combine > \$out pool = write rule write-osm command = \$osmconvert --csv='name:ar' \$in | sort -u | lulua-write \$layout lines | lulua-analyze combine > \$out pool = write rule combine command = cat \$in | lulua-analyze combine > \$out rule mkdir command = mkdir -p \$out rule letterfreq command = lulua-analyze -l ar-lulua letterfreq < \$in > \$out rule analyze-layoutstats command = lulua-analyze -l \$layout layoutstats < \$in > \$out rule analyze-corpusstats command = lulua-analyze -l ar-lulua corpusstats \$metadata < \$stats > \$out rule wordlist command = lulua-analyze -l ar-lulua latinime < \$in > \$out rule report command = lulua-report -c \$corpus -l \$layoutstats > \$out rule cp command = cp \$in \$out rule cpR command = cp -R \$in \$out rule gz command = gzip -c \$in > \$out rule configure-make command = cd \$in && autoreconf --install && ./configure && make rule zipR command = ./makezip.sh \$in \$out rule render-winkbd command = lulua-render -l ar-lulua winkbd \$out ### build targets ### build \$reportdir: mkdir build \$reportdir/fonts: mkdir build \$tempdir: mkdir build \$reportdir/letterfreq.json: letterfreq \$statsdir/ar-lulua/all.pickle || \$reportdir build \$reportdir/style.css: cp \$datadir/report/style.css || \$reportdir build \$reportdir/lulua-logo.svg: cp \$datadir/report/lulua-logo.svg || \$reportdir # wordlist build \$tempdir/lulua.combined: wordlist \$statsdir/ar-lulua/all.pickle || \$tempdir build \$reportdir/lulua.combined.gz: gz \$tempdir/lulua.combined || \$reportdir build \$reportdir/fonts/IBMPlexSansArabic-Regular.woff2: cp \$fontdir/IBMPlexSansArabic-Regular.woff2 || \$reportdir/fonts build \$reportdir/fonts/IBMPlexSansArabic-Thin.woff2: cp \$fontdir/IBMPlexSansArabic-Thin.woff2 || \$reportdir/fonts # build osmconvert build \$osmconvert: configure-make 3rdparty/osmctools # windows drivers build \$tempdir/winkbd: cpR lulua/data/winkbd build \$tempdir/winkbd/customization.h: render-winkbd || \$tempdir/winkbd build \$tempdir/ar-lulua-w64: mkdir EOF w64zipfile="System32/kbdarlulua.dll SysWOW64/kbdarlulua.dll README.txt lulua.reg install.bat" deps="" for f in $w64zipfile; do echo "build \$tempdir/ar-lulua-w64/$f: cp \$tempdir/winkbd/$f || \$tempdir/ar-lulua-w64" deps+=" \$tempdir/ar-lulua-w64/$f" done cat <