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.

528 lines
15KB

  1. #!/bin/bash
  2. # ------------------------------------------------------------------------------------
  3. # stop on error
  4. set -e
  5. # ------------------------------------------------------------------------------------
  6. # cd to correct path
  7. if [ -f Makefile ]; then
  8. cd data/macos
  9. fi
  10. # ------------------------------------------------------------------------------------
  11. # function to remove old stuff
  12. cleanup()
  13. {
  14. sudo rm -rf /opt/carla32/ /opt/carla64/
  15. sudo rm -rf cx_Freeze-*
  16. sudo rm -rf Python-*
  17. rm -rf fftw-*
  18. rm -rf liblo-*
  19. rm -rf mxml-*
  20. rm -rf pkg-config-*
  21. rm -rf PyQt-*
  22. rm -rf qtbase-*
  23. rm -rf qtmacextras-*
  24. rm -rf qtsvg-*
  25. rm -rf sip-*
  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 CFLAGS="-O2 -mtune=generic -msse -msse2 -m$ARCH -fPIC -DPIC"
  35. export CXXFLAGS=$CFLAGS
  36. export LDFLAGS="-m$ARCH"
  37. export PREFIX=/opt/carla$ARCH
  38. export PATH=$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  39. export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
  40. # ------------------------------------------------------------------------------------
  41. # pkgconfig
  42. if [ ! -d pkg-config-0.28 ]; then
  43. curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
  44. tar -xf pkg-config-0.28.tar.gz
  45. fi
  46. if [ ! -f pkg-config-0.28_$ARCH/build-done ]; then
  47. cp -r pkg-config-0.28 pkg-config-0.28_$ARCH
  48. cd pkg-config-0.28_$ARCH
  49. ./configure --enable-indirect-deps --with-internal-glib --with-pc-path=$PKG_CONFIG_PATH --prefix=$PREFIX
  50. make
  51. sudo make install
  52. touch build-done
  53. cd ..
  54. fi
  55. # ------------------------------------------------------------------------------------
  56. # liblo
  57. if [ ! -d liblo-0.28 ]; then
  58. curl -L http://download.sourceforge.net/liblo/liblo-0.28.tar.gz -o liblo-0.28.tar.gz
  59. tar -xf liblo-0.28.tar.gz
  60. fi
  61. if [ ! -f liblo-0.28_$ARCH/build-done ]; then
  62. cp -r liblo-0.28 liblo-0.28_$ARCH
  63. cd liblo-0.28_$ARCH
  64. ./configure --enable-static --disable-shared --prefix=$PREFIX
  65. make
  66. sudo make install
  67. touch build-done
  68. cd ..
  69. fi
  70. # ------------------------------------------------------------------------------------
  71. if [ "$ARCH" == "32" ]; then
  72. return
  73. fi
  74. # ------------------------------------------------------------------------------------
  75. # zlib
  76. if [ ! -d zlib-1.2.8 ]; then
  77. curl -O http://zlib.net/zlib-1.2.8.tar.gz
  78. tar -xf zlib-1.2.8.tar.gz
  79. fi
  80. if [ ! -f zlib-1.2.8/build-done ]; then
  81. cd zlib-1.2.8
  82. ./configure --static --prefix=$PREFIX
  83. make
  84. sudo make install
  85. touch build-done
  86. cd ..
  87. fi
  88. # ------------------------------------------------------------------------------------
  89. # mxml
  90. if [ ! -d mxml-2.8 ]; then
  91. curl -O http://www.msweet.org/files/project3/mxml-2.8.tar.gz
  92. tar -xf mxml-2.8.tar.gz
  93. fi
  94. if [ ! -f mxml-2.8/build-done ]; then
  95. cd mxml-2.8
  96. ./configure --enable-static --disable-shared --prefix=$PREFIX
  97. make
  98. sudo cp *.a $PREFIX/lib/
  99. sudo cp *.pc $PREFIX/lib/pkgconfig/
  100. sudo cp mxml.h $PREFIX/include/
  101. touch build-done
  102. cd ..
  103. fi
  104. # ------------------------------------------------------------------------------------
  105. # libogg
  106. if [ ! -d libogg-1.3.2 ]; then
  107. curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
  108. tar -xf libogg-1.3.2.tar.gz
  109. fi
  110. if [ ! -f libogg-1.3.2/build-done ]; then
  111. cd libogg-1.3.2
  112. ./configure --enable-static --disable-shared --prefix=$PREFIX
  113. make
  114. sudo make install
  115. touch build-done
  116. cd ..
  117. fi
  118. # ------------------------------------------------------------------------------------
  119. # libvorbis
  120. if [ ! -d libvorbis-1.3.4 ]; then
  121. curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
  122. tar -xf libvorbis-1.3.4.tar.gz
  123. fi
  124. if [ ! -f libvorbis-1.3.4/build-done ]; then
  125. cd libvorbis-1.3.4
  126. ./configure --enable-static --disable-shared --prefix=$PREFIX
  127. make
  128. sudo make install
  129. touch build-done
  130. cd ..
  131. fi
  132. # ------------------------------------------------------------------------------------
  133. # flac
  134. if [ ! -d flac-1.3.0 ]; then
  135. curl -O https://svn.xiph.org/releases/flac/flac-1.3.0.tar.xz
  136. /opt/local/bin/7z x flac-1.3.0.tar.xz
  137. /opt/local/bin/7z x flac-1.3.0.tar
  138. fi
  139. if [ ! -f flac-1.3.0/build-done ]; then
  140. cd flac-1.3.0
  141. chmod +x configure install-sh
  142. ./configure --enable-static --disable-shared --prefix=$PREFIX
  143. make
  144. sudo make install
  145. touch build-done
  146. cd ..
  147. fi
  148. # ------------------------------------------------------------------------------------
  149. # libsndfile
  150. if [ ! -d libsndfile-1.0.25 ]; then
  151. curl -O http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz
  152. tar -xf libsndfile-1.0.25.tar.gz
  153. fi
  154. if [ ! -f libsndfile-1.0.25/build-done ]; then
  155. cd libsndfile-1.0.25
  156. sed -i -e "s/#include <Carbon.h>//" programs/sndfile-play.c
  157. ./configure --enable-static --disable-shared --disable-sqlite --prefix=$PREFIX
  158. make
  159. sudo make install
  160. touch build-done
  161. cd ..
  162. fi
  163. # ------------------------------------------------------------------------------------
  164. # libgig
  165. if [ ! -d libgig-svn ]; then
  166. /opt/local/bin/svn co https://svn.linuxsampler.org/svn/libgig/trunk libgig-svn
  167. fi
  168. if [ ! -f libgig-svn/build-done ]; then
  169. cd libgig-svn
  170. env PATH=/opt/local/bin:$PATH /opt/local/bin/aclocal -I /opt/local/share/aclocal
  171. env PATH=/opt/local/bin:$PATH /opt/local/bin/glibtoolize --force --copy
  172. env PATH=/opt/local/bin:$PATH /opt/local/bin/autoheader
  173. env PATH=/opt/local/bin:$PATH /opt/local/bin/automake --add-missing --copy
  174. env PATH=/opt/local/bin:$PATH /opt/local/bin/autoconf
  175. env PATH=/opt/local/bin:$PATH ./configure --enable-static --disable-shared --prefix=$PREFIX
  176. env PATH=/opt/local/bin:$PATH make
  177. sudo make install
  178. touch build-done
  179. cd ..
  180. fi
  181. # ------------------------------------------------------------------------------------
  182. # linuxsampler
  183. if [ ! -d linuxsampler-svn ]; then
  184. /opt/local/bin/svn co https://svn.linuxsampler.org/svn/linuxsampler/trunk linuxsampler-svn
  185. fi
  186. if [ ! -f linuxsampler-svn/build-done ]; then
  187. cd linuxsampler-svn
  188. mkdir -p tmp
  189. cd tmp
  190. curl -L https://launchpad.net/~kxstudio-debian/+archive/ubuntu/libs/+files/linuxsampler-static_1.0.0%2Bsvn2593-1kxstudio5.debian.tar.xz -o linuxsampler-static.debian.tar.xz
  191. /opt/local/bin/7z x linuxsampler-static.debian.tar.xz
  192. /opt/local/bin/7z x linuxsampler-static.debian.tar
  193. cd ..
  194. mv tmp/debian/patches/*.patch .
  195. patch -p1 < allow-no-drivers-build.patch
  196. patch -p1 < disable-ladspa-fx.patch
  197. rm -r *.patch tmp/
  198. sed -i -e "s/HAVE_AU/HAVE_VST/" src/hostplugins/Makefile.am
  199. env PATH=/opt/local/bin:$PATH /opt/local/bin/aclocal -I /opt/local/share/aclocal
  200. env PATH=/opt/local/bin:$PATH /opt/local/bin/glibtoolize --force --copy
  201. env PATH=/opt/local/bin:$PATH /opt/local/bin/autoheader
  202. env PATH=/opt/local/bin:$PATH /opt/local/bin/automake --add-missing --copy
  203. env PATH=/opt/local/bin:$PATH /opt/local/bin/autoconf
  204. env PATH=/opt/local/bin:$PATH ./configure --enable-static --disable-shared --prefix=$PREFIX \
  205. --disable-arts-driver --disable-artstest \
  206. --disable-asio-driver --disable-midishare-driver --disable-coremidi-driver --disable-coreaudio-driver --disable-mmemidi-driver
  207. env PATH=/opt/local/bin:$PATH ./scripts/generate_instrument_script_parser.sh
  208. sed -i -e "s/bison (GNU Bison) //" config.h
  209. env PATH=/opt/local/bin:$PATH make
  210. sudo make install
  211. sudo sed -i -e "s|-llinuxsampler|-llinuxsampler -L/opt/carla64/lib/libgig -lgig -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lm -lpthread -lsqlite3|" /opt/carla64/lib/pkgconfig/linuxsampler.pc
  212. touch build-done
  213. cd ..
  214. fi
  215. # ------------------------------------------------------------------------------------
  216. # libffi
  217. if [ ! -d libffi-3.1 ]; then
  218. curl -O ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz
  219. tar -xf libffi-3.1.tar.gz
  220. fi
  221. if [ ! -f libffi-3.1/build-done ]; then
  222. cd libffi-3.1
  223. ./configure --enable-static --disable-shared --prefix=$PREFIX
  224. make
  225. sudo make install
  226. touch build-done
  227. cd ..
  228. fi
  229. # ------------------------------------------------------------------------------------
  230. # gettext
  231. if [ ! -d gettext-0.18.3.2 ]; then
  232. curl -O http://ftp.gnu.org/gnu/gettext/gettext-0.18.3.2.tar.gz
  233. tar -xf gettext-0.18.3.2.tar.gz
  234. fi
  235. if [ ! -f gettext-0.18.3.2/build-done ]; then
  236. cd gettext-0.18.3.2
  237. env PATH=/opt/local/bin:$PATH ./configure --enable-static --disable-shared --prefix=$PREFIX
  238. env PATH=/opt/local/bin:$PATH make
  239. sudo make install
  240. touch build-done
  241. cd ..
  242. fi
  243. # ------------------------------------------------------------------------------------
  244. # glib
  245. if [ ! -d glib-2.42.0 ]; then
  246. curl -O http://ftp.gnome.org/pub/GNOME/sources/glib/2.42/glib-2.42.0.tar.xz
  247. /opt/local/bin/7z x glib-2.42.0.tar.xz
  248. /opt/local/bin/7z x glib-2.42.0.tar
  249. fi
  250. if [ ! -f glib-2.42.0/build-done ]; then
  251. cd glib-2.42.0
  252. chmod +x configure install-sh
  253. env CFLAGS="$CFLAGS -I$PREFIX/include" LDFLAGS="$LDFLAGS -L$PREFIX/lib" PATH=/opt/local/bin:$PATH ./configure --enable-static --disable-shared --prefix=$PREFIX
  254. env PATH=/opt/local/bin:$PATH make
  255. sudo touch /opt/carla64/bin/gtester-report
  256. sudo make install
  257. touch build-done
  258. cd ..
  259. fi
  260. # ------------------------------------------------------------------------------------
  261. # fluidsynth
  262. if [ ! -d fluidsynth-1.1.6 ]; then
  263. curl -L http://sourceforge.net/projects/fluidsynth/files/fluidsynth-1.1.6/fluidsynth-1.1.6.tar.gz/download -o fluidsynth-1.1.6.tar.gz
  264. tar -xf fluidsynth-1.1.6.tar.gz
  265. fi
  266. if [ ! -f fluidsynth-1.1.6/build-done ]; then
  267. cd fluidsynth-1.1.6
  268. env LDFLAGS="$LDFLAGS -framework Carbon -framework CoreFoundation" \
  269. ./configure --enable-static --disable-shared --prefix=$PREFIX \
  270. --disable-dbus-support --disable-aufile-support \
  271. --disable-pulse-support --disable-alsa-support --disable-portaudio-support --disable-oss-support --disable-jack-support \
  272. --disable-coreaudio --disable-coremidi --disable-dart --disable-lash --disable-ladcca \
  273. --without-readline \
  274. --enable-libsndfile-support
  275. make
  276. sudo make install
  277. sudo sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm -liconv -lintl|" /opt/carla64/lib/pkgconfig/fluidsynth.pc
  278. touch build-done
  279. cd ..
  280. fi
  281. # ------------------------------------------------------------------------------------
  282. # fftw3
  283. if [ ! -d fftw-3.3.4 ]; then
  284. curl -O http://www.fftw.org/fftw-3.3.4.tar.gz
  285. tar -xf fftw-3.3.4.tar.gz
  286. fi
  287. if [ ! -f fftw-3.3.4/build-done ]; then
  288. export CFLAGS="-O2 -mtune=generic -msse -msse2 -ffast-math -mfpmath=sse -m$ARCH -fPIC -DPIC"
  289. export CXXFLAGS=$CFLAGS
  290. cd fftw-3.3.4
  291. ./configure --enable-static --enable-sse2 --disable-shared --disable-debug --prefix=$PREFIX
  292. make
  293. sudo make install
  294. make clean
  295. ./configure --enable-static --enable-sse --enable-sse2 --enable-single --disable-shared --disable-debug --prefix=$PREFIX
  296. make
  297. sudo make install
  298. make clean
  299. touch build-done
  300. cd ..
  301. fi
  302. }
  303. # ------------------------------------------------------------------------------------
  304. # build base libs
  305. export ARCH=32
  306. build_base
  307. export ARCH=64
  308. build_base
  309. # ------------------------------------------------------------------------------------
  310. # switch to clang for Qt5
  311. export CC=clang
  312. export CXX=clang
  313. # ------------------------------------------------------------------------------------
  314. # set flags for qt stuff
  315. export CFLAGS="-O2 -mtune=generic -msse -msse2 -m64 -fPIC -DPIC"
  316. export CXXFLAGS=$CFLAGS
  317. export LDFLAGS="-m64"
  318. export PREFIX=/opt/carla
  319. export PATH=$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  320. export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
  321. export CFG_ARCH=x86_64
  322. export QMAKESPEC=macx-clang
  323. # ------------------------------------------------------------------------------------
  324. # qt5-base download
  325. if [ ! -d qtbase-opensource-src-5.3.2 ]; then
  326. curl -L http://download.qt-project.org/official_releases/qt/5.3/5.3.2/submodules/qtbase-opensource-src-5.3.2.tar.gz -o qtbase-opensource-src-5.3.2.tar.gz
  327. tar -xf qtbase-opensource-src-5.3.2.tar.gz
  328. fi
  329. # ------------------------------------------------------------------------------------
  330. # qt5-base (64bit, shared, framework)
  331. if [ ! -f qtbase-opensource-src-5.3.2/build-done ]; then
  332. cd qtbase-opensource-src-5.3.2
  333. ./configure -release -shared -opensource -confirm-license -force-pkg-config -platform macx-clang -framework \
  334. -prefix $PREFIX -plugindir $PREFIX/lib/qt5/plugins -headerdir $PREFIX/include/qt5 \
  335. -qt-freetype -qt-libjpeg -qt-libpng -qt-pcre -qt-sql-sqlite -qt-zlib -opengl desktop -qpa cocoa \
  336. -no-directfb -no-eglfs -no-kms -no-linuxfb -no-mtdev -no-xcb -no-xcb-xlib \
  337. -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-mips_dsp -no-mips_dspr2 \
  338. -no-cups -no-dbus -no-evdev -no-fontconfig -no-harfbuzz -no-iconv -no-icu -no-gif -no-glib -no-nis -no-openssl -no-pch -no-sql-ibase -no-sql-odbc \
  339. -no-audio-backend -no-qml-debug -no-separate-debug-info \
  340. -no-compile-examples -nomake examples -nomake tests -make libs -make tools
  341. make -j 2
  342. sudo make install
  343. sudo ln -s /opt/carla/lib/QtCore.framework/Headers /opt/carla/include/qt5/QtCore
  344. sudo ln -s /opt/carla/lib/QtGui.framework/Headers /opt/carla/include/qt5/QtGui
  345. sudo ln -s /opt/carla/lib/QtWidgets.framework/Headers /opt/carla/include/qt5/QtWidgets
  346. touch build-done
  347. cd ..
  348. fi
  349. # ------------------------------------------------------------------------------------
  350. # qt5-mac-extras
  351. if [ ! -d qtmacextras-opensource-src-5.3.2 ]; then
  352. curl -L http://download.qt-project.org/official_releases/qt/5.3/5.3.2/submodules/qtmacextras-opensource-src-5.3.2.tar.gz -o qtmacextras-opensource-src-5.3.2.tar.gz
  353. tar -xf qtmacextras-opensource-src-5.3.2.tar.gz
  354. fi
  355. if [ ! -f qtmacextras-opensource-src-5.3.2/build-done ]; then
  356. cd qtmacextras-opensource-src-5.3.2
  357. qmake
  358. make -j 2
  359. sudo make install
  360. touch build-done
  361. cd ..
  362. fi
  363. # ------------------------------------------------------------------------------------
  364. # qt5-svg
  365. if [ ! -d qtsvg-opensource-src-5.3.2 ]; then
  366. curl -L http://download.qt-project.org/official_releases/qt/5.3/5.3.2/submodules/qtsvg-opensource-src-5.3.2.tar.gz -o qtsvg-opensource-src-5.3.2.tar.gz
  367. tar -xf qtsvg-opensource-src-5.3.2.tar.gz
  368. fi
  369. if [ ! -f qtsvg-opensource-src-5.3.2/build-done ]; then
  370. cd qtsvg-opensource-src-5.3.2
  371. qmake
  372. make -j 2
  373. sudo make install
  374. touch build-done
  375. cd ..
  376. fi
  377. # ------------------------------------------------------------------------------------
  378. # python
  379. if [ ! -d Python-3.4.2 ]; then
  380. curl -O https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
  381. tar -xf Python-3.4.2.tgz
  382. fi
  383. if [ ! -f Python-3.4.2/build-done ]; then
  384. cd Python-3.4.2
  385. ./configure --prefix=$PREFIX
  386. make
  387. sudo make install
  388. touch build-done
  389. cd ..
  390. fi
  391. # ------------------------------------------------------------------------------------
  392. # sip
  393. if [ ! -d sip-4.16.3 ]; then
  394. curl -L http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.3/sip-4.16.3.tar.gz -o sip-4.16.3.tar.gz
  395. tar -xf sip-4.16.3.tar.gz
  396. fi
  397. if [ ! -f sip-4.16.3/build-done ]; then
  398. cd sip-4.16.3
  399. python3 configure.py
  400. make
  401. sudo make install
  402. touch build-done
  403. cd ..
  404. fi
  405. # ------------------------------------------------------------------------------------
  406. # pyqt5
  407. if [ ! -d PyQt-gpl-5.3.2 ]; then
  408. curl -L http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.3.2/PyQt-gpl-5.3.2.tar.gz -o PyQt-gpl-5.3.2.tar.gz
  409. tar -xf PyQt-gpl-5.3.2.tar.gz
  410. fi
  411. if [ ! -f PyQt-gpl-5.3.2/build-done ]; then
  412. cd PyQt-gpl-5.3.2
  413. sed -i -e "s/# Read the details./pylib_dir = ''/" configure.py
  414. python3 configure.py --confirm-license
  415. make
  416. sudo make install
  417. touch build-done
  418. cd ..
  419. fi
  420. # ------------------------------------------------------------------------------------
  421. # cxfreeze
  422. if [ ! -d cx_Freeze-4.3.3 ]; then
  423. curl -L http://download.sourceforge.net/cx-freeze/cx_Freeze-4.3.3.tar.gz -o cx_Freeze-4.3.3.tar.gz
  424. tar -xf cx_Freeze-4.3.3.tar.gz
  425. fi
  426. if [ ! -f cx_Freeze-4.3.3/build-done ]; then
  427. cd cx_Freeze-4.3.3
  428. sed -i -e 's/"python%s.%s"/"python%s.%sm"/' setup.py
  429. python3 setup.py build
  430. sudo python3 setup.py install --prefix=$PREFIX
  431. touch build-done
  432. cd ..
  433. fi
  434. # ------------------------------------------------------------------------------------