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.

597 lines
16KB

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