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.

114 lines
3.8KB

  1. #!/bin/bash
  2. set -e
  3. cd $(dirname ${0})
  4. PAWPAW_ROOT="${PWD}"
  5. JACK2_VERSION=${JACK2_VERSION:=git}
  6. QJACKCTL_VERSION=${QJACKCTL_VERSION:=0.6.2}
  7. # ---------------------------------------------------------------------------------------------------------------------
  8. target="${1}"
  9. if [ -z "${target}" ]; then
  10. echo "usage: ${0} <target> [package-build?]"
  11. exit 1
  12. fi
  13. # TODO check that bootstrap-jack.sh has been run
  14. # ---------------------------------------------------------------------------------------------------------------------
  15. source setup/check_target.sh
  16. source setup/env.sh
  17. source setup/functions.sh
  18. source setup/versions.sh
  19. # ---------------------------------------------------------------------------------------------------------------------
  20. # jack2
  21. jack2_repo="https://github.com/jackaudio/jack2.git"
  22. jack2_prefix="${PAWPAW_PREFIX}-jack2"
  23. jack2_args="--prefix=${jack2_prefix}"
  24. # if [ "${MACOS_OLD}" -eq 1 ] || [ "${WIN64}" -eq 1 ]; then
  25. # jack2_args="${jack2_args} --mixed"
  26. # fi
  27. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  28. if [ "${LINUX}" -eq 1 ]; then
  29. jack2_args+=" --platform=linux"
  30. elif [ "${MACOS}" -eq 1 ]; then
  31. jack2_args+=" --platform=darwin"
  32. elif [ "${WIN32}" -eq 1 ]; then
  33. jack2_args+=" --platform=win32"
  34. fi
  35. fi
  36. if [ "${MACOS}" -eq 1 ]; then
  37. jack2_extra_prefix="/usr/local"
  38. jack2_args+=" --prefix=${jack2_extra_prefix}"
  39. jack2_args+=" --destdir="${jack2_prefix}""
  40. fi
  41. if [ "${MACOS_OLD}" -eq 1 ]; then
  42. patch_file jack2 "git" "wscript" '/-std=gnu++11/d'
  43. patch_file jack2 "git" "wscript" '/-Wno-deprecated-register/d'
  44. fi
  45. if [ "${JACK2_VERSION}" = "git" ]; then
  46. if [ ! -d jack2 ]; then
  47. git clone --recursive "${jack2_repo}"
  48. fi
  49. if [ ! -e "${PAWPAW_BUILDDIR}/jack2-git" ]; then
  50. ln -sf "$(pwd)/jack2" "${PAWPAW_BUILDDIR}/jack2-git"
  51. fi
  52. rm -f "${PAWPAW_BUILDDIR}/jack2-git/.stamp_built"
  53. else
  54. download jack2 "${JACK2_VERSION}" "${jack2_repo}" "" "git"
  55. fi
  56. build_waf jack2 "${JACK2_VERSION}" "${jack2_args}"
  57. # remove useless dbus-specific file
  58. rm -f "${jack2_prefix}${jack2_extra_prefix}/bin/jack_control"
  59. # copy jack pkg-config file to main system, so qjackctl can find it
  60. if [ ! -e "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc" ]; then
  61. cp -v "${jack2_prefix}${jack2_extra_prefix}/lib/pkgconfig/jack.pc" "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc"
  62. # patch pkg-config file for static win32 builds in regular prefix
  63. if [ "${WIN32}" -eq 1 ]; then
  64. if [ "${WIN64}" -eq 1 ]; then
  65. s="64"
  66. else
  67. s=""
  68. fi
  69. # FIXME rule that works for server lib too, maybe ignoring suffix even
  70. sed -i -e "s/lib -ljack${s}/lib -Wl,-Bdynamic -ljack${s} -Wl,-Bstatic/" "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc"
  71. fi
  72. fi
  73. # ---------------------------------------------------------------------------------------------------------------------
  74. # qjackctl (if qt is available)
  75. if [ -f "${PAWPAW_PREFIX}/bin/moc" ]; then
  76. download qjackctl ${QJACKCTL_VERSION} https://download.sourceforge.net/qjackctl
  77. if [ "${WIN64}" -eq 1 ]; then
  78. patch_file qjackctl "${QJACKCTL_VERSION}" "configure" 's/-ljack /-Wl,-Bdynamic -ljack64 -Wl,-Bstatic /'
  79. elif [ "${WIN32}" -eq 1 ]; then
  80. patch_file qjackctl "${QJACKCTL_VERSION}" "configure" 's/-ljack /-Wl,-Bdynamic -ljack -Wl,-Bstatic /'
  81. elif [ "${MACOS}" -eq 1 ]; then
  82. qjackctl_extra_args="--with-jack="${jack2_prefix}${jack2_extra_prefix}""
  83. fi
  84. build_autoconf qjackctl "${QJACKCTL_VERSION}" "--enable-jack-version ${qjackctl_extra_args}"
  85. if [ "${WIN32}" -eq 1 ]; then
  86. copy_file qjackctl "${QJACKCTL_VERSION}" "src/release/qjackctl.exe" "${jack2_prefix}/bin/qjackctl.exe"
  87. fi
  88. fi
  89. # ---------------------------------------------------------------------------------------------------------------------