Cross-Platform build scripts for audio plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pack-plugins.sh 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #!/bin/bash
  2. set -e
  3. cd $(dirname ${0})
  4. PAWPAW_ROOT="${PWD}"
  5. # ---------------------------------------------------------------------------------------------------------------------
  6. target="${1}"
  7. if [ -z "${target}" ]; then
  8. echo "usage: ${0} <target> <plugin1> ..."
  9. exit 1
  10. fi
  11. shift
  12. VERSION=$(cat VERSION)
  13. # ---------------------------------------------------------------------------------------------------------------------
  14. source setup/check_target.sh
  15. source setup/env.sh
  16. # ---------------------------------------------------------------------------------------------------------------------
  17. function download_and_install_innosetup {
  18. local dlfile="${PAWPAW_DOWNLOADDIR}/innosetup-6.0.5.exe"
  19. local pkgdir="${PAWPAW_BUILDDIR}/innosetup-6.0.5"
  20. if [ ! -f "${dlfile}" ]; then
  21. # FIXME proper dl version
  22. curl -L https://jrsoftware.org/download.php/is.exe?site=2 -o "${dlfile}"
  23. fi
  24. if [ ! -d "${pkgdir}"/drive_c ]; then
  25. env WINEPREFIX="${pkgdir}" wineboot -u
  26. fi
  27. if [ ! -f "${pkgdir}"/drive_c/InnoSetup/ISCC.exe ]; then
  28. env WINEPREFIX="${pkgdir}" wine "${dlfile}" /allusers /dir=C:\\InnoSetup /nocancel /norestart /verysilent
  29. fi
  30. }
  31. function create_innosetup_exe {
  32. local pkgdir="${PAWPAW_BUILDDIR}/innosetup-6.0.5"
  33. local iscc="${pkgdir}/drive_c/InnoSetup/ISCC.exe"
  34. echo "#define VERSION \"${VERSION}\"" > /tmp/pawpaw/version.iss
  35. env WINEPREFIX="${pkgdir}" wine "${iscc}" "setup/inno/${PAWPAW_TARGET}.iss"
  36. }
  37. # ---------------------------------------------------------------------------------------------------------------------
  38. rm -rf /tmp/pawpaw
  39. mkdir /tmp/pawpaw
  40. if [ "${WIN32}" -eq 1 ]; then
  41. download_and_install_innosetup
  42. touch /tmp/pawpaw/components.iss
  43. touch /tmp/pawpaw/lv2bundles.iss
  44. PAWPAW_WINE_LV2DIR="Z:$(echo ${PAWPAW_PREFIX} | tr -t '/' '\\')\\lib\\lv2\\"
  45. elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
  46. touch /tmp/pawpaw/choices.xml
  47. touch /tmp/pawpaw/outlines.xml
  48. fi
  49. # ---------------------------------------------------------------------------------------------------------------------
  50. for plugin in ${@}; do
  51. pfile="${PAWPAW_ROOT}/plugins/${plugin}.json"
  52. if [ ! -e "${pfile}" ]; then
  53. echo "Requested plugin file '${pfile}' does not exist"
  54. exit 2
  55. fi
  56. name=$(jq -crM .name ${pfile})
  57. sname=$(echo ${name} | tr -ds '-' '_')
  58. description=$(jq -crM .description ${pfile})
  59. lv2bundles=($(jq -crM .lv2bundles[] ${pfile}))
  60. if [ "${WIN32}" -eq 1 ]; then
  61. echo "Name: ${sname}; Description: \"${name}\"; Types: full;" >> /tmp/pawpaw/components.iss
  62. elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
  63. echo " <choice id=\"studio.kx.distrho.pawpaw.${sname}\" title=\"${name}\" description=\"${description}\" visible=\"true\">" >> /tmp/pawpaw/choices.xml
  64. echo " <line choice=\"studio.kx.distrho.pawpaw.${sname}\"/>" >> /tmp/pawpaw/outlines.xml
  65. fi
  66. for lv2bundle in ${lv2bundles[@]}; do
  67. if [ "${WIN32}" -eq 1 ]; then
  68. echo "Source: \"${PAWPAW_WINE_LV2DIR}${lv2bundle}\\*\"; DestDir: \"{commoncf}\\LV2\\${lv2bundle}\"; Components: ${sname}; Flags: recursesubdirs" >> /tmp/pawpaw/lv2bundles.iss
  69. elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
  70. bundleref="pawpaw-bundle-${sname}-${lv2bundle}.pkg"
  71. echo " <pkg-ref id=\"studio.kx.distrho.pawpaw.${sname}_${lv2bundle}\" version=\"0\">${bundleref}</pkg-ref>" >> /tmp/pawpaw/choices.xml
  72. pkgbuild \
  73. --identifier "studio.kx.distrho.pawpaw.${sname}_${lv2bundle}" \
  74. --install-location "/Library/Audio/Plug-Ins/LV2/${lv2bundle}/" \
  75. --root "${PAWPAW_PREFIX}/lib/lv2/${lv2bundle}/" \
  76. "setup/macos/${bundleref}"
  77. fi
  78. done
  79. if [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
  80. echo " </choice>" >> /tmp/pawpaw/choices.xml
  81. fi
  82. done
  83. if [ "${WIN32}" -eq 1 ]; then
  84. create_innosetup_exe
  85. elif [ "${MACOS}" -eq 1 ] && [ "${MACOS_OLD}" -eq 0 ]; then
  86. if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
  87. suffix="universal"
  88. else
  89. suffix="intel"
  90. fi
  91. pushd setup/macos
  92. python -c "
  93. with open('package.xml.in', 'r') as fh:
  94. packagexml = fh.read()
  95. with open('/tmp/pawpaw/choices.xml', 'r') as fh:
  96. choicesxml = fh.read().strip()
  97. with open('/tmp/pawpaw/outlines.xml', 'r') as fh:
  98. outlinesxml = fh.read().strip()
  99. print(packagexml.replace('@CURDIR@','${PWD}').replace('@CHOICES@',choicesxml).replace('@OUTLINES@',outlinesxml))" > package.xml
  100. productbuild \
  101. --distribution package.xml \
  102. --identifier studio.kx.distrho.pawpaw \
  103. --package-path "${PWD}" \
  104. --version ${VERSION} \
  105. PawPaw-macOS-${suffix}-v${VERSION}.pkg
  106. rm package.xml pawpaw-bundle-*
  107. popd
  108. fi
  109. rm -rf /tmp/pawpaw
  110. # ---------------------------------------------------------------------------------------------------------------------