songs/bin/build.sh

49 lines
1.1 KiB
Bash
Raw Normal View History

2019-09-09 02:43:57 +00:00
#!/bin/bash
2019-09-15 05:16:45 +00:00
TEXML_HOME=$HOME/Library/texmf/tex/latex
PDF_JOINER="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
function setup_pdflatex {
if [ ! -d $TEXML_HOME ]; then
mkdir -p $TEXML_HOME
fi
if [ ! -d $TEXML_HOME/tex ]; then
2019-09-17 05:12:54 +00:00
ln -s "`realpath .`" $TEXML_HOME
2019-09-15 05:16:45 +00:00
fi
}
function make_pdf {
infile="`realpath "$1"`"
indir=$(dirname "$1")
pdf_outdir="`realpath "build/pdf"`/${indir#songs/}"
#aux_outdir="`realpath "aux"`/${indir#songs/}"
mkdir -p "$pdf_outdir"
#mkdir -p "$aux_outdir"
pdflatex \
-interaction=nonstopmode \
-output-directory="$pdf_outdir" \
"$infile"
}
function make_packet {
pdfs=""
while read p; do
make_pdf "songs/$p.tex"
2019-09-17 05:12:54 +00:00
done < <(grep includepdf $1 | sed -E 's/.*{build\/pdf\/([^}]*)\.pdf}.*/\1/')
2019-09-15 05:16:45 +00:00
mkdir -p "build/packets"
pdflatex \
2019-09-17 05:12:54 +00:00
-interaction=nonstopmode \
-output-directory="build/packets" \
"$1"
2019-09-15 05:16:45 +00:00
}
setup_pdflatex
2019-09-17 05:12:54 +00:00
#make_pdf "$1"
2019-09-15 05:16:45 +00:00
2019-09-25 05:16:36 +00:00
#make_packet "packets/aircoustic201910.tex"
make_packet "packets/pha201910.tex"