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

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