Audio plugin host https://kx.studio/carla
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.

build-deps.sh 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. #!/bin/bash
  2. # ---------------------------------------------------------------------------------------------------------------------
  3. # stop on error
  4. set -e
  5. # ---------------------------------------------------------------------------------------------------------------------
  6. # cd to correct path
  7. cd $(dirname $0)
  8. # ---------------------------------------------------------------------------------------------------------------------
  9. # set variables
  10. source common.env
  11. # ---------------------------------------------------------------------------------------------------------------------
  12. # function to remove old stuff
  13. cleanup_prefix()
  14. {
  15. rm -rf ${TARGETDIR}/carla-w32nosse ${TARGETDIR}/carla-w32 ${TARGETDIR}/carla-w64
  16. }
  17. cleanup_pkgs()
  18. {
  19. rm -rf Carla
  20. rm -rf Carla.exe
  21. rm -rf Carla.lv2
  22. rm -rf Carla.vst
  23. rm -rf Carla_*
  24. rm -rf flac-*
  25. rm -rf fluidsynth-*
  26. rm -rf fftw-*
  27. rm -rf glib-*
  28. rm -rf liblo-*
  29. rm -rf libogg-*
  30. rm -rf libsndfile-*
  31. rm -rf libvorbis-*
  32. rm -rf mxml-*
  33. rm -rf pkg-config-*
  34. rm -rf pyliblo-*
  35. rm -rf zlib-*
  36. }
  37. cleanup()
  38. {
  39. cleanup_prefix
  40. cleanup_pkgs
  41. exit 0
  42. }
  43. # ------------------------------------------------------------------------------------
  44. # function to build base libs
  45. build_base()
  46. {
  47. # ---------------------------------------------------------------------------------------------------------------------
  48. # clean env
  49. unset AR
  50. unset CC
  51. unset CXX
  52. unset STRIP
  53. unset WINDRES
  54. unset PKG_CONFIG_PATH
  55. unset CFLAGS
  56. unset CPPFLAGS
  57. unset CXXFLAGS
  58. unset LDFLAGS
  59. export PREFIX=${TARGETDIR}/carla-w${ARCH_PREFIX}
  60. export PATH=${PREFIX}/bin:/usr/sbin:/usr/bin:/sbin:/bin
  61. export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
  62. # ---------------------------------------------------------------------------------------------------------------------
  63. # pkgconfig
  64. if [ ! -d pkg-config-${PKG_CONFIG_VERSION} ]; then
  65. wget -c https://pkg-config.freedesktop.org/releases/pkg-config-${PKG_CONFIG_VERSION}.tar.gz
  66. tar -xf pkg-config-${PKG_CONFIG_VERSION}.tar.gz
  67. fi
  68. if [ ! -f pkg-config-${PKG_CONFIG_VERSION}/build-done ]; then
  69. cd pkg-config-${PKG_CONFIG_VERSION}
  70. env AR="ar" CC="gcc" STRIP="strip" CFLAGS="" LDFLAGS="" PATH="/usr/sbin:/usr/bin:/sbin:/bin" \
  71. ./configure --enable-indirect-deps --with-internal-glib --with-pc-path=${PKG_CONFIG_PATH} --prefix=${PREFIX}
  72. make ${MAKE_ARGS}
  73. make install
  74. touch build-done
  75. cd ..
  76. fi
  77. # ---------------------------------------------------------------------------------------------------------------------
  78. # setup
  79. if [ x"${ARCH}" != x"32" ]; then
  80. CPUARCH="x86_64"
  81. else
  82. CPUARCH="i686"
  83. fi
  84. HOST_ARCH=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  85. MINGW_PREFIX="${CPUARCH}-w64-mingw32"
  86. export AR=${MINGW_PREFIX}-ar
  87. export CC=${MINGW_PREFIX}-gcc
  88. export CXX=${MINGW_PREFIX}-g++
  89. export STRIP=${MINGW_PREFIX}-strip
  90. export WINDRES=${MINGW_PREFIX}-windres
  91. if [ -z "${NOSSE}" ]; then
  92. export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -mstackrealign -fvisibility=hidden -fdata-sections -ffunction-sections"
  93. else
  94. export CFLAGS="-O2 -mstackrealign -fvisibility=hidden -fdata-sections -ffunction-sections"
  95. fi
  96. export CFLAGS="${CFLAGS} -DNDEBUG -DPTW32_STATIC_LIB -DFLUIDSYNTH_NOT_A_DLL -I${PREFIX}/include -I/opt/mingw${ARCH}/include"
  97. export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
  98. export CPPFLAGS="-DPIC -DNDEBUG -DPTW32_STATIC_LIB -I${PREFIX}/include -I/opt/mingw${ARCH}/include"
  99. export LDFLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
  100. export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -L/opt/mingw${ARCH}/lib"
  101. # ---------------------------------------------------------------------------------------------------------------------
  102. # liblo
  103. if [ ! -d liblo-${LIBLO_VERSION} ]; then
  104. wget -c https://github.com/radarsat1/liblo/releases/download/${LIBLO_VERSION}/liblo-${LIBLO_VERSION}.tar.gz
  105. tar -xf liblo-${LIBLO_VERSION}.tar.gz
  106. fi
  107. if [ ! -f liblo-${LIBLO_VERSION}/build-done ]; then
  108. cd liblo-${LIBLO_VERSION}
  109. sed -i "s/@extralibs@/@extralibs@ -lm/" liblo.pc.in
  110. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  111. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  112. --enable-threads \
  113. --disable-examples --disable-tools
  114. make ${MAKE_ARGS}
  115. make install
  116. touch build-done
  117. cd ..
  118. fi
  119. # ---------------------------------------------------------------------------------------------------------------------
  120. # zlib
  121. if [ ! -d zlib-${ZLIB_VERSION} ]; then
  122. wget -c https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz -O zlib-${ZLIB_VERSION}.tar.gz
  123. tar -xf zlib-${ZLIB_VERSION}.tar.gz
  124. fi
  125. if [ ! -f zlib-${ZLIB_VERSION}/build-done ]; then
  126. cd zlib-${ZLIB_VERSION}
  127. ./configure --static --prefix=${PREFIX}
  128. make ${MAKE_ARGS}
  129. make install
  130. touch build-done
  131. cd ..
  132. fi
  133. # ---------------------------------------------------------------------------------------------------------------------
  134. # libogg
  135. if [ ! -d libogg-${LIBOGG_VERSION} ]; then
  136. wget -c https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
  137. tar -xf libogg-${LIBOGG_VERSION}.tar.gz
  138. fi
  139. if [ ! -f libogg-${LIBOGG_VERSION}/build-done ]; then
  140. cd libogg-${LIBOGG_VERSION}
  141. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  142. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  143. make ${MAKE_ARGS}
  144. make install
  145. touch build-done
  146. cd ..
  147. fi
  148. # ---------------------------------------------------------------------------------------------------------------------
  149. # libvorbis
  150. if [ ! -d libvorbis-${LIBVORBIS_VERSION} ]; then
  151. wget -c https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
  152. tar -xf libvorbis-${LIBVORBIS_VERSION}.tar.gz
  153. fi
  154. if [ ! -f libvorbis-${LIBVORBIS_VERSION}/build-done ]; then
  155. cd libvorbis-${LIBVORBIS_VERSION}
  156. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  157. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  158. make ${MAKE_ARGS}
  159. make install
  160. touch build-done
  161. cd ..
  162. fi
  163. # ---------------------------------------------------------------------------------------------------------------------
  164. # flac
  165. if [ ! -d flac-${FLAC_VERSION} ]; then
  166. wget -c https://ftp.osuosl.org/pub/xiph/releases/flac/flac-${FLAC_VERSION}.tar.xz
  167. tar -xf flac-${FLAC_VERSION}.tar.xz
  168. fi
  169. if [ ! -f flac-${FLAC_VERSION}/build-done ]; then
  170. cd flac-${FLAC_VERSION}
  171. chmod +x configure install-sh
  172. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  173. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  174. --disable-cpplibs
  175. make ${MAKE_ARGS}
  176. make install
  177. touch build-done
  178. cd ..
  179. fi
  180. # ---------------------------------------------------------------------------------------------------------------------
  181. # libsndfile
  182. if [ ! -d libsndfile-${LIBSNDFILE_VERSION} ]; then
  183. wget -c http://www.mega-nerd.com/libsndfile/files/libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  184. tar -xf libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  185. fi
  186. if [ ! -f libsndfile-${LIBSNDFILE_VERSION}/build-done ]; then
  187. cd libsndfile-${LIBSNDFILE_VERSION}
  188. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  189. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  190. --disable-full-suite --disable-alsa --disable-sqlite
  191. make ${MAKE_ARGS}
  192. make install
  193. touch build-done
  194. cd ..
  195. fi
  196. # ------------------------------------------------------------------------------------
  197. # glib
  198. if [ ! -d glib-${GLIB_VERSION} ]; then
  199. wget -c http://caesar.ftp.acc.umu.se/pub/GNOME/sources/glib/${GLIB_MVERSION}/glib-${GLIB_VERSION}.tar.gz
  200. tar -xf glib-${GLIB_VERSION}.tar.gz
  201. fi
  202. if [ ! -f glib-${GLIB_VERSION}/build-done ]; then
  203. cd glib-${GLIB_VERSION}
  204. if [ ! -f patched ]; then
  205. patch -p1 -i ../patches/glib_skip-gettext.patch
  206. sed -i "s|po docs|po|" Makefile.in
  207. touch patched
  208. fi
  209. chmod +x configure install-sh
  210. autoconf
  211. ./configure --enable-static --disable-shared --disable-docs --prefix=${PREFIX} \
  212. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  213. --with-threads=win32
  214. make ${MAKE_ARGS}
  215. make install
  216. touch build-done
  217. cd ..
  218. fi
  219. # ---------------------------------------------------------------------------------------------------------------------
  220. # fluidsynth
  221. if [ ! -d fluidsynth-${FLUIDSYNTH_VERSION} ]; then
  222. wget -c https://github.com/FluidSynth/fluidsynth/archive/v${FLUIDSYNTH_VERSION}.tar.gz -O fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  223. tar -xf fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  224. fi
  225. if [ ! -f fluidsynth-${FLUIDSYNTH_VERSION}/build-done ]; then
  226. cd fluidsynth-${FLUIDSYNTH_VERSION}
  227. if [ ! -f patched ]; then
  228. patch -p1 -i ../patches/fluidsynth-skip-drivers-build.patch
  229. touch patched
  230. fi
  231. cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_SHARED_LIBS=OFF \
  232. -Denable-debug=OFF -Denable-profiling=OFF -Denable-ladspa=OFF -Denable-fpe-check=OFF -Denable-portaudio=OFF \
  233. -Denable-trap-on-fpe=OFF -Denable-aufile=OFF -Denable-dbus=OFF -Denable-ipv6=OFF -Denable-jack=OFF \
  234. -Denable-midishare=OFF -Denable-oss=OFF -Denable-pulseaudio=OFF -Denable-readline=OFF -Denable-ladcca=OFF \
  235. -Denable-lash=OFF -Denable-alsa=OFF -Denable-coreaudio=OFF -Denable-coremidi=OFF -Denable-framework=OFF \
  236. -Denable-floats=ON \
  237. -DCMAKE_C_COMPILER_WORKS=1 \
  238. -DCMAKE_CROSSCOMPILING=1 \
  239. -DCMAKE_SYSTEM_NAME="Windows" \
  240. -DCMAKE_HOST_SYSTEM_NAME=${HOST_ARCH}
  241. make ${MAKE_ARGS}
  242. make install
  243. sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lm -ldsound -lwinmm -lole32 -lws2_32|" ${PREFIX}/lib/pkgconfig/fluidsynth.pc
  244. touch build-done
  245. cd ..
  246. fi
  247. # ---------------------------------------------------------------------------------------------------------------------
  248. # mxml
  249. if [ ! -d mxml-${MXML_VERSION} ]; then
  250. wget -c https://github.com/michaelrsweet/mxml/releases/download/v${MXML_VERSION}/mxml-${MXML_VERSION}.tar.gz -O mxml-${MXML_VERSION}.tar.gz
  251. tar -xf mxml-${MXML_VERSION}.tar.gz
  252. fi
  253. if [ ! -f mxml-${MXML_VERSION}/build-done ]; then
  254. cd mxml-${MXML_VERSION}
  255. ./configure --disable-shared --prefix=${PREFIX} \
  256. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  257. make libmxml.a
  258. cp *.a ${PREFIX}/lib/
  259. cp *.pc ${PREFIX}/lib/pkgconfig/
  260. cp mxml.h ${PREFIX}/include/
  261. touch build-done
  262. cd ..
  263. fi
  264. # ---------------------------------------------------------------------------------------------------------------------
  265. # fftw3 (needs to be last as it modifies C[XX]FLAGS)
  266. if [ ! -d fftw-${FFTW3_VERSION} ]; then
  267. curl -O http://www.fftw.org/fftw-${FFTW3_VERSION}.tar.gz
  268. tar -xf fftw-${FFTW3_VERSION}.tar.gz
  269. fi
  270. if [ ! -f fftw-${FFTW3_VERSION}/build-done ]; then
  271. export CFLAGS="${CFLAGS} -ffast-math"
  272. export CXXFLAGS="${CXXFLAGS} -ffast-math"
  273. EXTRA_ARGS=""
  274. cd fftw-${FFTW3_VERSION}
  275. if [ -z "${NOSSE}" ]; then
  276. EXTRA_ARGS="--enable-sse2"
  277. fi
  278. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  279. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  280. ${EXTRA_ARGS} \
  281. --disable-debug --disable-alloca --disable-fortran \
  282. --with-our-malloc
  283. make
  284. make install
  285. make clean
  286. if [ -z "${NOSSE}" ]; then
  287. EXTRA_ARGS="--enable-sse2 --enable-sse"
  288. fi
  289. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  290. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  291. ${EXTRA_ARGS} --enable-single \
  292. --disable-debug --disable-alloca --disable-fortran \
  293. --with-our-malloc
  294. make
  295. make install
  296. make clean
  297. touch build-done
  298. cd ..
  299. fi
  300. }
  301. # ---------------------------------------------------------------------------------------------------------------------
  302. # build base libs
  303. cleanup_prefix
  304. cleanup_pkgs
  305. export ARCH=32
  306. export ARCH_PREFIX=32nosse
  307. export NOSSE=1
  308. build_base
  309. cleanup_pkgs
  310. unset NOSSE
  311. export ARCH=32
  312. export ARCH_PREFIX=32
  313. build_base
  314. cleanup_pkgs
  315. export ARCH=64
  316. export ARCH_PREFIX=64
  317. build_base
  318. cleanup_pkgs
  319. # ---------------------------------------------------------------------------------------------------------------------