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.

149 lines
4.2KB

  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. # TODO check that bootstrap.sh has been run
  13. # ---------------------------------------------------------------------------------------------------------------------
  14. source setup/check_target.sh
  15. source setup/env.sh
  16. source setup/functions.sh
  17. source setup/versions.sh
  18. # ---------------------------------------------------------------------------------------------------------------------
  19. LV2DIR="${PAWPAW_PREFIX}/lib/lv2"
  20. if [ "${WIN32}" -eq 1 ] && [ ! -d "${HOME}/.wine" ]; then
  21. env WINEARCH="${PAWPAW_TARGET}" WINEDLLOVERRIDES="mscoree,mshtml=" wineboot -u
  22. fi
  23. function validate_lv2_bundle() {
  24. local lv2bundle="${1}"
  25. rm -rf /tmp/pawpaw-plugin-check
  26. mkdir /tmp/pawpaw-plugin-check
  27. cp -r "${LV2DIR}/${lv2bundle}" /tmp/pawpaw-plugin-check/
  28. env LANG=C LV2_PATH="${LV2DIR}" \
  29. "${PAWPAW_PREFIX}/bin/lv2_validate" \
  30. "${LV2DIR}/kx-*/*.ttl" \
  31. "/tmp/pawpaw-plugin-check/${lv2bundle}/*.ttl" 1>&2
  32. if [ "${CROSS_COMPILING}" -eq 0 ] || [ -n "${EXE_WRAPPER}" ]; then
  33. env LANG=C LV2_PATH=/tmp/pawpaw-plugin-check WINEDEBUG=-all \
  34. ${EXE_WRAPPER} \
  35. "${PAWPAW_PREFIX}/bin/lv2ls${APP_EXT}" | tr -d '\r'
  36. fi
  37. rm -rf /tmp/pawpaw-plugin-check
  38. }
  39. function validate_lv2_plugin() {
  40. local lv2plugin="${1}"
  41. local carlaenv="CARLA_BRIDGE_DUMMY=1"
  42. if [ "${WIN64}" -eq 1 ]; then
  43. carlaenv+=" CARLA_BRIDGE_TESTING=win64"
  44. elif [ "${WIN32}" -eq 1 ]; then
  45. carlaenv+=" CARLA_BRIDGE_TESTING=win32"
  46. else
  47. carlaenv+=" CARLA_BRIDGE_TESTING=native"
  48. fi
  49. env LANG=C LV2_PATH="${LV2DIR}" WINEDEBUG=-all ${carlaenv} \
  50. "${PAWPAW_PREFIX}/bin/carla-single" lv2 "${lv2plugin}" 1>/dev/null
  51. }
  52. # ---------------------------------------------------------------------------------------------------------------------
  53. exitcode=0
  54. for plugin in ${@}; do
  55. pfile="${PAWPAW_ROOT}/plugins/${plugin}.json"
  56. if [ ! -e "${pfile}" ]; then
  57. echo "Requested plugin file '${pfile}' does not exist"
  58. exit 2
  59. fi
  60. name=$(jq -crM .name ${pfile})
  61. version=$(jq -crM .version ${pfile})
  62. buildtype=$(jq -crM .buildtype ${pfile})
  63. dlbaseurl=$(jq -crM .dlbaseurl ${pfile})
  64. lv2bundles=($(jq -crM .lv2bundles[] ${pfile}))
  65. # optional args
  66. buildargs=$(echo -e $(jq -ecrM .buildargs ${pfile} || echo '\n\n') | tail -n 1)
  67. dlext=$(echo -e $(jq -ecrM .dlext ${pfile} || echo '\n\n') | tail -n 1)
  68. dlmethod=$(echo -e $(jq -ecrM .dlmethod ${pfile} || echo '\n\n') | tail -n 1)
  69. download "${name}" "${version}" "${dlbaseurl}" "${dlext}" "${dlmethod}"
  70. case ${buildtype} in
  71. "autoconf")
  72. build_autoconf "${name}" "${version}" "${buildargs}"
  73. ;;
  74. "conf")
  75. build_conf "${name}" "${version}" "${buildargs}"
  76. ;;
  77. "cmake")
  78. build_cmake "${name}" "${version}" "${buildargs}"
  79. ;;
  80. "make")
  81. build_make "${name}" "${version}" "${buildargs}"
  82. ;;
  83. "meson")
  84. build_meson "${name}" "${version}" "${buildargs}"
  85. ;;
  86. "waf")
  87. build_waf "${name}" "${version}" "${buildargs}"
  88. ;;
  89. esac
  90. # validate all bundles
  91. for lv2bundle in ${lv2bundles[@]}; do
  92. echo -n "Validating ${lv2bundle}... "
  93. if [ ! -f "${LV2DIR}/${lv2bundle}/manifest.ttl" ]; then
  94. echo "manifest.ttl file missing"
  95. exitcode=1
  96. continue
  97. fi
  98. echo
  99. # lv2 metadata validation
  100. lv2plugins=($(validate_lv2_bundle "${lv2bundle}"))
  101. # lv2 plugin count
  102. echo "Found ${#lv2plugins[@]} plugin(s)"
  103. # real host test
  104. for lv2plugin in ${lv2plugins[@]}; do
  105. echo -n "Verifying ${lv2plugin}... "
  106. validate_lv2_plugin ${lv2plugin}
  107. echo "ok"
  108. done
  109. done
  110. done
  111. exit ${exitcode}
  112. # ---------------------------------------------------------------------------------------------------------------------