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.

bootstrap-plugins.sh 11KB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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. # skip fluidsynth if glib is not wanted (fluidsynth requires glib)
  14. if [ -n "${PAWPAW_SKIP_GLIB}" ]; then
  15. PAWPAW_SKIP_FLUIDSYNTH=1
  16. fi
  17. # ---------------------------------------------------------------------------------------------------------------------
  18. # run bootstrap dependencies
  19. ./bootstrap-common.sh "${target}"
  20. # ---------------------------------------------------------------------------------------------------------------------
  21. # source setup code
  22. source setup/check_target.sh
  23. source setup/env.sh
  24. source setup/functions.sh
  25. source setup/versions.sh
  26. # ---------------------------------------------------------------------------------------------------------------------
  27. # fftw
  28. if [ -z "${PAWPAW_SKIP_FFTW}" ]; then
  29. # fftw is not compatible with LTO
  30. if [ -z "${PAWPAW_SKIP_LTO}" ] || [ "${PAWPAW_SKIP_LTO}" -eq 0 ]; then
  31. export EXTRA_CFLAGS="-fno-lto"
  32. export EXTRA_LDFLAGS="-fno-lto"
  33. fi
  34. FFTW_EXTRAFLAGS="--disable-alloca --disable-fortran --with-our-malloc"
  35. if [ "${TOOLCHAIN_PREFIX}" = "aarch64-linux-gnu" ]; then
  36. FFTW_EXTRAFLAGS+=" --with-slow-timer"
  37. FFTW_EXTRAFLAGS+=" --enable-neon"
  38. elif [ "${TOOLCHAIN_PREFIX}" = "arm-linux-gnueabihf" ]; then
  39. FFTW_EXTRAFLAGS+=" --with-slow-timer"
  40. # FIXME macos-universal proper optimizations
  41. elif [ "${MACOS_UNIVERSAL}" -eq 0 ]; then
  42. FFTW_EXTRAFLAGS+=" --enable-sse2"
  43. fi
  44. download fftw "${FFTW_VERSION}" "${FFTW_URL}"
  45. build_autoconf fftw "${FFTW_VERSION}" "${FFTW_EXTRAFLAGS}"
  46. if [ "${CROSS_COMPILING}" -eq 0 ]; then
  47. run_make fftw "${FFTW_VERSION}" check
  48. fi
  49. fi # PAWPAW_SKIP_FFTW
  50. # ---------------------------------------------------------------------------------------------------------------------
  51. # fftwf
  52. if [ -z "${PAWPAW_SKIP_FFTW}" ]; then
  53. # fftw is not compatible with LTO
  54. if [ -z "${PAWPAW_SKIP_LTO}" ] || [ "${PAWPAW_SKIP_LTO}" -eq 0 ]; then
  55. export EXTRA_CFLAGS="-fno-lto"
  56. export EXTRA_LDFLAGS="-fno-lto"
  57. fi
  58. FFTWF_EXTRAFLAGS="${FFTW_EXTRAFLAGS} --enable-single"
  59. if [ "${TOOLCHAIN_PREFIX}" = "aarch64-linux-gnu" ] || [ "${TOOLCHAIN_PREFIX}" = "arm-linux-gnueabihf" ]; then
  60. FFTWF_EXTRAFLAGS+=" --with-slow-timer"
  61. FFTWF_EXTRAFLAGS+=" --enable-neon"
  62. fi
  63. copy_download fftw fftwf "${FFTW_VERSION}"
  64. build_autoconf fftwf "${FFTW_VERSION}" "${FFTWF_EXTRAFLAGS}"
  65. if [ "${CROSS_COMPILING}" -eq 0 ]; then
  66. run_make fftwf "${FFTW_VERSION}" check
  67. fi
  68. fi # PAWPAW_SKIP_FFTW
  69. # ---------------------------------------------------------------------------------------------------------------------
  70. # pcre
  71. if [ "${MACOS}" -eq 1 ] || [ "${WIN32}" -eq 1 ]; then
  72. download pcre "${PCRE_VERSION}" "${PCRE_URL}"
  73. build_autoconf pcre "${PCRE_VERSION}"
  74. fi
  75. # ---------------------------------------------------------------------------------------------------------------------
  76. # libffi
  77. if [ "${WIN32}" -eq 1 ]; then
  78. LIBFFI_EXTRAFLAGS="--disable-multi-os-directory --disable-raw-api"
  79. download libffi "${LIBFFI_VERSION}" "${LIBFFI_URL}"
  80. build_autoconf libffi "${LIBFFI_VERSION}" "${LIBFFI_EXTRAFLAGS}"
  81. fi
  82. # ---------------------------------------------------------------------------------------------------------------------
  83. # glib
  84. if [ -z "${PAWPAW_SKIP_GLIB}" ]; then
  85. if [ "${MACOS}" -eq 1 ] || [ "${WIN32}" -eq 1 ]; then
  86. GLIB_EXTRAFLAGS="--disable-rebuilds"
  87. if [ "${WIN32}" -eq 1 ]; then
  88. GLIB_EXTRAFLAGS+=" --with-threads=win32"
  89. else
  90. GLIB_EXTRAFLAGS+=" --with-threads=posix"
  91. fi
  92. if [ "${MACOS}" -eq 1 ]; then
  93. export EXTRA_LDFLAGS="-lresolv"
  94. elif [ "${WIN32}" -eq 1 ]; then
  95. export EXTRA_CFLAGS="-Wno-format -Wno-format-overflow"
  96. fi
  97. download glib ${GLIB_VERSION} "${GLIB_URL}" "${GLIB_TAR_EXT}"
  98. if [ "${MACOS}" -eq 1 ]; then
  99. patch_file glib ${GLIB_VERSION} "glib/gconvert.c" '/#error/g'
  100. patch_file glib ${GLIB_VERSION} "glib/gatomic.c" 's/G_ATOMIC_ARM/__aarch64__/'
  101. patch_file glib ${GLIB_VERSION} "glib/gatomic.c" 's/G_ATOMIC_X86_64/__SSE2__/'
  102. fi
  103. build_autoconfgen glib ${GLIB_VERSION} "${GLIB_EXTRAFLAGS}"
  104. fi
  105. fi # PAWPAW_SKIP_GLIB
  106. # ---------------------------------------------------------------------------------------------------------------------
  107. # liblo
  108. LIBLO_EXTRAFLAGS="--enable-threads --disable-examples --disable-tools"
  109. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  110. LIBLO_EXTRAFLAGS+=" --disable-tests"
  111. fi
  112. # auto-detection fails
  113. if [ "${MACOS}" -eq 1 ]; then
  114. LIBLO_EXTRAFLAGS+=" ac_cv_func_select=yes ac_cv_func_poll=yes ac_cv_func_setvbuf=yes"
  115. if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
  116. LIBLO_EXTRAFLAGS+=" ac_cv_c_bigendian=universal"
  117. fi
  118. fi
  119. download liblo "${LIBLO_VERSION}" "${LIBLO_URL}"
  120. build_autoconf liblo "${LIBLO_VERSION}" "${LIBLO_EXTRAFLAGS}"
  121. # FIXME tests fail on macOS
  122. if [ "${CROSS_COMPILING}" -eq 0 ] && [ "${MACOS}" -eq 0 ]; then
  123. run_make liblo "${LIBLO_VERSION}" check
  124. fi
  125. # ---------------------------------------------------------------------------------------------------------------------
  126. # lv2
  127. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  128. git_clone lv2 "${LV2_VERSION}" "${LV2_URL}"
  129. build_waf lv2 "${LV2_VERSION}" "--lv2dir=${PAWPAW_PREFIX}/lib/lv2 --no-coverage --no-plugins"
  130. fi # PAWPAW_SKIP_LV2
  131. # ---------------------------------------------------------------------------------------------------------------------
  132. # serd
  133. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  134. download serd "${SERD_VERSION}" "${SERD_URL}" "tar.bz2"
  135. build_waf serd "${SERD_VERSION}" "--static --no-shared --no-utils"
  136. fi # PAWPAW_SKIP_LV2
  137. # ---------------------------------------------------------------------------------------------------------------------
  138. # sord
  139. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  140. if [ "${CROSS_COMPILING}" -eq 1 ] && [ -z "${EXE_WRAPPER}" ]; then
  141. SORD_EXTRAFLAGS="--no-utils"
  142. fi
  143. download sord "${SORD_VERSION}" "${SORD_URL}" "tar.bz2"
  144. build_waf sord "${SORD_VERSION}" "--static --no-shared ${SORD_EXTRAFLAGS}"
  145. fi # PAWPAW_SKIP_LV2
  146. # ---------------------------------------------------------------------------------------------------------------------
  147. # sratom
  148. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  149. download sratom "${SRATOM_VERSION}" "${SRATOM_URL}" "tar.bz2"
  150. build_waf sratom "${SRATOM_VERSION}" "--static --no-shared"
  151. fi # PAWPAW_SKIP_LV2
  152. # ---------------------------------------------------------------------------------------------------------------------
  153. # lilv
  154. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  155. download lilv "${LILV_VERSION}" "${LILV_URL}" "tar.bz2"
  156. build_waf lilv "${LILV_VERSION}" "--static --no-bash-completion --no-bindings --no-shared"
  157. # --static-progs
  158. fi # PAWPAW_SKIP_LV2
  159. # ---------------------------------------------------------------------------------------------------------------------
  160. # lv2lint
  161. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  162. if [ "${LV2LINT_SUPPORTED}" -eq 1 ]; then
  163. download lv2lint "${LV2LINT_VERSION}" "${LV2LINT_URL}"
  164. build_meson lv2lint "${LV2LINT_VERSION}"
  165. # "-Donline-tests=true -Delf-tests=true"
  166. fi
  167. fi # PAWPAW_SKIP_LV2
  168. # ---------------------------------------------------------------------------------------------------------------------
  169. # kxstudio lv2 extensions
  170. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  171. git_clone kxstudio-lv2-extensions "${KXSTUDIO_LV2_EXTENSIONS_VERSION}" "${KXSTUDIO_LV2_EXTENSIONS_URL}"
  172. build_make kxstudio-lv2-extensions "${KXSTUDIO_LV2_EXTENSIONS_VERSION}"
  173. fi # PAWPAW_SKIP_LV2
  174. # ---------------------------------------------------------------------------------------------------------------------
  175. # MOD lv2 extensions
  176. if [ -z "${PAWPAW_SKIP_LV2}" ]; then
  177. git_clone mod-sdk "${MOD_SDK_VERSION}" "${MOD_SDK_URL}"
  178. build_make mod-sdk "${MOD_SDK_VERSION}"
  179. fi # PAWPAW_SKIP_LV2
  180. # ---------------------------------------------------------------------------------------------------------------------
  181. # fluidsynth
  182. if [ -z "${PAWPAW_SKIP_FLUIDSYNTH}" ]; then
  183. FLUIDSYNTH_EXTRAFLAGS="-Denable-floats=ON"
  184. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-alsa=OFF"
  185. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-aufile=OFF"
  186. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-coreaudio=OFF"
  187. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-coremidi=OFF"
  188. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-dbus=OFF"
  189. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-debug=OFF"
  190. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-fpe-check=OFF"
  191. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-framework=OFF"
  192. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-ipv6=OFF"
  193. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-jack=OFF"
  194. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-ladcca=OFF"
  195. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-ladspa=OFF"
  196. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-lash=OFF"
  197. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-midishare=OFF"
  198. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-oss=OFF"
  199. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-portaudio=OFF"
  200. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-profiling=OFF"
  201. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-pulseaudio=OFF"
  202. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-readline=OFF"
  203. FLUIDSYNTH_EXTRAFLAGS+=" -Denable-trap-on-fpe=OFF"
  204. git_clone fluidsynth "${FLUIDSYNTH_VERSION}" "${FLUIDSYNTH_URL}"
  205. build_cmake fluidsynth "${FLUIDSYNTH_VERSION}" "${FLUIDSYNTH_EXTRAFLAGS}"
  206. if [ ! -e "${PAWPAW_PREFIX}/lib/pkgconfig/fluidsynth.pc-e" ]; then
  207. FLUIDSYNTH_EXTRALIBS="-lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -lopus -logg -lpthread -lm"
  208. if [ "${MACOS}" -eq 1 ]; then
  209. FLUIDSYNTH_EXTRALIBS+=" -liconv"
  210. elif [ "${WIN32}" -eq 1 ]; then
  211. FLUIDSYNTH_EXTRALIBS+=" -lole32 -lws2_32"
  212. fi
  213. sed -i -e "s/-L\${libdir} -lfluidsynth/-L\${libdir} -lfluidsynth ${FLUIDSYNTH_EXTRALIBS}/" "${PAWPAW_PREFIX}/lib/pkgconfig/fluidsynth.pc"
  214. touch "${PAWPAW_PREFIX}/lib/pkgconfig/fluidsynth.pc-e"
  215. fi
  216. fi # PAWPAW_SKIP_FLUIDSYNTH
  217. # ---------------------------------------------------------------------------------------------------------------------
  218. # mxml
  219. git_clone mxml "${MXML_VERSION}" "${MXML_URL}"
  220. build_autoconf mxml "${MXML_VERSION}"
  221. # ---------------------------------------------------------------------------------------------------------------------
  222. # carla (backend only)
  223. CARLA_EXTRAFLAGS="CAN_GENERATE_LV2_TTL=false"
  224. CARLA_EXTRAFLAGS+=" EXTERNAL_PLUGINS=false"
  225. CARLA_EXTRAFLAGS+=" HAVE_ALSA=false"
  226. CARLA_EXTRAFLAGS+=" HAVE_JACK=false"
  227. CARLA_EXTRAFLAGS+=" HAVE_PULSEAUDIO=false"
  228. CARLA_EXTRAFLAGS+=" HAVE_DGL=false"
  229. CARLA_EXTRAFLAGS+=" HAVE_HYLIA=false"
  230. CARLA_EXTRAFLAGS+=" HAVE_GTK2=false"
  231. CARLA_EXTRAFLAGS+=" HAVE_GTK3=false"
  232. CARLA_EXTRAFLAGS+=" HAVE_X11=false"
  233. CARLA_EXTRAFLAGS+=" HAVE_FFMPEG=false"
  234. CARLA_EXTRAFLAGS+=" HAVE_FLUIDSYNTH=false"
  235. CARLA_EXTRAFLAGS+=" HAVE_LIBLO=false"
  236. CARLA_EXTRAFLAGS+=" HAVE_LIBMAGIC=false"
  237. CARLA_EXTRAFLAGS+=" HAVE_PYQT=false"
  238. CARLA_EXTRAFLAGS+=" HAVE_QT=false"
  239. CARLA_EXTRAFLAGS+=" HAVE_QT4=false"
  240. CARLA_EXTRAFLAGS+=" HAVE_QT5=false"
  241. CARLA_EXTRAFLAGS+=" HAVE_SNDFILE=false"
  242. CARLA_EXTRAFLAGS+=" NOOPT=true"
  243. CARLA_EXTRAFLAGS+=" USING_JUCE=false"
  244. CARLA_EXTRAFLAGS+=" USING_JUCE_AUDIO_DEVICES=false"
  245. CARLA_EXTRAFLAGS+=" USING_JUCE_GUI_EXTRA=false"
  246. CARLA_EXTRAFLAGS+=" USING_RTAUDIO=false"
  247. git_clone carla "${CARLA_VERSION}" "${CARLA_URL}"
  248. build_make carla "${CARLA_VERSION}" "${CARLA_EXTRAFLAGS}"
  249. # ---------------------------------------------------------------------------------------------------------------------
  250. # wine bootstrap (needed for cross-compilation)
  251. if [ "${WIN32}" -eq 1 ] && [ -n "${EXE_WRAPPER}" ] && [ ! -d "${WINEPREFIX}" ]; then
  252. wineboot -u
  253. fi
  254. # ---------------------------------------------------------------------------------------------------------------------