Compare commits

..

10 Commits

9 changed files with 67 additions and 117 deletions

View File

@ -1,12 +0,0 @@
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
[Makefile]
indent_style = tab

2
.gitignore vendored
View File

@ -5,4 +5,4 @@
.vscode .vscode
tmp tmp
build build
src/tmp_ly src/tmp-ly

View File

@ -1,7 +1,7 @@
build: build:
image: thallian/latex-builder image: thallian/latex-builder
script: script:
- make - make -j4
artifacts: artifacts:
paths: paths:
- build/* - build/*

123
Makefile
View File

@ -1,101 +1,70 @@
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
WORKING_DIR := $(patsubst %/,%,$(dir $(mkfile_path))) WORKING_DIR := $(patsubst %/,%,$(dir $(mkfile_path)))
BOOKNAME=kommersbuch BOOKNAME=kommersbuch
SRC_DIR=src SRC_DIR=src
BUILD_DIR=build BUILD_DIR=build
TMP_DIR=tmp TMP_DIR=tmp
SONG_DIR=${SRC_DIR}/songs SONG_DIR=$(SRC_DIR)/songs
BUILD_BOOK_DIR=${BUILD_DIR}/books BUILD_BOOK_DIR=$(BUILD_DIR)/books
TMP_BOOK_DIR=${TMP_DIR}/books TMP_BOOK_DIR=$(TMP_DIR)/books
BUILD_SONG_DIR=${BUILD_DIR}/songs BUILD_SONG_DIR=$(BUILD_DIR)/songs
TMP_SONG_DIR=${TMP_DIR}/songs TMP_SONG_DIR=$(TMP_DIR)/songs
BUILD_MIDI_DIR=${BUILD_DIR}/midi BUILD_MIDI_DIR=$(BUILD_DIR)/midi
TMP_MIDI_DIR=${TMP_DIR}/midi TMP_MIDI_DIR=$(TMP_DIR)/midi
BUILD_OPUS_DIR=${BUILD_DIR}/opus BUILD_OPUS_DIR=$(BUILD_DIR)/opus
LY_FILES=$(wildcard ${SONG_DIR}/*.ly) BOOK_TYPES=folio quarto sexto octavo
LY_PDFS=$(patsubst %.ly,${BUILD_SONG_DIR}/%.pdf,$(notdir ${LY_FILES}))
LY_TMP_PDFS=$(patsubst %.ly,${TMP_SONG_DIR}/%.pdf,$(notdir ${LY_FILES}))
LY_MIDIS=$(patsubst %.ly,${BUILD_MIDI_DIR}/%.midi,$(notdir ${LY_FILES}))
LY_TMP_MIDIS=$(patsubst %.ly,${TMP_MIDI_DIR}/%.midi,$(notdir ${LY_FILES}))
LY_OPUS=$(patsubst %.ly,${BUILD_OPUS_DIR}/%.opus,$(notdir ${LY_FILES}))
.PHONY: book songs midi opus clean directories all LY_FILES=$(wildcard $(SONG_DIR)/*.ly)
LY_PDFS=$(patsubst %.ly,$(BUILD_SONG_DIR)/%.pdf,$(notdir $(LY_FILES)))
LY_TMP_PDFS=$(patsubst %.ly,$(TMP_SONG_DIR)/%.pdf,$(notdir $(LY_FILES)))
LY_MIDIS=$(patsubst %.ly,$(BUILD_MIDI_DIR)/%.midi,$(notdir $(LY_FILES)))
LY_TMP_MIDIS=$(patsubst %.ly,$(TMP_MIDI_DIR)/%.midi,$(notdir $(LY_FILES)))
LY_OPUS=$(patsubst %.ly,$(BUILD_OPUS_DIR)/%.opus,$(notdir $(LY_FILES)))
.PHONY: book songs midi opus clean all
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
directories: ${BUILD_DIR} ${BUILD_BOOK_DIR} ${TMP_BOOK_DIR} ${BUILD_SONG_DIR} ${BUILD_MIDI_DIR} ${TMP_DIR} ${TMP_SONG_DIR} ${TMP_MIDI_DIR} ${BUILD_OPUS_DIR} define BUILDER
$(TMP_BOOK_DIR)/%-$(TYPE).pdf: $(TMP_BOOK_DIR)/%.pdf
cd $(TMP_BOOK_DIR) && \
../../bin/makebook -v -t $(TYPE) -i $$(notdir $$<) -o $$(notdir $$@)
endef
$(foreach TYPE,$(BOOK_TYPES),$(eval $(BUILDER)))
${BUILD_DIR}: %.dir:
mkdir -p ${BUILD_DIR} mkdir -p $*
${BUILD_BOOK_DIR}: $(TMP_SONG_DIR)/%.pdf: $(SONG_DIR)/%.ly $(SONG_DIR)/%.tex | $(TMP_SONG_DIR).dir
mkdir -p ${BUILD_BOOK_DIR} cd $(SRC_DIR) && lualatex --jobname='$(notdir $(basename $@))' \
--output-directory=$(WORKING_DIR)/$(TMP_SONG_DIR) \
--shell-escape $(WORKING_DIR)/$(SRC_DIR)/song.tex \
$(WORKING_DIR)/$(SONG_DIR)/$(notdir $(basename $@)).ly $(WORKING_DIR)/$(SONG_DIR)/$(notdir $(basename $@)).tex
${BUILD_SONG_DIR}: $(BUILD_MIDI_DIR)/%.midi: $(TMP_MIDI_DIR)/%-1.midi | $(BUILD_MIDI_DIR).dir
mkdir -p ${BUILD_SONG_DIR}
${BUILD_MIDI_DIR}:
mkdir -p ${BUILD_MIDI_DIR}
${TMP_DIR}:
mkdir -p ${TMP_DIR}
${TMP_BOOK_DIR}:
mkdir -p ${TMP_BOOK_DIR}
${TMP_SONG_DIR}:
mkdir -p ${TMP_SONG_DIR}
${TMP_MIDI_DIR}:
mkdir -p ${TMP_MIDI_DIR}
${BUILD_OPUS_DIR}:
mkdir -p ${BUILD_OPUS_DIR}
${TMP_SONG_DIR}/%.pdf: ${SONG_DIR}/%.ly ${SONG_DIR}/%.tex
cd ${SRC_DIR} && lualatex --jobname='$(notdir $(basename $@))' --output-directory=${WORKING_DIR}/${TMP_SONG_DIR} --shell-escape ${WORKING_DIR}/${SRC_DIR}/song.tex ${WORKING_DIR}/${SONG_DIR}/$(notdir $(basename $@)).ly ${WORKING_DIR}/${SONG_DIR}/$(notdir $(basename $@)).tex
rm -r ${SRC_DIR}/tmp-ly
${BUILD_MIDI_DIR}/%.midi: ${TMP_MIDI_DIR}/%-1.midi
cp $< $@ cp $< $@
${TMP_MIDI_DIR}/%-1.midi: ${SONG_DIR}/%.ly $(TMP_MIDI_DIR)/%-1.midi: $(SONG_DIR)/%.ly | $(TMP_MIDI_DIR).dir
lilypond --output=${TMP_MIDI_DIR} ${WORKING_DIR}/$< lilypond --output=$(TMP_MIDI_DIR) $(WORKING_DIR)/$<
${BUILD_OPUS_DIR}/%.opus: ${BUILD_MIDI_DIR}/%.midi $(BUILD_OPUS_DIR)/%.opus: $(BUILD_MIDI_DIR)/%.midi | $(BUILD_OPUS_DIR).dir
timidity $< -Ow -o - | opusenc - $@ timidity $< -Ow -o - | opusenc - $@
${TMP_BOOK_DIR}/%.pdf: ${SRC_DIR}/%.tex ${SRC_DIR}/images/title.png $(TMP_BOOK_DIR)/%.pdf: $(SRC_DIR)/%.tex $(SRC_DIR)/images/title.png | $(TMP_BOOK_DIR).dir
latexmk -cd -lualatex -e '$$lualatex=q/lualatex %O -shell-escape %S/' -output-directory=${WORKING_DIR}/${TMP_BOOK_DIR} $< latexmk -cd -lualatex -e '$$lualatex=q/lualatex %O -shell-escape %S/' -output-directory=$(WORKING_DIR)/$(TMP_BOOK_DIR) $<
rm -r ${SRC_DIR}/tmp-ly rm -r $(SRC_DIR)/tmp-ly
${TMP_BOOK_DIR}/%-folio.pdf: ${TMP_BOOK_DIR}/%.pdf $(BUILD_DIR)/%.pdf: $(TMP_DIR)/%.pdf | $(BUILD_BOOK_DIR).dir $(BUILD_SONG_DIR).dir
cd ${TMP_BOOK_DIR} && \
../../bin/makebook -v -t folio -i $(notdir $<) -o $(notdir $@)
#long edge binding
${TMP_BOOK_DIR}/%-quarto.pdf: ${TMP_BOOK_DIR}/%.pdf
cd ${TMP_BOOK_DIR} && \
../../bin/makebook -v -t quarto -i $(notdir $<) -o $(notdir $@)
${TMP_BOOK_DIR}/%-sexto.pdf: ${TMP_BOOK_DIR}/%.pdf
cd ${TMP_BOOK_DIR} && \
../../bin/makebook -v -t sexto -i $(notdir $<) -o $(notdir $@)
#short edge binding
${TMP_BOOK_DIR}/%-octavo.pdf: ${TMP_BOOK_DIR}/%.pdf
cd ${TMP_BOOK_DIR} && \
../../bin/makebook -v -t octavo -i $(notdir $<) -o $(notdir $@)
${BUILD_DIR}/%.pdf: ${TMP_DIR}/%.pdf
cp $< $@ cp $< $@
book: directories ${BUILD_BOOK_DIR}/${BOOKNAME}.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-folio.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-quarto.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-sexto.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-octavo.pdf ${LY_FILES} book: $(BUILD_BOOK_DIR)/$(BOOKNAME).pdf $(BUILD_BOOK_DIR)/$(BOOKNAME)-folio.pdf $(BUILD_BOOK_DIR)/$(BOOKNAME)-quarto.pdf $(BUILD_BOOK_DIR)/$(BOOKNAME)-sexto.pdf $(BUILD_BOOK_DIR)/$(BOOKNAME)-octavo.pdf $(LY_FILES)
songs: directories ${LY_PDFS} songs: $(LY_PDFS)
midi: directories ${LY_MIDIS} midi: $(LY_MIDIS)
opus: directories ${LY_OPUS} opus: $(LY_OPUS)
all: book songs midi opus all: book songs midi opus
clean: clean:
rm -rf ${BUILD_DIR} rm -rf $(BUILD_DIR)
rm -rf ${TMP_DIR} rm -rf $(TMP_DIR)
rm -rf $(SRC_DIR)/tmp-ly

View File

@ -6,10 +6,10 @@
# #
#**********************************************************# #**********************************************************#
# makebook # # makebook #
# written by Donald P. Goodman III # # written by Donald P. Goodman III #
# Copyright (C) 2011 # # Copyright (C) 2011 #
# # # #
# Impose pdf pages for binding # # Impose pdf pages for binding #
#**********************************************************# #**********************************************************#
# #
# This program is free software: you can redistribute it # This program is free software: you can redistribute it
@ -34,7 +34,7 @@
PATH=/bin:/usr/bin:/usr/local/bin ; export PATH PATH=/bin:/usr/bin:/usr/local/bin ; export PATH
umask 033 umask 033
# define our revision number variable for rcs # define our revision number variable for rcs
REVISION="2.1" REVISION="2.2"
# define error codes # define error codes
E_WRONG_ARGS=64 # too many or few args E_WRONG_ARGS=64 # too many or few args
E_BAD_SIG_TYPE=65 # invalid type of signature E_BAD_SIG_TYPE=65 # invalid type of signature
@ -88,8 +88,7 @@ command -v bc >/dev/null 2>&1 ||
# print the version information and exit successfully # print the version information and exit successfully
versionfunc () versionfunc ()
{ {
echo "makebook v${REVISION}. Copyright (C) 2011, Donald P." echo "makebook v${REVISION}. Copyright (C) 2011, Donald P Goodman III."
echo "Goodman III."
echo "This program comes with ABSOLUTELY NO WARRANTY." echo "This program comes with ABSOLUTELY NO WARRANTY."
echo "This is free software, and you are welcome to " echo "This is free software, and you are welcome to "
echo "redistribute it under certain conditions; see " echo "redistribute it under certain conditions; see "
@ -263,6 +262,9 @@ then
cp "$FILE_NAME" "$NEW_FILE_NAME" cp "$FILE_NAME" "$NEW_FILE_NAME"
else else
FILE_NAME="book.pdf" FILE_NAME="book.pdf"
if [ $VERBOSE -eq 1 ]; then
echo "makebook: No input file named; using stdin..."
fi
cat /dev/stdin > "$NEW_FILE_NAME" cat /dev/stdin > "$NEW_FILE_NAME"
fi fi
# declare holder variable for pdftk # declare holder variable for pdftk
@ -287,8 +289,8 @@ fi
# get some information about our source document # get some information about our source document
NUM_PAGES=`pdfinfo "$NEW_FILE_NAME" | awk '/Pages:/ {print $2}'`; NUM_PAGES=`pdfinfo "$NEW_FILE_NAME" | awk '/Pages:/ {print $2}'`;
SRC_PAGE_WIDTH=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $3}'`; SRC_PAGE_WIDTH=`pdfinfo "$NEW_FILE_NAME" | awk '/Page size:/ {print $3}'`;
SRC_PAGE_HEIGHT=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $5}'`; SRC_PAGE_HEIGHT=`pdfinfo "$NEW_FILE_NAME" | awk '/Page size:/ {print $5}'`;
# find the number of pages we'll have per signature # find the number of pages we'll have per signature
PAGES_PER_SIG=$(dc -e "$PAGES_PER_SIG $SECT_TYPE * p") PAGES_PER_SIG=$(dc -e "$PAGES_PER_SIG $SECT_TYPE * p")
# determine if extra pages will be necessary # determine if extra pages will be necessary

View File

@ -3,7 +3,7 @@
\header { \header {
title = "Die Gedanken sind frei" title = "Die Gedanken sind frei"
composer = "Volksweise (um 1815) " composer = "Volksweise, um 1815"
poet = "" poet = ""
tagline = "" tagline = ""
} }

View File

@ -1,14 +1,5 @@
\par \par
2. Die Gedanken sind frei, 2. Ich denke, was ich will,
wer kann sie erraten,
sie fliehen vorbei,
wie nächtliche Schatten.
Kein Mensch kann sie wissen,
kein Jäger erschießen.
Es bleibet dabei:
Die Gedanken sind frei.
\par
3. Ich denke, was ich will,
und was mich beglücket, und was mich beglücket,
doch alles in der Still, doch alles in der Still,
und wie es sich schicket. und wie es sich schicket.
@ -17,7 +8,7 @@ kann niemand verwehren,
es bleibet dabei: es bleibet dabei:
die Gedanken sind frei. die Gedanken sind frei.
\par \par
4. Ich liebe den Wein, 3. Ich liebe den Wein,
mein Mädchen vor allen, mein Mädchen vor allen,
sie tut mir allein sie tut mir allein
am besten gefallen. am besten gefallen.
@ -26,7 +17,7 @@ bei meinem Glas Weine,
mein Mädchen dabei: mein Mädchen dabei:
die Gedanken sind frei. die Gedanken sind frei.
\par \par
5. Und sperrt man mich ein 4. Und sperrt man mich ein
im finsteren Kerker, im finsteren Kerker,
das alles sind rein das alles sind rein
vergebliche Werke; vergebliche Werke;
@ -35,7 +26,7 @@ zerreißen die Schranken
und Mauern entzwei: und Mauern entzwei:
die Gedanken sind frei. die Gedanken sind frei.
\par \par
6. Drum will ich auf immer 5. Drum will ich auf immer
den Sorgen entsagen den Sorgen entsagen
und will mich auch nimmer und will mich auch nimmer
mit Grillen mehr plagen. mit Grillen mehr plagen.

View File

@ -3,7 +3,7 @@
\header { \header {
title = "O König von Preußen" title = "O König von Preußen"
composer = "Volksweise (18. Jh.)" composer = "Volksweise, 18. Jh."
poet = "" poet = ""
tagline = "" tagline = ""
} }

View File

@ -25,8 +25,8 @@ und bringen sie uns wieder,
sie henken uns nicht auf, sie henken uns nicht auf,
das Kriegsrecht wird gesprochen: das Kriegsrecht wird gesprochen:
Der Kerl muß Gassen lauf! Der Kerl muß Gassen lauf!
5. \par \par
Und wann wir Gassen laufen, 5. Und wann wir Gassen laufen,
so spielet man uns auf so spielet man uns auf
mit Waldhorn und Trompeten, mit Waldhorn und Trompeten,
da geht es tapfer drauf; da geht es tapfer drauf;