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 12KB

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