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.

253 lines
10KB

  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. # fftw
  23. FFTW_EXTRAFLAGS="--disable-alloca --disable-fortran --with-our-malloc"
  24. if [ "${MACOS_UNIVERSAL}" -eq 0 ]; then
  25. FFTW_EXTRAFLAGS+=" --enable-sse2"
  26. fi
  27. # if [ "${WIN32}" -eq 0 ]; then
  28. # FFTW_EXTRAFLAGS+=" --enable-threads"
  29. # fi
  30. download fftw "${FFTW_VERSION}" "${FFTW_URL}"
  31. if [ "${MACOS_OLD}" -eq 1 ]; then
  32. patch_file fftw "${FFTW_VERSION}" "configure" 's/CFLAGS="$CFLAGS -Wl,-no_compact_unwind"/CFLAGS="$CFLAGS"/'
  33. patch_file fftw "${FFTW_VERSION}" "libbench2/timer.c" 's/#if defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_TIMER)/#ifndef HAVE_TIMER/'
  34. fi
  35. build_autoconf fftw "${FFTW_VERSION}" "${FFTW_EXTRAFLAGS}"
  36. # ---------------------------------------------------------------------------------------------------------------------
  37. # fftwf
  38. FFTWF_EXTRAFLAGS="${FFTW_EXTRAFLAGS} --enable-single"
  39. copy_download fftw fftwf "${FFTW_VERSION}"
  40. if [ "${MACOS_OLD}" -eq 1 ]; then
  41. patch_file fftwf "${FFTW_VERSION}" "configure" 's/CFLAGS="$CFLAGS -Wl,-no_compact_unwind"/CFLAGS="$CFLAGS"/'
  42. patch_file fftwf "${FFTW_VERSION}" "libbench2/timer.c" 's/#if defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_TIMER)/#ifndef HAVE_TIMER/'
  43. fi
  44. build_autoconf fftwf "${FFTW_VERSION}" "${FFTWF_EXTRAFLAGS}"
  45. # ---------------------------------------------------------------------------------------------------------------------
  46. # glib
  47. if [ "${MACOS}" -eq 1 ] || [ "${WIN32}" -eq 1 ]; then
  48. if [ "${WIN32}" -eq 1 ]; then
  49. GLIB_EXTRAFLAGS="--with-threads=win32"
  50. else
  51. GLIB_EXTRAFLAGS="--with-threads=posix"
  52. fi
  53. download glib ${GLIB_VERSION} "${GLIB_URL}" "${GLIB_TAR_EXT}"
  54. if [ "${MACOS}" -eq 1 ]; then
  55. export EXTRA_LDFLAGS="-lresolv"
  56. patch_file glib ${GLIB_VERSION} "glib/gconvert.c" '/#error/g'
  57. if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
  58. patch_file glib ${GLIB_VERSION} "glib/gatomic.c" 's/G_ATOMIC_ARM/__aarch64__/'
  59. patch_file glib ${GLIB_VERSION} "glib/gatomic.c" 's/G_ATOMIC_X86_64/__SSE2__/'
  60. elif [ "${MACOS_OLD}" -eq 1 ]; then
  61. GLIB_EXTRAFLAGS+=" glib_cv_stack_grows=yes"
  62. GLIB_EXTRAFLAGS+=" glib_cv_rtldglobal_broken=no"
  63. GLIB_EXTRAFLAGS+=" glib_cv_uscore=no"
  64. GLIB_EXTRAFLAGS+=" ac_cv_func_posix_getpwuid_r=yes"
  65. GLIB_EXTRAFLAGS+=" ac_cv_func_posix_getgrgid_r=yes"
  66. patch_file glib ${GLIB_VERSION} "configure.in" 's/G_ATOMIC_I486/G_ATOMIC_NOT_I486/'
  67. fi
  68. # elif [ "${WIN32}" -eq 1 ] && [ -n "${EXE_WRAPPER}" ]; then
  69. # patch_file glib ${GLIB_VERSION} "gobject/Makefile.in" "s|glib_genmarshal = ./glib-genmarshal|glib_genmarshal = ${EXE_WRAPPER} ./glib-genmarshal.exe|"
  70. fi
  71. build_autoconfgen glib ${GLIB_VERSION} "--disable-rebuilds ${GLIB_EXTRAFLAGS}"
  72. fi
  73. # ---------------------------------------------------------------------------------------------------------------------
  74. # liblo
  75. download liblo "${LIBLO_VERSION}" "${LIBLO_URL}"
  76. build_autoconf liblo "${LIBLO_VERSION}" "--enable-threads --disable-examples --disable-tests --disable-tools"
  77. # ---------------------------------------------------------------------------------------------------------------------
  78. # pcre (needed for sord_validate, only relevant if we can run the resulting binaries)
  79. if [ "${CROSS_COMPILING}" -eq 0 ] || [ -n "${EXE_WRAPPER}" ]; then
  80. download pcre "${PCRE_VERSION}" "${PCRE_URL}"
  81. build_autoconf pcre "${PCRE_VERSION}"
  82. fi
  83. # ---------------------------------------------------------------------------------------------------------------------
  84. # lv2
  85. git_clone lv2 "${LV2_VERSION}" "${LV2_URL}"
  86. build_waf lv2 "${LV2_VERSION}" "--lv2dir=${PAWPAW_PREFIX}/lib/lv2 --no-coverage --no-plugins"
  87. # ---------------------------------------------------------------------------------------------------------------------
  88. # serd
  89. download serd "${SERD_VERSION}" "${SERD_URL}" "tar.bz2"
  90. build_waf serd "${SERD_VERSION}" "--static --no-shared --no-utils"
  91. # ---------------------------------------------------------------------------------------------------------------------
  92. # sord
  93. if [ "${CROSS_COMPILING}" -eq 1 ] && [ -z "${EXE_WRAPPER}" ]; then
  94. SORD_EXTRAFLAGS="--no-utils"
  95. fi
  96. download sord "${SORD_VERSION}" "${SORD_URL}" "tar.bz2"
  97. build_waf sord "${SORD_VERSION}" "--static --no-shared ${SORD_EXTRAFLAGS}"
  98. # ---------------------------------------------------------------------------------------------------------------------
  99. # sratom
  100. download sratom "${SRATOM_VERSION}" "${SRATOM_URL}" "tar.bz2"
  101. build_waf sratom "${SRATOM_VERSION}" "--static --no-shared"
  102. # ---------------------------------------------------------------------------------------------------------------------
  103. # lilv
  104. download lilv "${LILV_VERSION}" "${LILV_URL}" "tar.bz2"
  105. build_waf lilv "${LILV_VERSION}" "--static --no-bash-completion --no-bindings --no-shared"
  106. # --static-progs
  107. # ---------------------------------------------------------------------------------------------------------------------
  108. # lv2lint
  109. if [ "${LV2LINT_SUPPORTED}" -eq 1 ]; then
  110. download lv2lint "${LV2LINT_VERSION}" "${LV2LINT_URL}"
  111. build_meson lv2lint "${LV2LINT_VERSION}"
  112. # "-Donline-tests=true -Delf-tests=true"
  113. fi
  114. # ---------------------------------------------------------------------------------------------------------------------
  115. # kxstudio lv2 extensions
  116. git_clone kxstudio-lv2-extensions "${KXSTUDIO_LV2_EXTENSIONS_VERSION}" "${KXSTUDIO_LV2_EXTENSIONS_URL}"
  117. build_make kxstudio-lv2-extensions "${KXSTUDIO_LV2_EXTENSIONS_VERSION}"
  118. # ---------------------------------------------------------------------------------------------------------------------
  119. # MOD lv2 extensions
  120. git_clone mod-sdk "${MOD_SDK_VERSION}" "${MOD_SDK_URL}"
  121. build_make mod-sdk "${MOD_SDK_VERSION}"
  122. # ---------------------------------------------------------------------------------------------------------------------
  123. # fluidsynth
  124. FLUIDSYNTH_EXTRAFLAGS="-Denable-floats=ON"
  125. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-alsa=OFF"
  126. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-aufile=OFF"
  127. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-coreaudio=OFF"
  128. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-coremidi=OFF"
  129. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-dbus=OFF"
  130. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-debug=OFF"
  131. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-fpe-check=OFF"
  132. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-framework=OFF"
  133. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-ipv6=OFF"
  134. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-jack=OFF"
  135. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-ladcca=OFF"
  136. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-ladspa=OFF"
  137. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-lash=OFF"
  138. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-midishare=OFF"
  139. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-oss=OFF"
  140. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-portaudio=OFF"
  141. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-profiling=OFF"
  142. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-pulseaudio=OFF"
  143. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-readline=OFF"
  144. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-trap-on-fpe=OFF"
  145. git_clone fluidsynth "${FLUIDSYNTH_VERSION}" "${FLUIDSYNTH_URL}"
  146. patch_file fluidsynth "${FLUIDSYNTH_VERSION}" "CMakeLists.txt" 's/_init_lib_suffix "64"/_init_lib_suffix ""/'
  147. build_cmake fluidsynth "${FLUIDSYNTH_VERSION}" "${FLUIDSYNTH_EXTRAFLAGS}"
  148. if [ ! -e "${PAWPAW_PREFIX}/lib/pkgconfig/fluidsynth.pc-e" ]; then
  149. if [ "${MACOS}" -eq 1 ]; then
  150. sed -i -e 's/-lfluidsynth/-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -lopus -logg -lpthread -liconv -lm/' "${PAWPAW_PREFIX}/lib/pkgconfig/fluidsynth.pc"
  151. elif [ "${WIN32}" -eq 1 ]; then
  152. sed -i -e 's/-L${libdir} -lfluidsynth/-L${libdir} -lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -lopus -logg -lpthread -lm -lole32 -lws2_32/' "${PAWPAW_PREFIX}/lib/pkgconfig/fluidsynth.pc"
  153. touch "${PAWPAW_PREFIX}/lib/pkgconfig/fluidsynth.pc-e"
  154. fi
  155. fi
  156. # ---------------------------------------------------------------------------------------------------------------------
  157. # mxml
  158. git_clone mxml "${MXML_VERSION}" "${MXML_URL}"
  159. build_autoconf mxml "${MXML_VERSION}"
  160. # ---------------------------------------------------------------------------------------------------------------------
  161. # carla (backend only)
  162. CARLA_EXTRAFLAGS="CAN_GENERATE_LV2_TTL=false"
  163. CARLA_EXTRAFLAGS+=" EXTERNAL_PLUGINS=false"
  164. CARLA_EXTRAFLAGS+=" HAVE_ALSA=false"
  165. CARLA_EXTRAFLAGS+=" HAVE_JACK=false"
  166. CARLA_EXTRAFLAGS+=" HAVE_PULSEAUDIO=false"
  167. CARLA_EXTRAFLAGS+=" HAVE_DGL=false"
  168. CARLA_EXTRAFLAGS+=" HAVE_HYLIA=false"
  169. CARLA_EXTRAFLAGS+=" HAVE_GTK2=false"
  170. CARLA_EXTRAFLAGS+=" HAVE_GTK3=false"
  171. CARLA_EXTRAFLAGS+=" HAVE_X11=false"
  172. CARLA_EXTRAFLAGS+=" HAVE_FFMPEG=false"
  173. CARLA_EXTRAFLAGS+=" HAVE_FLUIDSYNTH=false"
  174. CARLA_EXTRAFLAGS+=" HAVE_LIBLO=false"
  175. CARLA_EXTRAFLAGS+=" HAVE_LIBMAGIC=false"
  176. CARLA_EXTRAFLAGS+=" HAVE_PYQT=false"
  177. CARLA_EXTRAFLAGS+=" HAVE_QT=false"
  178. CARLA_EXTRAFLAGS+=" HAVE_QT4=false"
  179. CARLA_EXTRAFLAGS+=" HAVE_QT5=false"
  180. CARLA_EXTRAFLAGS+=" HAVE_SNDFILE=false"
  181. CARLA_EXTRAFLAGS+=" NOOPT=true"
  182. CARLA_EXTRAFLAGS+=" USING_JUCE=false"
  183. CARLA_EXTRAFLAGS+=" USING_JUCE_AUDIO_DEVICES=false"
  184. CARLA_EXTRAFLAGS+=" USING_JUCE_GUI_EXTRA=false"
  185. git_clone carla "${CARLA_VERSION}" "${CARLA_URL}"
  186. build_make carla "${CARLA_VERSION}" "${CARLA_EXTRAFLAGS}"
  187. # ---------------------------------------------------------------------------------------------------------------------
  188. # wine bootstrap (needed for cross-compilation)
  189. if [ "${WIN32}" -eq 1 ] && [ -n "${EXE_WRAPPER}" ] && [ ! -d "${WINEPREFIX}" ]; then
  190. wineboot -u
  191. fi
  192. # ---------------------------------------------------------------------------------------------------------------------