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.

382 lines
12KB

  1. #!/bin/bash
  2. # apt-get install build-essential autoconf libtool cmake libglib2.0-dev libgl1-mesa-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 qtbase-*
  27. rm -rf qtsvg-*
  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. aria2c 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. aria2c 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. # qt
  82. if [ ! -d qtbase-opensource-src-${QT5_VERSION} ]; then
  83. aria2c http://download.qt.io/archive/qt/${QT5_MVERSION}/${QT5_VERSION}/submodules/qtbase-opensource-src-${QT5_VERSION}.tar.xz
  84. tar xf qtbase-opensource-src-${QT5_VERSION}.tar.xz
  85. fi
  86. if [ ! -f qtbase-opensource-src-${QT5_VERSION}/build-done ]; then
  87. cd qtbase-opensource-src-${QT5_VERSION}
  88. if [ ! -f configured ]; then
  89. ./configure -release -strip -silent \
  90. -sse2 \
  91. -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \
  92. -no-avx -no-avx2 -no-avx512 \
  93. -prefix ${PREFIX} \
  94. -opensource -confirm-license \
  95. -optimize-size -optimized-qmake \
  96. -qt-freetype \
  97. -qt-harfbuzz \
  98. -qt-libjpeg \
  99. -qt-libpng \
  100. -qt-pcre \
  101. -qt-sqlite \
  102. -qt-xcb \
  103. -qt-zlib \
  104. -opengl desktop \
  105. -no-cups \
  106. -no-gtk \
  107. -no-icu \
  108. -no-openssl \
  109. -make libs \
  110. -make tools \
  111. -nomake examples \
  112. -nomake tests
  113. touch configured
  114. fi
  115. make ${MAKE_ARGS}
  116. make install
  117. touch build-done
  118. cd ..
  119. fi
  120. # ---------------------------------------------------------------------------------------------------------------------
  121. # qt5-svg
  122. if [ ! -d qtsvg-opensource-src-${QT5_VERSION} ]; then
  123. aria2c http://download.qt.io/archive/qt/${QT5_MVERSION}/${QT5_VERSION}/submodules/qtsvg-opensource-src-${QT5_VERSION}.tar.xz
  124. tar xf qtsvg-opensource-src-${QT5_VERSION}.tar.xz
  125. fi
  126. if [ ! -f qtsvg-opensource-src-${QT5_VERSION}/build-done ]; then
  127. cd qtsvg-opensource-src-${QT5_VERSION}
  128. qmake
  129. make ${MAKE_ARGS}
  130. make install
  131. touch build-done
  132. cd ..
  133. fi
  134. # ---------------------------------------------------------------------------------------------------------------------
  135. # zlib
  136. if [ ! -d zlib-${ZLIB_VERSION} ]; then
  137. aria2c https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz
  138. tar -xf zlib-${ZLIB_VERSION}.tar.gz
  139. fi
  140. if [ ! -f zlib-${ZLIB_VERSION}/build-done ]; then
  141. cd zlib-${ZLIB_VERSION}
  142. ./configure --static --prefix=${PREFIX}
  143. make ${MAKE_ARGS}
  144. make install
  145. touch build-done
  146. cd ..
  147. fi
  148. # ---------------------------------------------------------------------------------------------------------------------
  149. # file/magic
  150. if [ ! -d file-${FILE_VERSION} ]; then
  151. wget ftp://ftp.astron.com/pub/file/file-${FILE_VERSION}.tar.gz
  152. tar -xf file-${FILE_VERSION}.tar.gz
  153. fi
  154. if [ ! -f file-${FILE_VERSION}/build-done ]; then
  155. cd file-${FILE_VERSION}
  156. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  157. make ${MAKE_ARGS}
  158. make install
  159. touch build-done
  160. cd ..
  161. fi
  162. # ---------------------------------------------------------------------------------------------------------------------
  163. # libogg
  164. if [ ! -d libogg-${LIBOGG_VERSION} ]; then
  165. aria2c https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
  166. tar -xf libogg-${LIBOGG_VERSION}.tar.gz
  167. fi
  168. if [ ! -f libogg-${LIBOGG_VERSION}/build-done ]; then
  169. cd libogg-${LIBOGG_VERSION}
  170. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  171. make ${MAKE_ARGS}
  172. make install
  173. touch build-done
  174. cd ..
  175. fi
  176. # ---------------------------------------------------------------------------------------------------------------------
  177. # libvorbis
  178. if [ ! -d libvorbis-${LIBVORBIS_VERSION} ]; then
  179. aria2c https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
  180. tar -xf libvorbis-${LIBVORBIS_VERSION}.tar.gz
  181. fi
  182. if [ ! -f libvorbis-${LIBVORBIS_VERSION}/build-done ]; then
  183. cd libvorbis-${LIBVORBIS_VERSION}
  184. ./configure --enable-static --disable-shared --prefix=${PREFIX}
  185. make ${MAKE_ARGS}
  186. make install
  187. touch build-done
  188. cd ..
  189. fi
  190. # ---------------------------------------------------------------------------------------------------------------------
  191. # flac
  192. if [ ! -d flac-${FLAC_VERSION} ]; then
  193. aria2c https://ftp.osuosl.org/pub/xiph/releases/flac/flac-${FLAC_VERSION}.tar.xz
  194. tar -xf flac-${FLAC_VERSION}.tar.xz
  195. fi
  196. if [ ! -f flac-${FLAC_VERSION}/build-done ]; then
  197. cd flac-${FLAC_VERSION}
  198. chmod +x configure install-sh
  199. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  200. --disable-cpplibs
  201. make ${MAKE_ARGS}
  202. make install
  203. touch build-done
  204. cd ..
  205. fi
  206. # ---------------------------------------------------------------------------------------------------------------------
  207. # libsndfile
  208. if [ ! -d libsndfile-${LIBSNDFILE_VERSION} ]; then
  209. wget http://www.mega-nerd.com/libsndfile/files/libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  210. tar -xf libsndfile-${LIBSNDFILE_VERSION}.tar.gz
  211. fi
  212. if [ ! -f libsndfile-${LIBSNDFILE_VERSION}/build-done ]; then
  213. cd libsndfile-${LIBSNDFILE_VERSION}
  214. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  215. --disable-full-suite --disable-alsa --disable-sqlite
  216. make ${MAKE_ARGS}
  217. make install
  218. touch build-done
  219. cd ..
  220. fi
  221. # ---------------------------------------------------------------------------------------------------------------------
  222. # glib
  223. if [ ! -d ${PREFIX}/include/glib-2.0 ]; then
  224. cp -r /usr/include/glib-2.0 ${PREFIX}/include/
  225. fi
  226. if [ ! -f ${PREFIX}/lib/pkgconfig/glib-2.0.pc ]; then
  227. if [ -f /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc ]; then
  228. cp /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc ${PREFIX}/lib/pkgconfig/
  229. cp /usr/lib/x86_64-linux-gnu/pkgconfig/gthread-2.0.pc ${PREFIX}/lib/pkgconfig/
  230. cp /usr/lib/x86_64-linux-gnu/pkgconfig/libpcre.pc ${PREFIX}/lib/pkgconfig/
  231. else
  232. cp /usr/lib/pkgconfig/glib-2.0.pc ${PREFIX}/lib/pkgconfig/
  233. cp /usr/lib/pkgconfig/gthread-2.0.pc ${PREFIX}/lib/pkgconfig/
  234. fi
  235. fi
  236. # ---------------------------------------------------------------------------------------------------------------------
  237. # fluidsynth
  238. if [ ! -d fluidsynth-${FLUIDSYNTH_VERSION} ]; then
  239. aria2c https://github.com/FluidSynth/fluidsynth/archive/v${FLUIDSYNTH_VERSION}.tar.gz
  240. tar -xf fluidsynth-${FLUIDSYNTH_VERSION}.tar.gz
  241. fi
  242. if [ ! -f fluidsynth-${FLUIDSYNTH_VERSION}/build-done ]; then
  243. cd fluidsynth-${FLUIDSYNTH_VERSION}
  244. if [ ! -f patched ]; then
  245. patch -p1 -i ../../patches/fluidsynth-skip-drivers-build.patch
  246. touch patched
  247. fi
  248. sed -i "s/3.0.2/2.8.0/" CMakeLists.txt
  249. sed -i 's/_init_lib_suffix "64"/_init_lib_suffix ""/' CMakeLists.txt
  250. cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_SHARED_LIBS=OFF \
  251. -Denable-debug=OFF -Denable-profiling=OFF -Denable-ladspa=OFF -Denable-fpe-check=OFF -Denable-portaudio=OFF \
  252. -Denable-trap-on-fpe=OFF -Denable-aufile=OFF -Denable-dbus=OFF -Denable-ipv6=OFF -Denable-jack=OFF \
  253. -Denable-midishare=OFF -Denable-oss=OFF -Denable-pulseaudio=OFF -Denable-readline=OFF -Denable-ladcca=OFF \
  254. -Denable-lash=OFF -Denable-alsa=OFF -Denable-coreaudio=OFF -Denable-coremidi=OFF -Denable-framework=OFF \
  255. -Denable-floats=ON
  256. make ${MAKE_ARGS}
  257. make install
  258. sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" ${PREFIX}/lib/pkgconfig/fluidsynth.pc
  259. touch build-done
  260. cd ..
  261. fi
  262. # ---------------------------------------------------------------------------------------------------------------------
  263. # mxml
  264. if [ ! -d mxml-${MXML_VERSION} ]; then
  265. aria2c https://github.com/michaelrsweet/mxml/releases/download/v${MXML_VERSION}/mxml-${MXML_VERSION}.tar.gz
  266. tar -xf mxml-${MXML_VERSION}.tar.gz
  267. fi
  268. if [ ! -f mxml-${MXML_VERSION}/build-done ]; then
  269. cd mxml-${MXML_VERSION}
  270. ./configure --disable-shared --prefix=$PREFIX
  271. make libmxml.a
  272. cp *.a $PREFIX/lib/
  273. cp *.pc $PREFIX/lib/pkgconfig/
  274. cp mxml.h $PREFIX/include/
  275. touch build-done
  276. cd ..
  277. fi
  278. # ---------------------------------------------------------------------------------------------------------------------
  279. # fftw3 (needs to be last as it modifies C[XX]FLAGS)
  280. if [ ! -d fftw-${FFTW3_VERSION} ]; then
  281. aria2c http://www.fftw.org/fftw-${FFTW3_VERSION}.tar.gz
  282. tar -xf fftw-${FFTW3_VERSION}.tar.gz
  283. fi
  284. if [ ! -f fftw-${FFTW3_VERSION}/build-done ]; then
  285. export CFLAGS="${CFLAGS} -ffast-math"
  286. export CXXFLAGS="${CXXFLAGS} -ffast-math"
  287. cd fftw-${FFTW3_VERSION}
  288. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  289. --enable-sse2 \
  290. --disable-debug --disable-alloca --disable-fortran \
  291. --with-our-malloc
  292. make
  293. make install
  294. make clean
  295. ./configure --enable-static --disable-shared --prefix=${PREFIX} \
  296. --enable-sse2 --enable-sse --enable-single \
  297. --disable-debug --disable-alloca --disable-fortran \
  298. --with-our-malloc
  299. make
  300. make install
  301. make clean
  302. touch build-done
  303. cd ..
  304. fi
  305. }
  306. # ---------------------------------------------------------------------------------------------------------------------
  307. # build base libs
  308. export ARCH=32
  309. export TARGET="${1}"
  310. build_base
  311. if [ x"${TARGET}" != x"32" ]; then
  312. export ARCH=64
  313. build_base
  314. fi
  315. # ---------------------------------------------------------------------------------------------------------------------