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.

173 lines
6.9KB

  1. #!/bin/bash
  2. set -e
  3. cd $(dirname ${0})
  4. PAWPAW_ROOT="${PWD}"
  5. # ---------------------------------------------------------------------------------------------------------------------
  6. # check target
  7. target="${1}"
  8. if [ -z "${target}" ]; then
  9. echo "usage: ${0} <target>"
  10. exit 1
  11. fi
  12. # ---------------------------------------------------------------------------------------------------------------------
  13. # run bootstrap dependencies
  14. ./bootstrap-common.sh "${target}"
  15. # ---------------------------------------------------------------------------------------------------------------------
  16. # source setup code
  17. source setup/check_target.sh
  18. source setup/env.sh
  19. source setup/functions.sh
  20. source setup/versions.sh
  21. # ---------------------------------------------------------------------------------------------------------------------
  22. # aften (macos only)
  23. if [ "${MACOS}" -eq 1 ]; then
  24. download aften "${AFTEN_VERSION}" "http://downloads.sourceforge.net/aften" "tar.bz2"
  25. if [ ! -f "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed" ]; then
  26. rm -f "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs"
  27. fi
  28. build_cmake aften "${AFTEN_VERSION}" "-DHAVE_MMX=ON -DHAVE_SSE=ON -DHAVE_SSE2=ON"
  29. if [ ! -f "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs" ]; then
  30. cp -v "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/build/libaften_pcm.a" "${PAWPAW_PREFIX}/lib/libaften_pcm.a"
  31. cp -v "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/build/libaften_static.a" "${PAWPAW_PREFIX}/lib/libaften.a"
  32. touch "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs"
  33. fi
  34. fi
  35. # ---------------------------------------------------------------------------------------------------------------------
  36. # db
  37. download db "${DB_VERSION}" "https://download.oracle.com/berkeley-db"
  38. # based on build_autoconf
  39. function build_custom_db() {
  40. local name="${1}"
  41. local version="${2}"
  42. local extraconfrules="${3}"
  43. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  44. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  45. extraconfrules+=" --host=${TOOLCHAIN_PREFIX}"
  46. fi
  47. if [ "${MACOS}" -eq 1 ]; then
  48. extraconfrules+=" --enable-posixmutexes"
  49. fi
  50. if [ "${WIN32}" -eq 1 ]; then
  51. extraconfrules+=" --enable-mingw"
  52. fi
  53. _prebuild "${name}" "${pkgdir}"
  54. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  55. pushd "${pkgdir}/build_unix"
  56. ../dist/configure --enable-static --disable-shared --disable-debug --disable-doc --disable-maintainer-mode --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
  57. touch ../.stamp_configured
  58. popd
  59. fi
  60. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  61. pushd "${pkgdir}/build_unix"
  62. make ${MAKE_ARGS}
  63. touch ../.stamp_built
  64. popd
  65. fi
  66. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  67. pushd "${pkgdir}/build_unix"
  68. make ${MAKE_ARGS} install
  69. touch ../.stamp_installed
  70. popd
  71. fi
  72. _postbuild
  73. }
  74. patch_file db "${DB_VERSION}" "src/dbinc/atomic.h" 's/__atomic_compare_exchange/__db_atomic_compare_exchange/'
  75. # FIXME: db fails for macOS universal builds
  76. if [ "${MACOS_UNIVERSAL}" -eq 0 ]; then
  77. build_custom_db db "${DB_VERSION}" "--disable-java --disable-replication --disable-sql --disable-tcl"
  78. fi
  79. # --enable-posixmutexes --enable-compat185 --enable-cxx --enable-dbm --enable-stl
  80. # ---------------------------------------------------------------------------------------------------------------------
  81. # rtaudio (download, win32 only)
  82. if [ "${WIN32}" -eq 1 ]; then
  83. download rtaudio "${RTAUDIO_VERSION}" "https://github.com/falkTX/rtaudio.git" "" "git"
  84. # fixes for portaudio
  85. ASIO_DIR="${PAWPAW_BUILDDIR}/rtaudio-${RTAUDIO_VERSION}/include"
  86. if [ -d "${ASIO_DIR}" ]; then
  87. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/common"
  88. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/host"
  89. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/pc"
  90. fi
  91. fi
  92. # ---------------------------------------------------------------------------------------------------------------------
  93. # portaudio (win32 only)
  94. if [ "${WIN32}" -eq 1 ]; then
  95. export EXTRA_CFLAGS="-I${ASIO_DIR}"
  96. export EXTRA_CXXFLAGS="-I${ASIO_DIR}"
  97. export EXTRA_MAKE_ARGS="-j 1"
  98. download portaudio19 "${PORTAUDIO_VERSION}" "http://deb.debian.org/debian/pool/main/p/portaudio19" "orig.tar.gz"
  99. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/audioclient.h"
  100. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/devicetopology.h"
  101. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/endpointvolume.h"
  102. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/functiondiscoverykeys.h"
  103. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksguid.h"
  104. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksproxy.h"
  105. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksuuids.h"
  106. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/mmdeviceapi.h"
  107. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/propkeydef.h"
  108. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/propsys.h"
  109. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/rpcsal.h"
  110. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/sal.h"
  111. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/structuredquery.h"
  112. build_autoconf portaudio19 "${PORTAUDIO_VERSION}" "--enable-cxx --with-asiodir=${ASIO_DIR} --with-winapi=asio,directx,wasapi,wdmks,wmme"
  113. install_file portaudio19 "${PORTAUDIO_VERSION}" "include/pa_asio.h" "include"
  114. fi
  115. # ---------------------------------------------------------------------------------------------------------------------
  116. # tre (win32 only)
  117. if [ "${WIN32}" -eq 1 ]; then
  118. download tre "${TRE_VERSION}" "https://laurikari.net/tre"
  119. build_autoconf tre "${TRE_VERSION}" "--disable-nls"
  120. fi
  121. # ---------------------------------------------------------------------------------------------------------------------
  122. # tre (win64 32bit build)
  123. # NOTE: this must be the last item to build
  124. if [ "${WIN64}" -eq 1 ]; then
  125. target="win32"
  126. source setup/check_target.sh
  127. source setup/env.sh
  128. PAWPAW_BUILDDIR="${PAWPAW_DIR}/builds/win64"
  129. PAWPAW_PREFIX="${PAWPAW_DIR}/targets/win64"
  130. source setup/functions.sh
  131. copy_download tre tre-x32 "${TRE_VERSION}"
  132. build_autoconf tre-x32 "${TRE_VERSION}" "--disable-nls --libdir=${PAWPAW_PREFIX}/lib32"
  133. if [ ! -e "${PAWPAW_PREFIX}/lib/libtre32.a" ]; then
  134. ln -s "${PAWPAW_PREFIX}/lib32/libtre.a" "${PAWPAW_PREFIX}/lib/libtre32.a"
  135. fi
  136. fi
  137. # ---------------------------------------------------------------------------------------------------------------------