build.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. rm ../output/*
  3. for part in ../score-and-parts/*; do
  4. while read j; do
  5. size=($j)
  6. if [[ ${size:0:1} != "#" ]]; then
  7. # make score or part
  8. music="../output/$(basename $part .ily)-$size-music.ly"
  9. cat version > $music
  10. echo "width=${size[1]}" >> $music
  11. echo "height=${size[2]}" >> $music
  12. echo "margin=${size[3]}" >> $music
  13. echo "bottommargin=${size[3]}" >> $music
  14. if [[ $(basename $part .ily) = *"score"* ]]; then
  15. echo "staff=${size[4]}" >> $music
  16. else
  17. echo "staff=${size[5]}" >> $music
  18. fi
  19. cat page >> $music
  20. cat $part >> $music
  21. # make performance notes
  22. performance_notes="../output/$(basename $part .ily)-$size-performance-notes.ly"
  23. cat version > $performance_notes
  24. echo "width=${size[1]}" >> $performance_notes
  25. echo "height=${size[2]}" >> $performance_notes
  26. echo "systems=#'unset" >> $performance_notes
  27. echo "margin=${size[3]}" >> $performance_notes
  28. echo "bottommargin=${size[3]}" >> $performance_notes
  29. if [[ $(basename $part .ily) = *"score"* ]]; then
  30. echo "staff=${size[4]}" >> $performance_notes
  31. else
  32. echo "staff=${size[5]}" >> $performance_notes
  33. fi
  34. cat page >> $performance_notes
  35. cat ../performance-notes/performance-notes.ily >> $performance_notes
  36. # make title page
  37. title_page="../output/$(basename $part .ily)-$size-title-page.ly"
  38. cat version > $title_page
  39. echo "width=${size[1]}" >> $title_page
  40. echo "height=${size[2]}" >> $title_page
  41. echo "systems=#'unset" >> $title_page
  42. echo "margin=${size[3]}" >> $title_page
  43. echo "bottommargin=$(echo "0.5 * ${size[2]}" | bc)" >> $title_page
  44. if [[ $(basename $part .ily) = *"score"* ]]; then
  45. echo "staff=${size[4]}" >> $title_page
  46. else
  47. echo "staff=${size[5]}" >> $title_page
  48. fi
  49. cat page >> $title_page
  50. cat ../title-page/title-page.ily >> $title_page
  51. fi
  52. done < sizes
  53. done
  54. cd ../output
  55. for i in *.ly; do
  56. lilypond -dno-point-and-click --include ../include/openlilylib $i
  57. done
  58. for music in *-music.pdf; do
  59. performance_notes=$(basename $music -music.pdf)-performance-notes.pdf
  60. title_page=$(basename $music -music.pdf)-title-page.pdf
  61. pdftk $title_page $performance_notes $music cat output $(basename $music -music.pdf).pdf
  62. rm $title_page $performance_notes $music
  63. done
  64. rm *.log *.ly