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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. #!/bin/bash
  2. # apt-get install build-essential libglib2.0-dev uuid-dev
  3. # ---------------------------------------------------------------------------------------------------------------------
  4. # stop on error
  5. set -e
  6. # ---------------------------------------------------------------------------------------------------------------------
  7. # cd to correct path
  8. cd $(dirname $0)
  9. # ---------------------------------------------------------------------------------------------------------------------
  10. # set variables
  11. source common.env
  12. # ---------------------------------------------------------------------------------------------------------------------
  13. # function to remove old stuff
  14. cleanup()
  15. {
  16. rm -rf ${TARGETDIR}/carla32/ ${TARGETDIR}/carla64/
  17. rm -rf file-*
  18. rm -rf flac-*
  19. rm -rf fltk-*
  20. rm -rf fluidsynth-*
  21. rm -rf libgig-*
  22. rm -rf liblo-*
  23. rm -rf libogg-*
  24. rm -rf libsndfile-*
  25. rm -rf libvorbis-*
  26. rm -rf linuxsampler-*
  27. rm -rf pkg-config-*
  28. rm -rf zlib-*
  29. }
  30. # ---------------------------------------------------------------------------------------------------------------------
  31. # function to build base libs
  32. build_base()
  33. {
  34. export CC=gcc
  35. export CXX=g++
  36. export PREFIX=${TARGETDIR}/carla${ARCH}
  37. export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  38. export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
  39. export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
  40. export CFLAGS="${CFLAGS} -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -m${ARCH}"
  41. export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
  42. export LDFLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
  43. export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -m${ARCH}"
  44. # ---------------------------------------------------------------------------------------------------------------------
  45. # pkgconfig
  46. if [ ! -d pkg-config-${PKG_CONFIG_VERSION} ]; then
  47. wget --no-check-certificate https://pkg-config.freedesktop.org/releases/pkg-config-${PKG_CONFIG_VERSION}.tar.gz
  48. tar -xf pkg-config-${PKG_CONFIG_VERSION}.tar.gz
  49. fi
  50. if [ ! -f pkg-config-${PKG_CONFIG_VERSION}_$ARCH/build-done ]; then
  51. cp -r pkg-config-${PKG_CONFIG_VERSION} pkg-config-${PKG_CONFIG_VERSION}_$ARCH
  52. cd pkg-config-${PKG_CONFIG_VERSION}_$ARCH
  53. ./configure --enable-indirect-deps --with-internal-glib --with-pc-path=$PKG_CONFIG_PATH --prefix=${PREFIX}
  54. make ${MAKE_ARGS}
  55. make install
  56. touch build-done
  57. cd ..
  58. fi
  59. # ---------------------------------------------------------------------------------------------------------------------
  60. # liblo
  61. if [ ! -d liblo-${LIBLO_VERSION} ]; then
  62. wget --no-check-certificate https://download.sourceforge.net/liblo/liblo-${LIBLO_VERSION}.tar.gz
  63. tar -xf liblo-${LIBLO_VERSION}.tar.gz
  64. fi
  65. if [ ! -f liblo-${LIBLO_VERSION}_$ARCH/build-done ]; then
  66. cp -r liblo-${LIBLO_VERSION} liblo-${LIBLO_VERSION}_$ARCH
  67. cd liblo-${LIBLO_VERSION}_$ARCH
  68. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  69. --enable-threads \
  70. --disable-examples --disable-tools
  71. make ${MAKE_ARGS}
  72. make install
  73. touch build-done
  74. cd ..
  75. fi
  76. # ---------------------------------------------------------------------------------------------------------------------
  77. if [ x"${ARCH}" = x"32" ] && [ x"${TARGET}" != x"32" ]; then
  78. return
  79. fi
  80. # ---------------------------------------------------------------------------------------------------------------------
  81. # zlib
  82. if [ ! -d zlib-${ZLIB_VERSION} ]; then
  83. wget --no-check-certificate https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz -O zlib-${ZLIB_VERSION}.tar.gz
  84. tar -xf zlib-${ZLIB_VERSION}.tar.gz
  85. fi
  86. if [ ! -f zlib-${ZLIB_VERSION}/build-done ]; then
  87. cd zlib-${ZLIB_VERSION}
  88. ./configure --static --prefix=${PREFIX}
  89. make ${MAKE_ARGS}
  90. make install
  91. touch build-done
  92. cd ..
  93. fi
  94. # ---------------------------------------------------------------------------------------------------------------------
  95. # file/magic
  96. if [ ! -d file-${FILE_VERSION} ]; then
  97. wget ftp://ftp.astron.com/pub/file/file-${FILE_VERSION}.tar.gz
  98. tar -xf file-${FILE_VERSION}.tar.gz
  99. fi
  100. if [ ! -f file-${FILE_VERSION}/build-done ]; then
  101. cd file-${FILE_VERSION}
  102. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  103. make ${MAKE_ARGS}
  104. make install
  105. touch build-done
  106. cd ..
  107. fi
  108. # ---------------------------------------------------------------------------------------------------------------------
  109. # libogg
  110. if [ ! -d libogg-${LIBOGG_VERSION} ]; then
  111. wget --no-check-certificate https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
  112. tar -xf libogg-${LIBOGG_VERSION}.tar.gz
  113. fi
  114. if [ ! -f libogg-${LIBOGG_VERSION}/build-done ]; then
  115. cd libogg-${LIBOGG_VERSION}
  116. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  117. make ${MAKE_ARGS}
  118. make install
  119. touch build-done
  120. cd ..
  121. fi
  122. # ---------------------------------------------------------------------------------------------------------------------
  123. # libvorbis
  124. if [ ! -d libvorbis-${LIBVORBIS_VERSION} ]; then
  125. wget --no-check-certificate https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
  126. tar -xf libvorbis-${LIBVORBIS_VERSION}.tar.gz
  127. fi
  128. if [ ! -f libvorbis-${LIBVORBIS_VERSION}/build-done ]; then
  129. cd libvorbis-${LIBVORBIS_VERSION}
  130. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  131. make ${MAKE_ARGS}
  132. make install
  133. touch build-done
  134. cd ..
  135. fi
  136. # ---------------------------------------------------------------------------------------------------------------------
  137. # flac
  138. if [ ! -d flac-${FLAC_VERSION} ]; then
  139. wget --no-check-certificate https://svn.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz
  140. tar -xf flac-${FLAC_VERSION}.tar.xz
  141. fi
  142. if [ ! -f flac-${FLAC_VERSION}/build-done ]; then
  143. cd flac-${FLAC_VERSION}
  144. chmod +x configure install-sh
  145. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  146. --disable-cpplibs
  147. make ${MAKE_ARGS}
  148. make install
  149. touch build-done
  150. cd ..
  151. fi
  152. # ---------------------------------------------------------------------------------------------------------------------
  153. # libsndfile
  154. if [ ! -d libsndfile-${LIBSNDFILE_VERSION} ]; then
  155. wget http://www.mega-nerd.com/libsndfile/files/libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  156. tar -xf libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  157. fi
  158. if [ ! -f libsndfile-${LIBSNDFILE_VERSION}/build-done ]; then
  159. cd libsndfile-${LIBSNDFILE_VERSION}
  160. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  161. --disable-full-suite --disable-alsa --disable-sqlite
  162. make ${MAKE_ARGS}
  163. make install
  164. touch build-done
  165. cd ..
  166. fi
  167. # ---------------------------------------------------------------------------------------------------------------------
  168. # libgig
  169. if [ ! -d libgig-${LIBGIG_VERSION} ]; then
  170. wget http://download.linuxsampler.org/packages/libgig-${LIBGIG_VERSION}.tar.bz2
  171. tar -xf libgig-${LIBGIG_VERSION}.tar.bz2
  172. fi
  173. if [ ! -f libgig-${LIBGIG_VERSION}/build-done ]; then
  174. cd libgig-${LIBGIG_VERSION}
  175. if [ ! -f patched ]; then
  176. patch -p1 -i ../patches/libgig_fix-build.patch
  177. touch patched
  178. fi
  179. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  180. make ${MAKE_ARGS}
  181. make install
  182. touch build-done
  183. cd ..
  184. fi
  185. # ---------------------------------------------------------------------------------------------------------------------
  186. # linuxsampler
  187. if [ ! -d linuxsampler-${LINUXSAMPLER_VERSION} ]; then
  188. wget http://download.linuxsampler.org/packages/linuxsampler-${LINUXSAMPLER_VERSION}.tar.bz2
  189. tar -xf linuxsampler-${LINUXSAMPLER_VERSION}.tar.bz2
  190. fi
  191. if [ ! -f linuxsampler-${LINUXSAMPLER_VERSION}/build-done ]; then
  192. cd linuxsampler-${LINUXSAMPLER_VERSION}
  193. if [ ! -f patched ]; then
  194. patch -p1 -i ../patches/linuxsampler_allow-no-drivers-build.patch
  195. patch -p1 -i ../patches/linuxsampler_disable-ladspa-fx.patch
  196. touch patched
  197. fi
  198. rm -f configure
  199. make -f Makefile.svn configure
  200. ./configure \
  201. --enable-static --disable-shared --prefix=${PREFIX} \
  202. --enable-signed-triang-algo=diharmonic --enable-unsigned-triang-algo=diharmonic --enable-subfragment-size=8 \
  203. --disable-alsa-driver --disable-arts-driver --disable-jack-driver \
  204. --disable-asio-driver --disable-midishare-driver --disable-mmemidi-driver \
  205. --disable-coreaudio-driver --disable-coremidi-driver \
  206. --disable-instruments-db --disable-sf2-engine
  207. make ${MAKE_ARGS}
  208. make install
  209. sed -i -e "s|-llinuxsampler|-llinuxsampler -L${PREFIX}/lib/libgig -lgig -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" ${PREFIX}/lib/pkgconfig/linuxsampler.pc
  210. touch build-done
  211. cd ..
  212. fi
  213. # ---------------------------------------------------------------------------------------------------------------------
  214. # glib
  215. if [ ! -d ${PREFIX}/include/glib-2.0 ]; then
  216. cp -r /usr/include/glib-2.0 ${PREFIX}/include/
  217. fi
  218. if [ ! -f ${PREFIX}/lib/pkgconfig/glib-2.0.pc ]; then
  219. if [ -f /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc ]; then
  220. cp /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc ${PREFIX}/lib/pkgconfig/
  221. cp /usr/lib/x86_64-linux-gnu/pkgconfig/gthread-2.0.pc ${PREFIX}/lib/pkgconfig/
  222. cp /usr/lib/x86_64-linux-gnu/pkgconfig/libpcre.pc ${PREFIX}/lib/pkgconfig/
  223. else
  224. cp /usr/lib/pkgconfig/glib-2.0.pc ${PREFIX}/lib/pkgconfig/
  225. cp /usr/lib/pkgconfig/gthread-2.0.pc ${PREFIX}/lib/pkgconfig/
  226. fi
  227. fi
  228. # ---------------------------------------------------------------------------------------------------------------------
  229. # fluidsynth
  230. if [ ! -d fluidsynth-${FLUIDSYNTH_VERSION} ]; then
  231. wget --no-check-certificate https://download.sourceforge.net/fluidsynth/fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  232. tar -xf fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  233. fi
  234. if [ ! -f fluidsynth-${FLUIDSYNTH_VERSION}/build-done ]; then
  235. cd fluidsynth-${FLUIDSYNTH_VERSION}
  236. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  237. --enable-libsndfile-support \
  238. --disable-dbus-support --disable-aufile-support \
  239. --disable-pulse-support --disable-alsa-support --disable-portaudio-support --disable-oss-support --disable-jack-support \
  240. --disable-coreaudio --disable-coremidi --disable-dart --disable-lash --disable-ladcca \
  241. --without-readline
  242. make ${MAKE_ARGS}
  243. make install
  244. sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" ${PREFIX}/lib/pkgconfig/fluidsynth.pc
  245. touch build-done
  246. cd ..
  247. fi
  248. }
  249. # ---------------------------------------------------------------------------------------------------------------------
  250. # build base libs
  251. export ARCH=32
  252. export TARGET="${1}"
  253. build_base
  254. if [ x"${TARGET}" != x"32" ]; then
  255. export ARCH=64
  256. build_base
  257. fi
  258. # ---------------------------------------------------------------------------------------------------------------------