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.

571 lines
16KB

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