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.

203 lines
7.8KB

  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. # TODO check for depedencies:
  23. # - autopoint
  24. # ---------------------------------------------------------------------------------------------------------------------
  25. # aften (macos only)
  26. if [ "${MACOS}" -eq 1 ]; then
  27. download aften "${AFTEN_VERSION}" "${AFTEN_URL}" "tar.bz2"
  28. if [ ! -f "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed" ]; then
  29. rm -f "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs"
  30. fi
  31. build_cmake aften "${AFTEN_VERSION}" "-DHAVE_MMX=ON -DHAVE_SSE=ON -DHAVE_SSE2=ON"
  32. if [ ! -f "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs" ]; then
  33. cp -v "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/build/libaften_pcm.a" "${PAWPAW_PREFIX}/lib/libaften_pcm.a"
  34. cp -v "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/build/libaften_static.a" "${PAWPAW_PREFIX}/lib/libaften.a"
  35. touch "${PAWPAW_BUILDDIR}/aften-${AFTEN_VERSION}/.stamp_installed_libs"
  36. fi
  37. fi
  38. # ---------------------------------------------------------------------------------------------------------------------
  39. # db
  40. download db "${DB_VERSION}" "${DB_URL}"
  41. # based on build_autoconf
  42. function build_custom_db() {
  43. local name="${1}"
  44. local version="${2}"
  45. local extraconfrules="${3}"
  46. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  47. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  48. extraconfrules+=" --build=$(uname -m)-linux-gnu ac_cv_build=$(uname -m)-linux-gnu"
  49. extraconfrules+=" --host=${TOOLCHAIN_PREFIX} ac_cv_host=${TOOLCHAIN_PREFIX}"
  50. fi
  51. if [ "${MACOS}" -eq 1 ]; then
  52. extraconfrules+=" --with-mutex=x86_64/gcc-assembly db_cv_atomic=x86/gcc-assembly"
  53. fi
  54. if [ "${WIN32}" -eq 1 ]; then
  55. extraconfrules+=" --enable-mingw"
  56. fi
  57. _prebuild "${name}" "${pkgdir}"
  58. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  59. pushd "${pkgdir}/build_unix"
  60. ../dist/configure --enable-static --disable-shared --disable-debug --disable-doc --disable-maintainer-mode --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
  61. touch ../.stamp_configured
  62. popd
  63. fi
  64. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  65. pushd "${pkgdir}/build_unix"
  66. make ${MAKE_ARGS}
  67. touch ../.stamp_built
  68. popd
  69. fi
  70. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  71. pushd "${pkgdir}/build_unix"
  72. make ${MAKE_ARGS} install
  73. touch ../.stamp_installed
  74. popd
  75. fi
  76. _postbuild
  77. }
  78. build_custom_db db "${DB_VERSION}" "--disable-java --disable-replication --disable-sql --disable-tcl"
  79. # ---------------------------------------------------------------------------------------------------------------------
  80. # rtaudio (download, win32 only)
  81. if [ "${WIN32}" -eq 1 ]; then
  82. git_clone rtaudio "${RTAUDIO_VERSION}" "${RTAUDIO_URL}"
  83. # fixes for portaudio
  84. ASIO_DIR="${PAWPAW_BUILDDIR}/rtaudio-${RTAUDIO_VERSION}/include"
  85. if [ -d "${ASIO_DIR}" ]; then
  86. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/common"
  87. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/host"
  88. link_file rtaudio "${RTAUDIO_VERSION}" "." "include/pc"
  89. fi
  90. fi
  91. # ---------------------------------------------------------------------------------------------------------------------
  92. # portaudio
  93. if [ "${LINUX}" -eq 1 ] || [ "${WIN32}" -eq 1 ]; then
  94. PORTAUDIO_EXTRAFLAGS=""
  95. PORTAUDIO_EXTRAFLAGS+=" --enable-cxx"
  96. PORTAUDIO_EXTRAFLAGS+=" --without-asihpi"
  97. PORTAUDIO_EXTRAFLAGS+=" --without-oss"
  98. if [ -n "${PAWPAW_MODAUDIO}" ] && [ "${PAWPAW_MODAUDIO}" -eq 1 ]; then
  99. PORTAUDIO_EXTRAFLAGS+=" --without-alsa"
  100. PORTAUDIO_EXTRAFLAGS+=" --with-jack"
  101. elif [ "${LINUX}" -eq 1 ]; then
  102. PORTAUDIO_EXTRAFLAGS+=" --with-alsa"
  103. PORTAUDIO_EXTRAFLAGS+=" --with-jack"
  104. else
  105. PORTAUDIO_EXTRAFLAGS+=" --without-alsa"
  106. PORTAUDIO_EXTRAFLAGS+=" --without-jack"
  107. fi
  108. if [ "${LINUX}" -eq 1 ]; then
  109. export EXTRA_LDFLAGS="-ldl"
  110. elif [ "${WIN32}" -eq 1 ]; then
  111. export EXTRA_CFLAGS="-I${ASIO_DIR}"
  112. export EXTRA_CXXFLAGS="-I${ASIO_DIR}"
  113. PORTAUDIO_EXTRAFLAGS+=" --with-asiodir=${ASIO_DIR}"
  114. PORTAUDIO_EXTRAFLAGS+=" --with-winapi=asio,directx,wasapi,wdmks,wmme"
  115. fi
  116. export EXTRA_MAKE_ARGS="-j 1"
  117. download portaudio19 "${PORTAUDIO_VERSION}" "${PORTAUDIO_URL}" "orig.tar.gz"
  118. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/audioclient.h"
  119. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/devicetopology.h"
  120. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/endpointvolume.h"
  121. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/functiondiscoverykeys.h"
  122. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksguid.h"
  123. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksproxy.h"
  124. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/ksuuids.h"
  125. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/mmdeviceapi.h"
  126. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/propkeydef.h"
  127. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/propsys.h"
  128. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/rpcsal.h"
  129. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/sal.h"
  130. remove_file portaudio19 "${PORTAUDIO_VERSION}" "src/hostapi/wasapi/mingw-include/structuredquery.h"
  131. build_autoconfgen portaudio19 "${PORTAUDIO_VERSION}" "${PORTAUDIO_EXTRAFLAGS}"
  132. if [ "${WIN32}" -eq 1 ]; then
  133. install_file portaudio19 "${PORTAUDIO_VERSION}" "include/pa_asio.h" "include"
  134. fi
  135. fi
  136. # ---------------------------------------------------------------------------------------------------------------------
  137. # tre (win32 only)
  138. if [ "${WIN32}" -eq 1 ]; then
  139. git_clone tre "${TRE_VERSION}" "${TRE_URL}"
  140. build_autoconfgen tre "${TRE_VERSION}" "--disable-nls"
  141. fi
  142. # ---------------------------------------------------------------------------------------------------------------------
  143. # tre (win64 32bit build)
  144. # NOTE: this must be the last item to build
  145. if [ "${WIN64}" -eq 1 ]; then
  146. target="win32"
  147. source setup/check_target.sh
  148. source setup/env.sh
  149. PAWPAW_BUILDDIR="${PAWPAW_DIR}/builds/win64"
  150. PAWPAW_PREFIX="${PAWPAW_DIR}/targets/win64"
  151. if [ -z "${PAWPAW_SKIP_LTO}" ] || [ "${PAWPAW_SKIP_LTO}" -eq 0 ]; then
  152. PAWPAW_BUILDDIR+="-lto"
  153. PAWPAW_PREFIX+="-lto"
  154. fi
  155. source setup/functions.sh
  156. copy_download tre tre-x32 "${TRE_VERSION}"
  157. build_autoconfgen tre-x32 "${TRE_VERSION}" "--disable-nls --libdir=${PAWPAW_PREFIX}/lib32"
  158. if [ ! -e "${PAWPAW_PREFIX}/lib/libtre32.a" ]; then
  159. ln -s "${PAWPAW_PREFIX}/lib32/libtre.a" "${PAWPAW_PREFIX}/lib/libtre32.a"
  160. fi
  161. fi
  162. # ---------------------------------------------------------------------------------------------------------------------