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.

172 lines
4.8KB

  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. "${LV2DIR}/mod.lv2/*.ttl" \
  32. "${LV2DIR}/modgui.lv2/*.ttl" \
  33. "/tmp/pawpaw-plugin-check/${lv2bundle}/*.ttl" 1>&2
  34. local ret=$?
  35. if [ "${CROSS_COMPILING}" -eq 0 ] || [ -n "${EXE_WRAPPER}" ]; then
  36. env LANG=C LV2_PATH=/tmp/pawpaw-plugin-check WINEDEBUG=-all \
  37. ${EXE_WRAPPER} \
  38. "${PAWPAW_PREFIX}/bin/lv2ls${APP_EXT}" | tr -d '\r'
  39. fi
  40. rm -rf /tmp/pawpaw-plugin-check
  41. return ${ret}
  42. }
  43. function validate_lv2_plugin() {
  44. local lv2plugin="${1}"
  45. local carlaenv="CARLA_BRIDGE_DUMMY=1"
  46. if [ "${WIN64}" -eq 1 ]; then
  47. carlaenv+=" CARLA_BRIDGE_TESTING=win64"
  48. elif [ "${WIN32}" -eq 1 ]; then
  49. carlaenv+=" CARLA_BRIDGE_TESTING=win32"
  50. else
  51. carlaenv+=" CARLA_BRIDGE_TESTING=native"
  52. fi
  53. env LANG=C LV2_PATH="${LV2DIR}" WINEDEBUG=-all ${carlaenv} \
  54. "${PAWPAW_PREFIX}/bin/carla-single" lv2 "${lv2plugin}" 1>/dev/null
  55. }
  56. # ---------------------------------------------------------------------------------------------------------------------
  57. exitcode=0
  58. for plugin in ${@}; do
  59. pfile="${PAWPAW_ROOT}/plugins/${plugin}.json"
  60. if [ ! -e "${pfile}" ]; then
  61. echo "Requested plugin file '${pfile}' does not exist"
  62. exit 2
  63. fi
  64. name=$(jq -crM .name ${pfile})
  65. version=$(jq -crM .version ${pfile})
  66. buildtype=$(jq -crM .buildtype ${pfile})
  67. dlbaseurl=$(jq -crM .dlbaseurl ${pfile})
  68. lv2bundles=($(jq -crM .lv2bundles[] ${pfile}))
  69. # optional args
  70. buildargs=$(echo -e $(jq -ecrM .buildargs ${pfile} || echo '\n\n') | tail -n 1)
  71. dlext=$(echo -e $(jq -ecrM .dlext ${pfile} || echo '\n\n') | tail -n 1)
  72. dlmethod=$(echo -e $(jq -ecrM .dlmethod ${pfile} || echo '\n\n') | tail -n 1)
  73. download "${name}" "${version}" "${dlbaseurl}" "${dlext}" "${dlmethod}"
  74. case ${buildtype} in
  75. "autoconf")
  76. build_autoconf "${name}" "${version}" "${buildargs}"
  77. ;;
  78. "conf")
  79. build_conf "${name}" "${version}" "${buildargs}"
  80. ;;
  81. "cmake")
  82. build_cmake "${name}" "${version}" "${buildargs}"
  83. ;;
  84. "make")
  85. build_make "${name}" "${version}" "${buildargs}"
  86. ;;
  87. "meson")
  88. build_meson "${name}" "${version}" "${buildargs}"
  89. ;;
  90. "waf")
  91. build_waf "${name}" "${version}" "${buildargs}"
  92. ;;
  93. esac
  94. # check if plugin needs validation
  95. pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  96. if [ -f "${pkgdir}/.stamp_verified" ]; then
  97. continue
  98. fi
  99. # cannot run validation on certain setups
  100. if [ "${CROSS_COMPILING}" -eq 1 ] && [ -z "${EXE_WRAPPER}" ]; then
  101. continue
  102. fi
  103. # validate all bundles
  104. validationfail=0
  105. for lv2bundle in ${lv2bundles[@]}; do
  106. echo -n "Validating ${lv2bundle}... "
  107. if [ ! -f "${LV2DIR}/${lv2bundle}/manifest.ttl" ]; then
  108. echo "manifest.ttl file missing"
  109. exitcode=1
  110. validationfail=1
  111. continue
  112. fi
  113. echo
  114. # lv2 metadata validation
  115. lv2plugins=($(validate_lv2_bundle "${lv2bundle}"))
  116. # lv2 plugin count
  117. echo "Found ${#lv2plugins[@]} plugin(s)"
  118. # real host test
  119. for lv2plugin in ${lv2plugins[@]}; do
  120. echo -n "Verifying ${lv2plugin}... "
  121. validate_lv2_plugin ${lv2plugin}
  122. echo "ok"
  123. done
  124. done
  125. if [ "${validationfail}" -eq 0 ]; then
  126. touch "${pkgdir}/.stamp_verified"
  127. fi
  128. done
  129. exit ${exitcode}
  130. # ---------------------------------------------------------------------------------------------------------------------