build.sh 2.4 KB

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