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.

161 lines
4.5KB

  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}" PATH="${PAWPAW_PREFIX}/bin:${PATH}" \
  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. # check if plugin needs validation
  91. pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  92. if [ -f "${pkgdir}/.stamp_verified" ]; then
  93. continue
  94. fi
  95. # validate all bundles
  96. validationfail=0
  97. for lv2bundle in ${lv2bundles[@]}; do
  98. echo -n "Validating ${lv2bundle}... "
  99. if [ ! -f "${LV2DIR}/${lv2bundle}/manifest.ttl" ]; then
  100. echo "manifest.ttl file missing"
  101. exitcode=1
  102. validationfail=1
  103. continue
  104. fi
  105. echo
  106. # lv2 metadata validation
  107. lv2plugins=($(validate_lv2_bundle "${lv2bundle}"))
  108. # lv2 plugin count
  109. echo "Found ${#lv2plugins[@]} plugin(s)"
  110. # real host test
  111. for lv2plugin in ${lv2plugins[@]}; do
  112. echo -n "Verifying ${lv2plugin}... "
  113. validate_lv2_plugin ${lv2plugin}
  114. echo "ok"
  115. done
  116. done
  117. if [ "${validationfail}" -eq 0 ]; then
  118. touch "${pkgdir}/.stamp_verified"
  119. fi
  120. done
  121. exit ${exitcode}
  122. # ---------------------------------------------------------------------------------------------------------------------