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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 liblo-*
  22. rm -rf libogg-*
  23. rm -rf libsndfile-*
  24. rm -rf libvorbis-*
  25. rm -rf pkg-config-*
  26. rm -rf zlib-*
  27. }
  28. # ---------------------------------------------------------------------------------------------------------------------
  29. # function to build base libs
  30. build_base()
  31. {
  32. export CC=gcc
  33. export CXX=g++
  34. export PREFIX=${TARGETDIR}/carla${ARCH}
  35. export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  36. export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
  37. export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
  38. export CFLAGS="${CFLAGS} -fPIC -DPIC -DNDEBUG -I${PREFIX}/include -m${ARCH}"
  39. export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
  40. export LDFLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
  41. export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -m${ARCH}"
  42. # ---------------------------------------------------------------------------------------------------------------------
  43. # pkgconfig
  44. if [ ! -d pkg-config-${PKG_CONFIG_VERSION} ]; then
  45. aria2c https://pkg-config.freedesktop.org/releases/pkg-config-${PKG_CONFIG_VERSION}.tar.gz
  46. tar -xf pkg-config-${PKG_CONFIG_VERSION}.tar.gz
  47. fi
  48. if [ ! -f pkg-config-${PKG_CONFIG_VERSION}_$ARCH/build-done ]; then
  49. cp -r pkg-config-${PKG_CONFIG_VERSION} pkg-config-${PKG_CONFIG_VERSION}_$ARCH
  50. cd pkg-config-${PKG_CONFIG_VERSION}_$ARCH
  51. ./configure --enable-indirect-deps --with-internal-glib --with-pc-path=$PKG_CONFIG_PATH --prefix=${PREFIX}
  52. make ${MAKE_ARGS}
  53. make install
  54. touch build-done
  55. cd ..
  56. fi
  57. # ---------------------------------------------------------------------------------------------------------------------
  58. # liblo
  59. if [ ! -d liblo-${LIBLO_VERSION} ]; then
  60. aria2c https://download.sourceforge.net/liblo/liblo-${LIBLO_VERSION}.tar.gz
  61. tar -xf liblo-${LIBLO_VERSION}.tar.gz
  62. fi
  63. if [ ! -f liblo-${LIBLO_VERSION}_$ARCH/build-done ]; then
  64. cp -r liblo-${LIBLO_VERSION} liblo-${LIBLO_VERSION}_$ARCH
  65. cd liblo-${LIBLO_VERSION}_$ARCH
  66. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  67. --enable-threads \
  68. --disable-examples --disable-tools
  69. make ${MAKE_ARGS}
  70. make install
  71. touch build-done
  72. cd ..
  73. fi
  74. # ---------------------------------------------------------------------------------------------------------------------
  75. if [ x"${ARCH}" = x"32" ] && [ x"${TARGET}" != x"32" ]; then
  76. return
  77. fi
  78. # ---------------------------------------------------------------------------------------------------------------------
  79. # zlib
  80. if [ ! -d zlib-${ZLIB_VERSION} ]; then
  81. aria2c https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz
  82. tar -xf zlib-${ZLIB_VERSION}.tar.gz
  83. fi
  84. if [ ! -f zlib-${ZLIB_VERSION}/build-done ]; then
  85. cd zlib-${ZLIB_VERSION}
  86. ./configure --static --prefix=${PREFIX}
  87. make ${MAKE_ARGS}
  88. make install
  89. touch build-done
  90. cd ..
  91. fi
  92. # ---------------------------------------------------------------------------------------------------------------------
  93. # file/magic
  94. if [ ! -d file-${FILE_VERSION} ]; then
  95. wget ftp://ftp.astron.com/pub/file/file-${FILE_VERSION}.tar.gz
  96. tar -xf file-${FILE_VERSION}.tar.gz
  97. fi
  98. if [ ! -f file-${FILE_VERSION}/build-done ]; then
  99. cd file-${FILE_VERSION}
  100. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  101. make ${MAKE_ARGS}
  102. make install
  103. touch build-done
  104. cd ..
  105. fi
  106. # ---------------------------------------------------------------------------------------------------------------------
  107. # libogg
  108. if [ ! -d libogg-${LIBOGG_VERSION} ]; then
  109. aria2c https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
  110. tar -xf libogg-${LIBOGG_VERSION}.tar.gz
  111. fi
  112. if [ ! -f libogg-${LIBOGG_VERSION}/build-done ]; then
  113. cd libogg-${LIBOGG_VERSION}
  114. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  115. make ${MAKE_ARGS}
  116. make install
  117. touch build-done
  118. cd ..
  119. fi
  120. # ---------------------------------------------------------------------------------------------------------------------
  121. # libvorbis
  122. if [ ! -d libvorbis-${LIBVORBIS_VERSION} ]; then
  123. aria2c https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
  124. tar -xf libvorbis-${LIBVORBIS_VERSION}.tar.gz
  125. fi
  126. if [ ! -f libvorbis-${LIBVORBIS_VERSION}/build-done ]; then
  127. cd libvorbis-${LIBVORBIS_VERSION}
  128. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  129. make ${MAKE_ARGS}
  130. make install
  131. touch build-done
  132. cd ..
  133. fi
  134. # ---------------------------------------------------------------------------------------------------------------------
  135. # flac
  136. if [ ! -d flac-${FLAC_VERSION} ]; then
  137. aria2c https://svn.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz
  138. tar -xf flac-${FLAC_VERSION}.tar.xz
  139. fi
  140. if [ ! -f flac-${FLAC_VERSION}/build-done ]; then
  141. cd flac-${FLAC_VERSION}
  142. chmod +x configure install-sh
  143. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  144. --disable-cpplibs
  145. make ${MAKE_ARGS}
  146. make install
  147. touch build-done
  148. cd ..
  149. fi
  150. # ---------------------------------------------------------------------------------------------------------------------
  151. # libsndfile
  152. if [ ! -d libsndfile-${LIBSNDFILE_VERSION} ]; then
  153. wget http://www.mega-nerd.com/libsndfile/files/libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  154. tar -xf libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  155. fi
  156. if [ ! -f libsndfile-${LIBSNDFILE_VERSION}/build-done ]; then
  157. cd libsndfile-${LIBSNDFILE_VERSION}
  158. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  159. --disable-full-suite --disable-alsa --disable-sqlite
  160. make ${MAKE_ARGS}
  161. make install
  162. touch build-done
  163. cd ..
  164. fi
  165. # ---------------------------------------------------------------------------------------------------------------------
  166. # glib
  167. if [ ! -d ${PREFIX}/include/glib-2.0 ]; then
  168. cp -r /usr/include/glib-2.0 ${PREFIX}/include/
  169. fi
  170. if [ ! -f ${PREFIX}/lib/pkgconfig/glib-2.0.pc ]; then
  171. if [ -f /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc ]; then
  172. cp /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc ${PREFIX}/lib/pkgconfig/
  173. cp /usr/lib/x86_64-linux-gnu/pkgconfig/gthread-2.0.pc ${PREFIX}/lib/pkgconfig/
  174. cp /usr/lib/x86_64-linux-gnu/pkgconfig/libpcre.pc ${PREFIX}/lib/pkgconfig/
  175. else
  176. cp /usr/lib/pkgconfig/glib-2.0.pc ${PREFIX}/lib/pkgconfig/
  177. cp /usr/lib/pkgconfig/gthread-2.0.pc ${PREFIX}/lib/pkgconfig/
  178. fi
  179. fi
  180. # ---------------------------------------------------------------------------------------------------------------------
  181. # fluidsynth
  182. if [ ! -d fluidsynth-${FLUIDSYNTH_VERSION} ]; then
  183. aria2c https://download.sourceforge.net/fluidsynth/fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  184. tar -xf fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  185. fi
  186. if [ ! -f fluidsynth-${FLUIDSYNTH_VERSION}/build-done ]; then
  187. cd fluidsynth-${FLUIDSYNTH_VERSION}
  188. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  189. --enable-libsndfile-support \
  190. --disable-dbus-support --disable-aufile-support \
  191. --disable-pulse-support --disable-alsa-support --disable-portaudio-support --disable-oss-support --disable-jack-support \
  192. --disable-coreaudio --disable-coremidi --disable-dart --disable-lash --disable-ladcca \
  193. --without-readline
  194. make ${MAKE_ARGS}
  195. make install
  196. sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" ${PREFIX}/lib/pkgconfig/fluidsynth.pc
  197. touch build-done
  198. cd ..
  199. fi
  200. # ---------------------------------------------------------------------------------------------------------------------
  201. # mxml
  202. if [ ! -d mxml-${MXML_VERSION} ]; then
  203. aria2c https://github.com/michaelrsweet/mxml/releases/download/v${MXML_VERSION}/mxml-${MXML_VERSION}.tar.gz
  204. mkdir mxml-${MXML_VERSION}
  205. cd mxml-${MXML_VERSION}
  206. tar -xf ../mxml-${MXML_VERSION}.tar.gz
  207. cd ..
  208. fi
  209. if [ ! -f mxml-${MXML_VERSION}/build-done ]; then
  210. cd mxml-${MXML_VERSION}
  211. ./configure --disable-shared --prefix=$PREFIX
  212. make libmxml.a
  213. cp *.a $PREFIX/lib/
  214. cp *.pc $PREFIX/lib/pkgconfig/
  215. cp mxml.h $PREFIX/include/
  216. touch build-done
  217. cd ..
  218. fi
  219. # ---------------------------------------------------------------------------------------------------------------------
  220. # fftw3 (needs to be last as it modifies C[XX]FLAGS)
  221. if [ ! -d fftw-${FFTW3_VERSION} ]; then
  222. aria2c http://www.fftw.org/fftw-${FFTW3_VERSION}.tar.gz
  223. tar -xf fftw-${FFTW3_VERSION}.tar.gz
  224. fi
  225. if [ ! -f fftw-${FFTW3_VERSION}/build-done ]; then
  226. export CFLAGS="${CFLAGS} -ffast-math"
  227. export CXXFLAGS="${CXXFLAGS} -ffast-math"
  228. cd fftw-${FFTW3_VERSION}
  229. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  230. --enable-sse2 \
  231. --disable-debug --disable-alloca --disable-fortran \
  232. --with-our-malloc
  233. make
  234. make install
  235. make clean
  236. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  237. --enable-sse2 --enable-sse --enable-single \
  238. --disable-debug --disable-alloca --disable-fortran \
  239. --with-our-malloc
  240. make
  241. make install
  242. make clean
  243. touch build-done
  244. cd ..
  245. fi
  246. }
  247. # ---------------------------------------------------------------------------------------------------------------------
  248. # build base libs
  249. export ARCH=32
  250. export TARGET="${1}"
  251. build_base
  252. if [ x"${TARGET}" != x"32" ]; then
  253. export ARCH=64
  254. build_base
  255. fi
  256. # ---------------------------------------------------------------------------------------------------------------------