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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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-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}
  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. export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
  90. export CFLAGS="${CFLAGS} -DNDEBUG -DPTW32_STATIC_LIB -DFLUIDSYNTH_NOT_A_DLL -I${PREFIX}/include -I/opt/mingw${ARCH}/include"
  91. export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
  92. export CPPFLAGS="-DPIC -DNDEBUG -DPTW32_STATIC_LIB -I${PREFIX}/include -I/opt/mingw${ARCH}/include"
  93. export LDFLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
  94. export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -L/opt/mingw${ARCH}/lib"
  95. # FIXME: the following flags are not supported by my current mingw build
  96. #
  97. # ---------------------------------------------------------------------------------------------------------------------
  98. # liblo
  99. if [ ! -d liblo-${LIBLO_VERSION} ]; then
  100. wget -c https://download.sourceforge.net/liblo/liblo-${LIBLO_VERSION}.tar.gz
  101. tar -xf liblo-${LIBLO_VERSION}.tar.gz
  102. fi
  103. if [ ! -f liblo-${LIBLO_VERSION}/build-done ]; then
  104. cd liblo-${LIBLO_VERSION}
  105. sed -i "s/@extralibs@/@extralibs@ -lm/" liblo.pc.in
  106. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  107. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  108. --enable-threads \
  109. --disable-examples --disable-tools
  110. make ${MAKE_ARGS}
  111. make install
  112. touch build-done
  113. cd ..
  114. fi
  115. # ---------------------------------------------------------------------------------------------------------------------
  116. # zlib
  117. if [ ! -d zlib-${ZLIB_VERSION} ]; then
  118. wget -c https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz -O zlib-${ZLIB_VERSION}.tar.gz
  119. tar -xf zlib-${ZLIB_VERSION}.tar.gz
  120. fi
  121. if [ ! -f zlib-${ZLIB_VERSION}/build-done ]; then
  122. cd zlib-${ZLIB_VERSION}
  123. ./configure --static --prefix=${PREFIX}
  124. make ${MAKE_ARGS}
  125. make install
  126. touch build-done
  127. cd ..
  128. fi
  129. # ---------------------------------------------------------------------------------------------------------------------
  130. # libogg
  131. if [ ! -d libogg-${LIBOGG_VERSION} ]; then
  132. wget -c https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
  133. tar -xf libogg-${LIBOGG_VERSION}.tar.gz
  134. fi
  135. if [ ! -f libogg-${LIBOGG_VERSION}/build-done ]; then
  136. cd libogg-${LIBOGG_VERSION}
  137. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  138. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  139. make ${MAKE_ARGS}
  140. make install
  141. touch build-done
  142. cd ..
  143. fi
  144. # ---------------------------------------------------------------------------------------------------------------------
  145. # libvorbis
  146. if [ ! -d libvorbis-${LIBVORBIS_VERSION} ]; then
  147. wget -c https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
  148. tar -xf libvorbis-${LIBVORBIS_VERSION}.tar.gz
  149. fi
  150. if [ ! -f libvorbis-${LIBVORBIS_VERSION}/build-done ]; then
  151. cd libvorbis-${LIBVORBIS_VERSION}
  152. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  153. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  154. make ${MAKE_ARGS}
  155. make install
  156. touch build-done
  157. cd ..
  158. fi
  159. # ---------------------------------------------------------------------------------------------------------------------
  160. # flac
  161. if [ ! -d flac-${FLAC_VERSION} ]; then
  162. wget -c https://svn.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz
  163. tar -xf flac-${FLAC_VERSION}.tar.xz
  164. fi
  165. if [ ! -f flac-${FLAC_VERSION}/build-done ]; then
  166. cd flac-${FLAC_VERSION}
  167. chmod +x configure install-sh
  168. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  169. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  170. --disable-cpplibs
  171. make ${MAKE_ARGS}
  172. make install
  173. touch build-done
  174. cd ..
  175. fi
  176. # ---------------------------------------------------------------------------------------------------------------------
  177. # libsndfile
  178. if [ ! -d libsndfile-${LIBSNDFILE_VERSION} ]; then
  179. wget -c http://www.mega-nerd.com/libsndfile/files/libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  180. tar -xf libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  181. fi
  182. if [ ! -f libsndfile-${LIBSNDFILE_VERSION}/build-done ]; then
  183. cd libsndfile-${LIBSNDFILE_VERSION}
  184. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  185. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  186. --disable-full-suite --disable-alsa --disable-sqlite
  187. make ${MAKE_ARGS}
  188. make install
  189. touch build-done
  190. cd ..
  191. fi
  192. # ---------------------------------------------------------------------------------------------------------------------
  193. # libgig
  194. if [ ! -d libgig-${LIBGIG_VERSION} ]; then
  195. wget -c http://download.linuxsampler.org/packages/libgig-${LIBGIG_VERSION}.tar.bz2
  196. tar -xf libgig-${LIBGIG_VERSION}.tar.bz2
  197. fi
  198. if [ ! -f libgig-${LIBGIG_VERSION}/build-done ]; then
  199. cd libgig-${LIBGIG_VERSION}
  200. if [ ! -f patched ]; then
  201. patch -p1 -i ../patches/libgig_fix-build.patch
  202. touch patched
  203. fi
  204. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  205. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH}
  206. make ${MAKE_ARGS}
  207. make install
  208. touch build-done
  209. cd ..
  210. fi
  211. # ---------------------------------------------------------------------------------------------------------------------
  212. # linuxsampler
  213. if [ ! -d linuxsampler-${LINUXSAMPLER_VERSION} ]; then
  214. wget -c http://download.linuxsampler.org/packages/linuxsampler-${LINUXSAMPLER_VERSION}.tar.bz2
  215. tar -xf linuxsampler-${LINUXSAMPLER_VERSION}.tar.bz2
  216. fi
  217. if [ ! -f linuxsampler-${LINUXSAMPLER_VERSION}/build-done ]; then
  218. cd linuxsampler-${LINUXSAMPLER_VERSION}
  219. if [ ! -f patched ]; then
  220. patch -p1 -i ../patches/linuxsampler_allow-no-drivers-build.patch
  221. patch -p1 -i ../patches/linuxsampler_disable-ladspa-fx.patch
  222. sed -i -e "s|HAVE_LV2|HAVE_AU|" src/hostplugins/Makefile.am
  223. touch patched
  224. fi
  225. rm -f configure
  226. make -f Makefile.svn configure
  227. ./configure \
  228. --enable-static --disable-shared --prefix=${PREFIX} \
  229. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  230. --enable-signed-triang-algo=diharmonic --enable-unsigned-triang-algo=diharmonic --enable-subfragment-size=8 \
  231. --disable-alsa-driver --disable-arts-driver --disable-jack-driver \
  232. --disable-asio-driver --disable-midishare-driver --disable-mmemidi-driver \
  233. --disable-coreaudio-driver --disable-coremidi-driver \
  234. --disable-instruments-db --disable-sf2-engine
  235. make ${MAKE_ARGS}
  236. make install
  237. sed -i -e "s|-llinuxsampler|-llinuxsampler -L${PREFIX}/lib/libgig -lgig -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lm -lrpcrt4|" ${PREFIX}/lib/pkgconfig/linuxsampler.pc
  238. touch build-done
  239. cd ..
  240. fi
  241. # ------------------------------------------------------------------------------------
  242. # glib
  243. if [ ! -d glib-${GLIB_VERSION} ]; then
  244. wget -c http://caesar.ftp.acc.umu.se/pub/GNOME/sources/glib/${GLIB_MVERSION}/glib-${GLIB_VERSION}.tar.gz
  245. tar -xf glib-${GLIB_VERSION}.tar.gz
  246. fi
  247. if [ ! -f glib-${GLIB_VERSION}/build-done ]; then
  248. cd glib-${GLIB_VERSION}
  249. if [ ! -f patched ]; then
  250. patch -p1 -i ../patches/glib_skip-gettext.patch
  251. sed -i "s|po docs|po|" Makefile.in
  252. touch patched
  253. fi
  254. chmod +x configure install-sh
  255. autoconf
  256. ./configure --enable-static --disable-shared --disable-docs --prefix=${PREFIX} \
  257. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  258. --with-threads=win32
  259. make ${MAKE_ARGS}
  260. make install
  261. touch build-done
  262. cd ..
  263. fi
  264. # ---------------------------------------------------------------------------------------------------------------------
  265. # fluidsynth
  266. if [ ! -d fluidsynth-${FLUIDSYNTH_VERSION} ]; then
  267. wget -c https://download.sourceforge.net/fluidsynth/fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  268. tar -xf fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  269. fi
  270. if [ ! -f fluidsynth-${FLUIDSYNTH_VERSION}/build-done ]; then
  271. cd fluidsynth-${FLUIDSYNTH_VERSION}
  272. if [ ! -f patched ]; then
  273. patch -p1 -i ../patches/fluidsynth_fix-64-bit-cast.patch
  274. touch patched
  275. fi
  276. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  277. --target=${MINGW_PREFIX} --host=${MINGW_PREFIX} --build=${HOST_ARCH} \
  278. --enable-libsndfile-support \
  279. --disable-dbus-support --disable-aufile-support \
  280. --disable-pulse-support --disable-alsa-support --disable-portaudio-support --disable-oss-support --disable-jack-support \
  281. --disable-coreaudio --disable-coremidi --disable-dart --disable-lash --disable-ladcca \
  282. --without-readline
  283. make ${MAKE_ARGS}
  284. make install
  285. 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
  286. touch build-done
  287. cd ..
  288. fi
  289. }
  290. # ---------------------------------------------------------------------------------------------------------------------
  291. # build base libs
  292. export ARCH=32
  293. build_base
  294. cleanup_pkgs
  295. export ARCH=64
  296. build_base
  297. cleanup_pkgs
  298. # ---------------------------------------------------------------------------------------------------------------------