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.

545 lines
16KB

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