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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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 glib-*
  22. rm -rf libgig-*
  23. rm -rf liblo-*
  24. rm -rf libogg-*
  25. rm -rf libsndfile-*
  26. rm -rf libvorbis-*
  27. rm -rf linuxsampler-*
  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. # export MOC=${MINGW_PREFIX}-moc
  87. # export RCC=${MINGW_PREFIX}-rcc
  88. # export PKGCONFIG=${MINGW_PREFIX}-pkg-config
  89. if [ -z "${NOSSE}" ]; then
  90. export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
  91. else
  92. export CFLAGS="-O3 -mtune=generic -fvisibility=hidden -fdata-sections -ffunction-sections"
  93. fi
  94. export CFLAGS="${CFLAGS} -DNDEBUG -DPTW32_STATIC_LIB -DFLUIDSYNTH_NOT_A_DLL -I${PREFIX}/include -I/opt/mingw${ARCH}/include"
  95. export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
  96. export CPPFLAGS="-DPIC -DNDEBUG -DPTW32_STATIC_LIB -I${PREFIX}/include -I/opt/mingw${ARCH}/include"
  97. export LDFLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
  98. export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -L/opt/mingw${ARCH}/lib"
  99. # ---------------------------------------------------------------------------------------------------------------------
  100. # liblo
  101. if [ ! -d liblo-${LIBLO_VERSION} ]; then
  102. wget -c https://github.com/radarsat1/liblo/releases/download/${LIBLO_VERSION}/liblo-${LIBLO_VERSION}.tar.gz
  103. tar -xf liblo-${LIBLO_VERSION}.tar.gz
  104. fi
  105. if [ ! -f liblo-${LIBLO_VERSION}/build-done ]; then
  106. cd liblo-${LIBLO_VERSION}
  107. sed -i "s/@extralibs@/@extralibs@ -lm/" liblo.pc.in
  108. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  109. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  110. --enable-threads \
  111. --disable-examples --disable-tools
  112. make ${MAKE_ARGS}
  113. make install
  114. touch build-done
  115. cd ..
  116. fi
  117. # ---------------------------------------------------------------------------------------------------------------------
  118. # zlib
  119. if [ ! -d zlib-${ZLIB_VERSION} ]; then
  120. wget -c https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz -O zlib-${ZLIB_VERSION}.tar.gz
  121. tar -xf zlib-${ZLIB_VERSION}.tar.gz
  122. fi
  123. if [ ! -f zlib-${ZLIB_VERSION}/build-done ]; then
  124. cd zlib-${ZLIB_VERSION}
  125. ./configure --static --prefix=${PREFIX}
  126. make ${MAKE_ARGS}
  127. make install
  128. touch build-done
  129. cd ..
  130. fi
  131. # ---------------------------------------------------------------------------------------------------------------------
  132. # libogg
  133. if [ ! -d libogg-${LIBOGG_VERSION} ]; then
  134. wget -c https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
  135. tar -xf libogg-${LIBOGG_VERSION}.tar.gz
  136. fi
  137. if [ ! -f libogg-${LIBOGG_VERSION}/build-done ]; then
  138. cd libogg-${LIBOGG_VERSION}
  139. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  140. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  141. make ${MAKE_ARGS}
  142. make install
  143. touch build-done
  144. cd ..
  145. fi
  146. # ---------------------------------------------------------------------------------------------------------------------
  147. # libvorbis
  148. if [ ! -d libvorbis-${LIBVORBIS_VERSION} ]; then
  149. wget -c https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
  150. tar -xf libvorbis-${LIBVORBIS_VERSION}.tar.gz
  151. fi
  152. if [ ! -f libvorbis-${LIBVORBIS_VERSION}/build-done ]; then
  153. cd libvorbis-${LIBVORBIS_VERSION}
  154. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  155. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  156. make ${MAKE_ARGS}
  157. make install
  158. touch build-done
  159. cd ..
  160. fi
  161. # ---------------------------------------------------------------------------------------------------------------------
  162. # flac
  163. if [ ! -d flac-${FLAC_VERSION} ]; then
  164. wget -c https://svn.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz
  165. tar -xf flac-${FLAC_VERSION}.tar.xz
  166. fi
  167. if [ ! -f flac-${FLAC_VERSION}/build-done ]; then
  168. cd flac-${FLAC_VERSION}
  169. chmod +x configure install-sh
  170. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  171. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  172. --disable-cpplibs
  173. make ${MAKE_ARGS}
  174. make install
  175. touch build-done
  176. cd ..
  177. fi
  178. # ---------------------------------------------------------------------------------------------------------------------
  179. # libsndfile
  180. if [ ! -d libsndfile-${LIBSNDFILE_VERSION} ]; then
  181. wget -c http://www.mega-nerd.com/libsndfile/files/libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  182. tar -xf libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  183. fi
  184. if [ ! -f libsndfile-${LIBSNDFILE_VERSION}/build-done ]; then
  185. cd libsndfile-${LIBSNDFILE_VERSION}
  186. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  187. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  188. --disable-full-suite --disable-alsa --disable-sqlite
  189. make ${MAKE_ARGS}
  190. make install
  191. touch build-done
  192. cd ..
  193. fi
  194. # ---------------------------------------------------------------------------------------------------------------------
  195. # libgig
  196. if [ ! -d libgig-${LIBGIG_VERSION} ]; then
  197. wget -c http://download.linuxsampler.org/packages/libgig-${LIBGIG_VERSION}.tar.bz2
  198. tar -xf libgig-${LIBGIG_VERSION}.tar.bz2
  199. fi
  200. if [ ! -f libgig-${LIBGIG_VERSION}/build-done ]; then
  201. cd libgig-${LIBGIG_VERSION}
  202. if [ ! -f patched ]; then
  203. patch -p1 -i ../patches/libgig_fix-build.patch
  204. touch patched
  205. fi
  206. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  207. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  208. make ${MAKE_ARGS}
  209. make install
  210. touch build-done
  211. cd ..
  212. fi
  213. # ---------------------------------------------------------------------------------------------------------------------
  214. # linuxsampler
  215. if [ ! -d linuxsampler-${LINUXSAMPLER_VERSION} ]; then
  216. wget -c http://download.linuxsampler.org/packages/linuxsampler-${LINUXSAMPLER_VERSION}.tar.bz2
  217. tar -xf linuxsampler-${LINUXSAMPLER_VERSION}.tar.bz2
  218. fi
  219. if [ ! -f linuxsampler-${LINUXSAMPLER_VERSION}/build-done ]; then
  220. cd linuxsampler-${LINUXSAMPLER_VERSION}
  221. if [ ! -f patched ]; then
  222. patch -p1 -i ../patches/linuxsampler_allow-no-drivers-build.patch
  223. patch -p1 -i ../patches/linuxsampler_disable-ladspa-fx.patch
  224. sed -i -e "s|HAVE_LV2|HAVE_AU|" src/hostplugins/Makefile.am
  225. touch patched
  226. fi
  227. rm -f configure
  228. make -f Makefile.svn configure
  229. ./configure \
  230. --enable-static --disable-shared --prefix=${PREFIX} \
  231. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  232. --enable-signed-triang-algo=diharmonic --enable-unsigned-triang-algo=diharmonic --enable-subfragment-size=8 \
  233. --disable-alsa-driver --disable-arts-driver --disable-jack-driver \
  234. --disable-asio-driver --disable-midishare-driver --disable-mmemidi-driver \
  235. --disable-coreaudio-driver --disable-coremidi-driver \
  236. --disable-instruments-db --disable-sf2-engine
  237. make ${MAKE_ARGS}
  238. make install
  239. sed -i -e "s|-llinuxsampler|-llinuxsampler -L${PREFIX}/lib/libgig -lgig -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lm -lrpcrt4|" ${PREFIX}/lib/pkgconfig/linuxsampler.pc
  240. touch build-done
  241. cd ..
  242. fi
  243. # ------------------------------------------------------------------------------------
  244. # glib
  245. if [ ! -d glib-${GLIB_VERSION} ]; then
  246. wget -c http://caesar.ftp.acc.umu.se/pub/GNOME/sources/glib/${GLIB_MVERSION}/glib-${GLIB_VERSION}.tar.gz
  247. tar -xf glib-${GLIB_VERSION}.tar.gz
  248. fi
  249. if [ ! -f glib-${GLIB_VERSION}/build-done ]; then
  250. cd glib-${GLIB_VERSION}
  251. if [ ! -f patched ]; then
  252. patch -p1 -i ../patches/glib_skip-gettext.patch
  253. sed -i "s|po docs|po|" Makefile.in
  254. touch patched
  255. fi
  256. chmod +x configure install-sh
  257. autoconf
  258. ./configure --enable-static --disable-shared --disable-docs --prefix=${PREFIX} \
  259. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  260. --with-threads=win32
  261. make ${MAKE_ARGS}
  262. make install
  263. touch build-done
  264. cd ..
  265. fi
  266. # ---------------------------------------------------------------------------------------------------------------------
  267. # fluidsynth
  268. if [ ! -d fluidsynth-${FLUIDSYNTH_VERSION} ]; then
  269. wget -c https://download.sourceforge.net/fluidsynth/fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  270. tar -xf fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  271. fi
  272. if [ ! -f fluidsynth-${FLUIDSYNTH_VERSION}/build-done ]; then
  273. cd fluidsynth-${FLUIDSYNTH_VERSION}
  274. if [ ! -f patched ]; then
  275. patch -p1 -i ../patches/fluidsynth_fix-64-bit-cast.patch
  276. touch patched
  277. fi
  278. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  279. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  280. --enable-libsndfile-support \
  281. --disable-dbus-support --disable-aufile-support \
  282. --disable-pulse-support --disable-alsa-support --disable-portaudio-support --disable-oss-support --disable-jack-support \
  283. --disable-coreaudio --disable-coremidi --disable-dart --disable-lash --disable-ladcca \
  284. --without-readline
  285. make ${MAKE_ARGS}
  286. make install
  287. 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
  288. touch build-done
  289. cd ..
  290. fi
  291. # ---------------------------------------------------------------------------------------------------------------------
  292. # mxml
  293. if [ ! -d mxml-${MXML_VERSION} ]; then
  294. wget -c https://github.com/michaelrsweet/mxml/releases/download/v${MXML_VERSION}/mxml-${MXML_VERSION}.tar.gz -O mxml-${MXML_VERSION}.tar.gz
  295. mkdir mxml-${MXML_VERSION}
  296. cd mxml-${MXML_VERSION}
  297. tar -xf ../mxml-${MXML_VERSION}.tar.gz
  298. cd ..
  299. fi
  300. if [ ! -f mxml-${MXML_VERSION}/build-done ]; then
  301. cd mxml-${MXML_VERSION}
  302. ./configure --disable-shared --prefix=${PREFIX} \
  303. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  304. make libmxml.a
  305. cp *.a ${PREFIX}/lib/
  306. cp *.pc ${PREFIX}/lib/pkgconfig/
  307. cp mxml.h ${PREFIX}/include/
  308. touch build-done
  309. cd ..
  310. fi
  311. # ---------------------------------------------------------------------------------------------------------------------
  312. # fftw3 (needs to be last as it modifies C[XX]FLAGS)
  313. if [ ! -d fftw-${FFTW3_VERSION} ]; then
  314. curl -O http://www.fftw.org/fftw-${FFTW3_VERSION}.tar.gz
  315. tar -xf fftw-${FFTW3_VERSION}.tar.gz
  316. fi
  317. if [ ! -f fftw-${FFTW3_VERSION}/build-done ]; then
  318. export CFLAGS="${CFLAGS} -ffast-math"
  319. export CXXFLAGS="${CXXFLAGS} -ffast-math"
  320. EXTRA_ARGS=""
  321. cd fftw-${FFTW3_VERSION}
  322. if [ -z "${NOSSE}" ]; then
  323. EXTRA_ARGS="--enable-sse2"
  324. fi
  325. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  326. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  327. ${EXTRA_ARGS} \
  328. --disable-debug --disable-alloca --disable-fortran \
  329. --with-our-malloc
  330. make
  331. make install
  332. make clean
  333. if [ -z "${NOSSE}" ]; then
  334. EXTRA_ARGS="--enable-sse2 --enable-sse"
  335. fi
  336. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  337. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  338. ${EXTRA_ARGS} --enable-single \
  339. --disable-debug --disable-alloca --disable-fortran \
  340. --with-our-malloc
  341. make
  342. make install
  343. make clean
  344. touch build-done
  345. cd ..
  346. fi
  347. }
  348. # ---------------------------------------------------------------------------------------------------------------------
  349. # build base libs
  350. cleanup_prefix
  351. export ARCH=32
  352. export ARCH_PREFIX=32nosse
  353. export NOSSE=1
  354. build_base
  355. cleanup_pkgs
  356. unset NOSSE
  357. export ARCH=32
  358. export ARCH_PREFIX=32
  359. build_base
  360. cleanup_pkgs
  361. export ARCH=64
  362. export ARCH_PREFIX=64
  363. build_base
  364. cleanup_pkgs
  365. # ---------------------------------------------------------------------------------------------------------------------