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.

216 lines
8.5KB

  1. #!/bin/bash
  2. set -e
  3. cd $(dirname ${0})
  4. PAWPAW_ROOT="${PWD}"
  5. JACK2_VERSION=git
  6. QJACKCTL_VERSION=0.6.2
  7. # ---------------------------------------------------------------------------------------------------------------------
  8. target="${1}"
  9. if [ -z "${target}" ]; then
  10. echo "usage: ${0} <target>"
  11. exit 1
  12. fi
  13. # ---------------------------------------------------------------------------------------------------------------------
  14. # TODO check that bootstrap.sh has been run
  15. source setup/check_target.sh
  16. source setup/env.sh
  17. source setup/functions.sh
  18. source setup/versions.sh
  19. # ---------------------------------------------------------------------------------------------------------------------
  20. # aften (macos only)
  21. if [ "${MACOS}" -eq 1 ]; then
  22. download aften "${AFTEN_VERSION}" "http://downloads.sourceforge.net/aften" "tar.bz2"
  23. build_cmake aften "${AFTEN_VERSION}"
  24. if [ ! -f "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs" ]; then
  25. cp -v "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/build/libaften_pcm.a" "${PAWPAW_PREFIX}/lib/libaften_pcm.a"
  26. cp -v "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/build/libaften_static.a" "${PAWPAW_PREFIX}/lib/libaften.a"
  27. touch "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs"
  28. fi
  29. fi
  30. # ---------------------------------------------------------------------------------------------------------------------
  31. # db
  32. download db "${DB_VERSION}" "https://download.oracle.com/berkeley-db"
  33. # based on build_autoconf
  34. function build_custom_db() {
  35. local name="${1}"
  36. local version="${2}"
  37. local extraconfrules="${3}"
  38. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  39. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  40. extraconfrules="--host=${TOOLCHAIN_PREFIX} ${extraconfrules}"
  41. fi
  42. if [ "${WIN32}" -eq 1 ]; then
  43. extraconfrules="--enable-mingw ${extraconfrules}"
  44. fi
  45. _prebuild "${name}" "${pkgdir}"
  46. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  47. pushd "${pkgdir}/build_unix"
  48. ../dist/configure --enable-static --disable-shared --disable-debug --disable-doc --disable-maintainer-mode --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
  49. touch ../.stamp_configured
  50. popd
  51. fi
  52. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  53. pushd "${pkgdir}/build_unix"
  54. make ${MAKE_ARGS}
  55. touch ../.stamp_built
  56. popd
  57. fi
  58. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  59. pushd "${pkgdir}/build_unix"
  60. make ${MAKE_ARGS} install
  61. touch ../.stamp_installed
  62. popd
  63. fi
  64. _postbuild
  65. }
  66. patch_file db "${DB_VERSION}" "src/dbinc/atomic.h" 's/__atomic_compare_exchange/__db_atomic_compare_exchange/'
  67. build_custom_db db "${DB_VERSION}" "--disable-java --disable-replication --disable-sql --disable-tcl"
  68. # --enable-posixmutexes --enable-compat185 --enable-cxx --enable-dbm --enable-stl
  69. # ---------------------------------------------------------------------------------------------------------------------
  70. # opus
  71. download opus "${OPUS_VERSION}" "https://archive.mozilla.org/pub/opus"
  72. build_autoconf opus "${OPUS_VERSION}" "--disable-extra-programs --enable-custom-modes --enable-float-approx"
  73. # ---------------------------------------------------------------------------------------------------------------------
  74. # rtaudio (download, win32 only)
  75. if [ "${WIN32}" -eq 1 ]; then
  76. download rtaudio "${RTAUDIO_VERSION}" "https://github.com/falkTX/rtaudio.git" "" "git"
  77. # fixes for portaudio
  78. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/common"
  79. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/host"
  80. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/pc"
  81. fi
  82. # ---------------------------------------------------------------------------------------------------------------------
  83. # portaudio (win32 only)
  84. if [ "${WIN32}" -eq 1 ]; then
  85. ASIO_DIR="${PAWPAW_BUILDDIR}/rtaudio-${RTAUDIO_VERSION}/include"
  86. export EXTRA_CFLAGS="-I${ASIO_DIR}"
  87. export EXTRA_CXXFLAGS="-I${ASIO_DIR}"
  88. export EXTRA_MAKE_ARGS="-j 1"
  89. download portaudio19 "${PORTAUDIO_VERSION}" "http://deb.debian.org/debian/pool/main/p/portaudio19" "orig.tar.gz"
  90. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/audioclient.h"
  91. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/devicetopology.h"
  92. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/endpointvolume.h"
  93. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/functiondiscoverykeys.h"
  94. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksguid.h"
  95. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksproxy.h"
  96. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksuuids.h"
  97. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/mmdeviceapi.h"
  98. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/propkeydef.h"
  99. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/propsys.h"
  100. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/rpcsal.h"
  101. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/sal.h"
  102. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/structuredquery.h"
  103. build_autoconf portaudio19 "${PORTAUDIO_VERSION}" "--enable-cxx --with-asiodir="${ASIO_DIR}" --with-winapi=asio,directx,wasapi,wdmks,wmme"
  104. fi
  105. # ---------------------------------------------------------------------------------------------------------------------
  106. # tre (win32 only)
  107. if [ "${WIN32}" -eq 1 ]; then
  108. download tre "${TRE_VERSION}" "https://laurikari.net/tre"
  109. build_autoconf tre "${TRE_VERSION}" "--disable-nls"
  110. fi
  111. # ---------------------------------------------------------------------------------------------------------------------
  112. # stop here if CI test build
  113. if [ -n "${TRAVIS_BUILD_DIR}" ]; then
  114. exit 0
  115. fi
  116. # ---------------------------------------------------------------------------------------------------------------------
  117. # and finally jack2
  118. jack2_repo="git@github.com:jackaudio/jack2.git"
  119. jack2_prefix="${PAWPAW_PREFIX}/jack2"
  120. jack2_args="--prefix=${jack2_prefix}"
  121. # if [ "${MACOS_OLD}" -eq 1 ] || [ "${WIN64}" -eq 1 ]; then
  122. # jack2_args="${jack2_args} --mixed"
  123. # fi
  124. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  125. if [ "${LINUX}" -eq 1 ]; then
  126. jack2_args="${jack2_args} --platform=linux"
  127. elif [ "${MACOS}" -eq 1 ]; then
  128. jack2_args="${jack2_args} --platform=darwin"
  129. elif [ "${WIN32}" -eq 1 ]; then
  130. jack2_args="${jack2_args} --platform=win32"
  131. fi
  132. fi
  133. if [ "${MACOS_OLD}" -eq 1 ]; then
  134. patch_file jack2 "git" "wscript" '/-std=gnu++11/d'
  135. patch_file jack2 "git" "wscript" '/-Wno-deprecated-register/d'
  136. fi
  137. if [ "${JACK2_VERSION}" = "git" ]; then
  138. if [ ! -d jack2 ]; then
  139. git clone --recursive "${jack2_repo}"
  140. fi
  141. if [ ! -e "${PAWPAW_BUILDDIR}/jack2-git" ]; then
  142. ln -sf "$(pwd)/jack2" "${PAWPAW_BUILDDIR}/jack2-git"
  143. fi
  144. rm -f "${PAWPAW_BUILDDIR}/jack2-git/.stamp_built"
  145. else
  146. download jack2 "${JACK2_VERSION}" "${jack2_repo}" "" "git"
  147. fi
  148. build_waf jack2 "${JACK2_VERSION}" "${jack2_args}"
  149. # patch pkg-config file for static builds in regular prefix
  150. if [ ! -e "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc" ]; then
  151. if [ "${WIN64}" -eq 1 ]; then
  152. s="64"
  153. else
  154. s=""
  155. fi
  156. cp -v "${PAWPAW_PREFIX}/jack2/lib/pkgconfig/jack.pc" "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc"
  157. sed -i -e "s/lib -ljack${s}/lib -Wl,-Bdynamic -ljack${s} -Wl,-Bstatic/" "${PAWPAW_PREFIX}/lib/pkgconfig/jack.pc"
  158. fi
  159. # ---------------------------------------------------------------------------------------------------------------------
  160. # if qt is available, build qjackctl
  161. if [ -f "${PAWPAW_PREFIX}/bin/moc" ]; then
  162. download qjackctl "${QJACKCTL_VERSION}" https://download.sourceforge.net/qjackctl
  163. if [ "${WIN64}" -eq 1 ]; then
  164. patch_file qjackctl "${QJACKCTL_VERSION}" "configure" 's/-ljack /-Wl,-Bdynamic -ljack64 -Wl,-Bstatic /'
  165. elif [ "${WIN32}" -eq 1 ]; then
  166. patch_file qjackctl "${QJACKCTL_VERSION}" "configure" 's/-ljack /-Wl,-Bdynamic -ljack -Wl,-Bstatic /'
  167. fi
  168. build_autoconf qjackctl "${QJACKCTL_VERSION}" "--enable-jack-version"
  169. if [ "${WIN32}" -eq 1 ]; then
  170. copy_file qjackctl "${QJACKCTL_VERSION}" "src/release/qjackctl.exe" "${PAWPAW_PREFIX}/jack2/bin/qjackctl.exe"
  171. fi
  172. fi
  173. # ---------------------------------------------------------------------------------------------------------------------