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.

310 lines
8.7KB

  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/linux
  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/carla32/ $TARGETDIR/carla64/
  21. rm -rf file-*
  22. rm -rf flac-*
  23. rm -rf fltk-*
  24. rm -rf fluidsynth-*
  25. rm -rf libgig-*
  26. rm -rf liblo-*
  27. rm -rf libogg-*
  28. rm -rf libsndfile-*
  29. rm -rf libvorbis-*
  30. rm -rf linuxsampler-*
  31. rm -rf pkg-config-*
  32. rm -rf zlib-*
  33. }
  34. cleanup
  35. exit 0
  36. # ---------------------------------------------------------------------------------------------------------------------
  37. # function to build base libs
  38. build_base()
  39. {
  40. export CC=gcc
  41. export CXX=g++
  42. export PREFIX=$TARGETDIR/carla$ARCH
  43. export PATH=$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  44. export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
  45. export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections"
  46. export CFLAGS="$CFLAGS -fPIC -DPIC -DNDEBUG -I$PREFIX/include"
  47. export CXXFLAGS="$CFLAGS -fvisibility-inlines-hidden"
  48. export LDFLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
  49. export LDFLAGS="$LDFLAGS -L$PREFIX/lib"
  50. # ---------------------------------------------------------------------------------------------------------------------
  51. # pkgconfig
  52. if [ ! -d pkg-config-0.28 ]; then
  53. curl -O https://pkg-config.freedesktop.org/releases/pkg-config-0.28.tar.gz
  54. tar -xf pkg-config-0.28.tar.gz
  55. fi
  56. if [ ! -f pkg-config-0.28_$ARCH/build-done ]; then
  57. cp -r pkg-config-0.28 pkg-config-0.28_$ARCH
  58. cd pkg-config-0.28_$ARCH
  59. ./configure --enable-indirect-deps --with-internal-glib --with-pc-path=$PKG_CONFIG_PATH --prefix=$PREFIX
  60. make
  61. make install
  62. touch build-done
  63. cd ..
  64. fi
  65. # ---------------------------------------------------------------------------------------------------------------------
  66. # liblo
  67. if [ ! -d liblo-0.28 ]; then
  68. curl -L http://download.sourceforge.net/liblo/liblo-0.28.tar.gz -o liblo-0.28.tar.gz
  69. tar -xf liblo-0.28.tar.gz
  70. fi
  71. if [ ! -f liblo-0.28_$ARCH/build-done ]; then
  72. cp -r liblo-0.28 liblo-0.28_$ARCH
  73. cd liblo-0.28_$ARCH
  74. ./configure --enable-static --disable-shared --prefix=$PREFIX
  75. make
  76. make install
  77. touch build-done
  78. cd ..
  79. fi
  80. # ---------------------------------------------------------------------------------------------------------------------
  81. if [ "$ARCH" == "32" ]; then
  82. return
  83. fi
  84. # ---------------------------------------------------------------------------------------------------------------------
  85. # zlib
  86. if [ ! -d zlib-1.2.10 ]; then
  87. curl -L https://github.com/madler/zlib/archive/v1.2.10.tar.gz -o zlib-1.2.10.tar.gz
  88. tar -xf zlib-1.2.10.tar.gz
  89. fi
  90. if [ ! -f zlib-1.2.10/build-done ]; then
  91. cd zlib-1.2.10
  92. ./configure --static --prefix=$PREFIX
  93. make
  94. make install
  95. touch build-done
  96. cd ..
  97. fi
  98. # ---------------------------------------------------------------------------------------------------------------------
  99. # file/magic
  100. if [ ! -d file-5.25 ]; then
  101. curl -O ftp://ftp.astron.com/pub/file/file-5.25.tar.gz
  102. tar -xf file-5.25.tar.gz
  103. fi
  104. if [ ! -f file-5.25/build-done ]; then
  105. cd file-5.25
  106. ./configure --enable-static --disable-shared --prefix=$PREFIX
  107. make
  108. make install
  109. touch build-done
  110. cd ..
  111. fi
  112. # ---------------------------------------------------------------------------------------------------------------------
  113. # libogg
  114. if [ ! -d libogg-1.3.2 ]; then
  115. curl -O https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.2.tar.gz
  116. tar -xf libogg-1.3.2.tar.gz
  117. fi
  118. if [ ! -f libogg-1.3.2/build-done ]; then
  119. cd libogg-1.3.2
  120. ./configure --enable-static --disable-shared --prefix=$PREFIX
  121. make
  122. make install
  123. touch build-done
  124. cd ..
  125. fi
  126. # ---------------------------------------------------------------------------------------------------------------------
  127. # libvorbis
  128. if [ ! -d libvorbis-1.3.5 ]; then
  129. wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
  130. tar -xf libvorbis-1.3.5.tar.gz
  131. fi
  132. if [ ! -f libvorbis-1.3.5/build-done ]; then
  133. cd libvorbis-1.3.5
  134. ./configure --enable-static --disable-shared --prefix=$PREFIX
  135. make
  136. make install
  137. touch build-done
  138. cd ..
  139. fi
  140. # ---------------------------------------------------------------------------------------------------------------------
  141. # flac
  142. if [ ! -d flac-1.3.1 ]; then
  143. wget https://svn.xiph.org/releases/flac/flac-1.3.1.tar.xz
  144. tar -xf flac-1.3.1.tar.xz
  145. fi
  146. if [ ! -f flac-1.3.1/build-done ]; then
  147. cd flac-1.3.1
  148. chmod +x configure install-sh
  149. ./configure --enable-static --disable-shared --prefix=$PREFIX
  150. make
  151. make install
  152. touch build-done
  153. cd ..
  154. fi
  155. # ---------------------------------------------------------------------------------------------------------------------
  156. # libsndfile
  157. if [ ! -d libsndfile-1.0.26 ]; then
  158. curl -O http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.26.tar.gz
  159. tar -xf libsndfile-1.0.26.tar.gz
  160. fi
  161. if [ ! -f libsndfile-1.0.26/build-done ]; then
  162. cd libsndfile-1.0.26
  163. # sed -i -e "s/#include <Carbon.h>//" programs/sndfile-play.c
  164. ./configure --enable-static --disable-shared --disable-sqlite --prefix=$PREFIX
  165. make
  166. make install
  167. touch build-done
  168. cd ..
  169. fi
  170. # ---------------------------------------------------------------------------------------------------------------------
  171. # libgig
  172. if [ ! -d libgig-4.0.0 ]; then
  173. curl -O http://download.linuxsampler.org/packages/libgig-4.0.0.tar.bz2
  174. tar -xf libgig-4.0.0.tar.bz2
  175. fi
  176. if [ ! -f libgig-4.0.0/build-done ]; then
  177. cd libgig-4.0.0
  178. if [ ! -f patched ]; then
  179. patch -p1 -i ../patches/libgig_fix-build.patch
  180. touch patched
  181. fi
  182. ./configure --enable-static --disable-shared --prefix=$PREFIX
  183. make
  184. make install
  185. touch build-done
  186. cd ..
  187. fi
  188. # ---------------------------------------------------------------------------------------------------------------------
  189. # linuxsampler
  190. if [ ! -d linuxsampler-2.0.0 ]; then
  191. curl -O http://download.linuxsampler.org/packages/linuxsampler-2.0.0.tar.bz2
  192. tar -xf linuxsampler-2.0.0.tar.bz2
  193. fi
  194. if [ ! -f linuxsampler-2.0.0/build-done ]; then
  195. cd linuxsampler-2.0.0
  196. if [ ! -f patched ]; then
  197. patch -p1 -i ../patches/linuxsampler_allow-no-drivers-build.patch
  198. patch -p1 -i ../patches/linuxsampler_disable-ladspa-fx.patch
  199. # sed -i -e "s/HAVE_AU/HAVE_VST/" src/hostplugins/Makefile.am
  200. touch patched
  201. fi
  202. rm configure
  203. make -f Makefile.svn configure
  204. ./configure \
  205. --enable-static --disable-shared --prefix=$PREFIX \
  206. --disable-alsa-driver --disable-arts-driver --disable-jack-driver \
  207. --disable-asio-driver --disable-midishare-driver --disable-mmemidi-driver \
  208. --disable-coreaudio-driver --disable-coremidi-driver \
  209. --disable-instruments-db --disable-sf2-engine
  210. # sed -i -e "s/bison (GNU Bison) //" config.h
  211. make -j 8
  212. make install
  213. sed -i -e "s|-llinuxsampler|-llinuxsampler -L$PREFIX/lib/libgig -lgig -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" $PREFIX/lib/pkgconfig/linuxsampler.pc
  214. touch build-done
  215. cd ..
  216. fi
  217. # ---------------------------------------------------------------------------------------------------------------------
  218. # glib
  219. if [ ! -d $PREFIX/include/glib-2.0 ]; then
  220. cp -r /usr/include/glib-2.0 $PREFIX/include/
  221. fi
  222. # ---------------------------------------------------------------------------------------------------------------------
  223. # fluidsynth
  224. if [ ! -d fluidsynth-1.1.6 ]; then
  225. 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
  226. tar -xf fluidsynth-1.1.6.tar.gz
  227. fi
  228. if [ ! -f fluidsynth-1.1.6/build-done ]; then
  229. cd fluidsynth-1.1.6
  230. ./configure --enable-static --disable-shared --prefix=$PREFIX \
  231. --disable-dbus-support --disable-aufile-support \
  232. --disable-pulse-support --disable-alsa-support --disable-portaudio-support --disable-oss-support --disable-jack-support \
  233. --disable-coreaudio --disable-coremidi --disable-dart --disable-lash --disable-ladcca \
  234. --without-readline \
  235. --enable-libsndfile-support
  236. make
  237. make install
  238. sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" $PREFIX/lib/pkgconfig/fluidsynth.pc
  239. touch build-done
  240. cd ..
  241. fi
  242. }
  243. # ---------------------------------------------------------------------------------------------------------------------
  244. # build base libs
  245. export ARCH=32
  246. build_base
  247. export ARCH=64
  248. build_base
  249. # ---------------------------------------------------------------------------------------------------------------------