From f304c9a1177c6256a4db2af7baef27221d0dc884 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 12 Jan 2018 22:30:51 +0100 Subject: [PATCH] Add initial scripts for static linux builds --- data/linux/build-deps.sh | 385 ++++++++++++++++++ data/linux/build64.sh | 43 ++ data/linux/patches/libgig_fix-build.patch | 29 ++ .../linuxsampler_allow-no-drivers-build.patch | 24 ++ .../linuxsampler_disable-ladspa-fx.patch | 10 + 5 files changed, 491 insertions(+) create mode 100755 data/linux/build-deps.sh create mode 100755 data/linux/build64.sh create mode 100644 data/linux/patches/libgig_fix-build.patch create mode 100644 data/linux/patches/linuxsampler_allow-no-drivers-build.patch create mode 100644 data/linux/patches/linuxsampler_disable-ladspa-fx.patch diff --git a/data/linux/build-deps.sh b/data/linux/build-deps.sh new file mode 100755 index 000000000..3dcc4ec04 --- /dev/null +++ b/data/linux/build-deps.sh @@ -0,0 +1,385 @@ +#!/bin/bash + +# NOTE: You need the following packages installed via MacPorts: +# automake, autoconf, bison, flex, libtool +# p5-libxml-perl, p5-xml-libxml, p7zip, pkgconfig + +# ------------------------------------------------------------------------------------ +# stop on error + +set -e + +# ------------------------------------------------------------------------------------ +# cd to correct path + +if [ -f Makefile ]; then + cd data/linux +fi + +# ------------------------------------------------------------------------------------ +# set target dir + +TARGETDIR=$HOME/builds + +# ------------------------------------------------------------------------------------ +# function to remove old stuff + +cleanup() +{ + +rm -rf $TARGETDIR/carla/ $TARGETDIR/carla32/ $TARGETDIR/carla64/ +# rm -rf cx_Freeze-* +# rm -rf Python-* +# rm -rf PyQt-* +# rm -rf file-* +# rm -rf flac-* +# rm -rf fltk-* +# rm -rf fluidsynth-* +# rm -rf fftw-* +# rm -rf gettext-* +# rm -rf glib-* +# rm -rf libffi-* +# rm -rf libgig-* +rm -rf liblo-* +# rm -rf libogg-* +# rm -rf libsndfile-* +# rm -rf libvorbis-* +# rm -rf linuxsampler-* +# rm -rf mxml-* +rm -rf pkg-config-* +# rm -rf pyliblo-* +# rm -rf qtbase-* +# rm -rf qtmacextras-* +# rm -rf qtsvg-* +# rm -rf sip-* +# rm -rf zlib-* +# rm -rf PaxHeaders.20420 + +} + +# ------------------------------------------------------------------------------------ +# function to build base libs + +build_base() +{ + +export CC=gcc +export CXX=g++ + +export PREFIX=$TARGETDIR/carla$ARCH +export PATH=$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin +export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig + +export CFLAGS="-O2 -mtune=generic -msse -msse2 -mfpmath=sse -fvisibility=hidden -fdata-sections -ffunction-sections" +export CFLAGS="$CFLAGS -m$ARCH -fPIC -DPIC -DNDEBUG -I$PREFIX/include" +export CXXFLAGS="$CFLAGS -fvisibility-inlines-hidden" + +export LDFLAGS="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all" +export LDFLAGS="$LDFLAGS -m$ARCH -L$PREFIX/lib" + +# ------------------------------------------------------------------------------------ +# pkgconfig + +if [ ! -d pkg-config-0.28 ]; then +curl -O https://pkg-config.freedesktop.org/releases/pkg-config-0.28.tar.gz +tar -xf pkg-config-0.28.tar.gz +fi + +if [ ! -f pkg-config-0.28_$ARCH/build-done ]; then +cp -r pkg-config-0.28 pkg-config-0.28_$ARCH +cd pkg-config-0.28_$ARCH +./configure --enable-indirect-deps --with-internal-glib --with-pc-path=$PKG_CONFIG_PATH --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# liblo + +if [ ! -d liblo-0.28 ]; then +curl -L http://download.sourceforge.net/liblo/liblo-0.28.tar.gz -o liblo-0.28.tar.gz +tar -xf liblo-0.28.tar.gz +fi + +if [ ! -f liblo-0.28_$ARCH/build-done ]; then +cp -r liblo-0.28 liblo-0.28_$ARCH +cd liblo-0.28_$ARCH +./configure --enable-static --disable-shared --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ + +if [ "$ARCH" == "32" ]; then +return +fi + +# ------------------------------------------------------------------------------------ +# file/magic + +if [ ! -d file-5.25 ]; then +curl -O ftp://ftp.astron.com/pub/file/file-5.25.tar.gz +tar -xf file-5.25.tar.gz +fi + +if [ ! -f file-5.25/build-done ]; then +cd file-5.25 +./configure --enable-static --disable-shared --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# zlib + +if [ ! -d zlib-1.2.10 ]; then +curl -L https://github.com/madler/zlib/archive/v1.2.10.tar.gz -o zlib-1.2.10.tar.gz +tar -xf zlib-1.2.10.tar.gz +fi + +if [ ! -f zlib-1.2.10/build-done ]; then +cd zlib-1.2.10 +./configure --static --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# mxml + +if [ ! -d mxml-2.11 ]; then +wget https://github.com/michaelrsweet/mxml/releases/download/v2.11/mxml-2.11.tar.gz +mkdir mxml-2.11 +cd mxml-2.11 +tar -xf ../mxml-2.11.tar.gz +cd .. +fi + +if [ ! -f mxml-2.11/build-done ]; then +cd mxml-2.11 +./configure --disable-shared --prefix=$PREFIX +make libmxml.a +cp *.a $PREFIX/lib/ +cp *.pc $PREFIX/lib/pkgconfig/ +cp mxml.h $PREFIX/include/ +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# libogg + +if [ ! -d libogg-1.3.2 ]; then +curl -O https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.2.tar.gz +tar -xf libogg-1.3.2.tar.gz +fi + +if [ ! -f libogg-1.3.2/build-done ]; then +cd libogg-1.3.2 +./configure --enable-static --disable-shared --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# libvorbis + +if [ ! -d libvorbis-1.3.5 ]; then +wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz +tar -xf libvorbis-1.3.5.tar.gz +fi + +if [ ! -f libvorbis-1.3.5/build-done ]; then +cd libvorbis-1.3.5 +./configure --enable-static --disable-shared --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# flac + +if [ ! -d flac-1.3.1 ]; then +wget https://svn.xiph.org/releases/flac/flac-1.3.1.tar.xz +tar -xf flac-1.3.1.tar.xz +fi + +if [ ! -f flac-1.3.1/build-done ]; then +cd flac-1.3.1 +chmod +x configure install-sh +./configure --enable-static --disable-shared --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# libsndfile + +if [ ! -d libsndfile-1.0.26 ]; then +curl -O http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.26.tar.gz +tar -xf libsndfile-1.0.26.tar.gz +fi + +if [ ! -f libsndfile-1.0.26/build-done ]; then +cd libsndfile-1.0.26 +sed -i -e "s/#include //" programs/sndfile-play.c +./configure --enable-static --disable-shared --disable-sqlite --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# libgig + +if [ ! -d libgig-4.0.0 ]; then +curl -O http://download.linuxsampler.org/packages/libgig-4.0.0.tar.bz2 +tar -xf libgig-4.0.0.tar.bz2 +fi + +if [ ! -f libgig-4.0.0/build-done ]; then +cd libgig-4.0.0 +if [ ! -f patched ]; then +patch -p1 -i ../patches/libgig_fix-build.patch +touch patched +fi +./configure --enable-static --disable-shared --prefix=$PREFIX +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# linuxsampler + +if [ ! -d linuxsampler-2.0.0 ]; then +curl -O http://download.linuxsampler.org/packages/linuxsampler-2.0.0.tar.bz2 +tar -xf linuxsampler-2.0.0.tar.bz2 +fi + +if [ ! -f linuxsampler-2.0.0/build-done ]; then +cd linuxsampler-2.0.0 +if [ ! -f patched ]; then +patch -p1 -i ../patches/linuxsampler_allow-no-drivers-build.patch +patch -p1 -i ../patches/linuxsampler_disable-ladspa-fx.patch +sed -i -e "s/HAVE_AU/HAVE_VST/" src/hostplugins/Makefile.am +touch patched +fi +rm configure +make -f Makefile.svn configure +./configure \ +--enable-static --disable-shared --prefix=$PREFIX \ +--disable-alsa-driver \ +--disable-arts-driver --disable-artstest --disable-instruments-db \ +--disable-asio-driver --disable-midishare-driver --disable-coremidi-driver --disable-coreaudio-driver --disable-mmemidi-driver +sed -i -e "s/bison (GNU Bison) //" config.h +make -j 8 +make install +sed -i -e "s|-llinuxsampler|-llinuxsampler -L$PREFIX/lib/libgig -lgig -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lm -lpthread|" $PREFIX/lib/pkgconfig/linuxsampler.pc +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# fltk + +if [ ! -d fltk-1.3.3 ]; then +curl -O http://fltk.org/pub/fltk/1.3.3/fltk-1.3.3-source.tar.gz +tar -xf fltk-1.3.3-source.tar.gz +fi + +if [ ! -f fltk-1.3.3/build-done ]; then +cd fltk-1.3.3 +./configure --prefix=$PREFIX \ +--disable-shared --disable-debug \ +--disable-threads --disable-gl \ +--enable-localjpeg --enable-localpng +make +make install +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# glib + +if [ ! -d $PREFIX/include/glib-2.0 ]; then +cp -r /usr/include/glib-2.0 $PREFIX/include/ +fi + +# ------------------------------------------------------------------------------------ +# fluidsynth + +if [ ! -d fluidsynth-1.1.6 ]; then +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 +tar -xf fluidsynth-1.1.6.tar.gz +fi + +if [ ! -f fluidsynth-1.1.6/build-done ]; then +cd fluidsynth-1.1.6 +./configure --enable-static --disable-shared --prefix=$PREFIX \ + --disable-dbus-support --disable-aufile-support \ + --disable-pulse-support --disable-alsa-support --disable-portaudio-support --disable-oss-support --disable-jack-support \ + --disable-coreaudio --disable-coremidi --disable-dart --disable-lash --disable-ladcca \ + --without-readline \ + --enable-libsndfile-support +make +make install +sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" $PREFIX/lib/pkgconfig/fluidsynth.pc +touch build-done +cd .. +fi + +# ------------------------------------------------------------------------------------ +# fftw3 (needs to be last as it modifies C[XX]FLAGS) + +if [ ! -d fftw-3.3.4 ]; then +curl -O http://www.fftw.org/fftw-3.3.4.tar.gz +tar -xf fftw-3.3.4.tar.gz +fi + +if [ ! -f fftw-3.3.4/build-done ]; then +export CFLAGS="$CFLAGS -O3 -ffast-math" +export CXXFLAGS="$CXXFLAGS -O3 -ffast-math" +cd fftw-3.3.4 +./configure --enable-static --enable-sse2 --disable-shared --disable-debug --prefix=$PREFIX +make +make install +make clean +./configure --enable-static --enable-sse --enable-sse2 --enable-single --disable-shared --disable-debug --prefix=$PREFIX +make +make install +make clean +touch build-done +cd .. +fi + +} + +# ------------------------------------------------------------------------------------ +# build base libs + +export ARCH=32 +build_base + +export ARCH=64 +build_base + +# ------------------------------------------------------------------------------------ diff --git a/data/linux/build64.sh b/data/linux/build64.sh new file mode 100755 index 000000000..e73f88dfc --- /dev/null +++ b/data/linux/build64.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e + +MAKE_FLAGS="-j 8 HAVE_FFMPEG=false HAVE_PROJECTM=false HAVE_PULSEAUDIO=false EXTERNAL_PLUGINS=false" + +if [ ! -f Makefile ]; then + cd ../.. +fi + +TARGETDIR=$HOME/builds + +export LINUX="true" +export CC=gcc +export CXX=g++ + +unset CPPFLAGS + +############################################################################################## +# Complete 64bit build + +export CFLAGS="-O2 -m64" +export CXXFLAGS=$CFLAGS +export LDFLAGS="-m64" + +# export PATH=$TARGETDIR/carla/bin:$TARGETDIR/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin +export PKG_CONFIG_PATH=$TARGETDIR/carla/lib/pkgconfig:$TARGETDIR/carla64/lib/pkgconfig + +make $MAKE_FLAGS + +############################################################################################## +# Build 32bit bridges + +export CFLAGS="-O2 -m32" +export CXXFLAGS=$CFLAGS +export LDFLAGS="-m32" + +# export PATH=$TARGETDIR/carla32/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin +export PKG_CONFIG_PATH=$TARGETDIR/carla32/lib/pkgconfig + +make posix32 $MAKE_FLAGS + +############################################################################################## diff --git a/data/linux/patches/libgig_fix-build.patch b/data/linux/patches/libgig_fix-build.patch new file mode 100644 index 000000000..6ba32959e --- /dev/null +++ b/data/linux/patches/libgig_fix-build.patch @@ -0,0 +1,29 @@ +diff --git a/src/DLS.h b/src/DLS.h +index 065bfe6..6c9d76c 100644 +--- a/src/DLS.h ++++ b/src/DLS.h +@@ -515,10 +515,10 @@ namespace DLS { + virtual void Save(const String& Path, progress_t* pProgress = NULL); + virtual void Save(progress_t* pProgress = NULL); + virtual ~File(); +- protected: + typedef std::list SampleList; + typedef std::list InstrumentList; + ++ protected: + RIFF::File* pRIFF; + std::list ExtensionFiles; + SampleList* pSamples; +diff --git a/src/gig.cpp b/src/gig.cpp +index 6a24f16..902e1ae 100644 +--- a/src/gig.cpp ++++ b/src/gig.cpp +@@ -4181,7 +4181,7 @@ namespace { + * @param pGroup - script's new group + */ + void Script::SetGroup(ScriptGroup* pGroup) { +- if (this->pGroup = pGroup) return; ++ if (this->pGroup == pGroup) return; + if (pChunk) + pChunk->GetParent()->MoveSubChunk(pChunk, pGroup->pList); + this->pGroup = pGroup; diff --git a/data/linux/patches/linuxsampler_allow-no-drivers-build.patch b/data/linux/patches/linuxsampler_allow-no-drivers-build.patch new file mode 100644 index 000000000..12a7f3875 --- /dev/null +++ b/data/linux/patches/linuxsampler_allow-no-drivers-build.patch @@ -0,0 +1,24 @@ +--- linuxsampler-static-1.0.0+svn2356.orig/configure.ac ++++ linuxsampler-static-1.0.0+svn2356/configure.ac +@@ -556,21 +556,6 @@ if test "x$MAC_PLUGIN_INSTALL_DIR" = "x" + fi + AC_SUBST(MAC_PLUGIN_INSTALL_DIR) + +-# have we found at least one MIDI input and one audio output driver ? +-if test "$have_midi_input_driver" = "false"; then +- echo "No supported MIDI input system found!" +- echo "Sorry, LinuxSampler only supports the following MIDI drivers at the moment:" +- echo "ALSA, JACK, MIDIShare, CoreMIDI, MME." +- echo "If you think you have one of those available on your system, make sure you" +- echo "also have the respective development (header) files installed." +- exit -1; +-fi +-if test "$have_audio_output_driver" = "false"; then +- echo "No supported audio output system found!" +- echo "Sorry, LinuxSampler only supports ALSA, JACK, ARTS and ASIO as audio output" +- echo "driver at the moment!" +- exit -1; +-fi + + + diff --git a/data/linux/patches/linuxsampler_disable-ladspa-fx.patch b/data/linux/patches/linuxsampler_disable-ladspa-fx.patch new file mode 100644 index 000000000..5bc4e9816 --- /dev/null +++ b/data/linux/patches/linuxsampler_disable-ladspa-fx.patch @@ -0,0 +1,10 @@ +--- linuxsampler-static-1.0.0+svn2497.orig/src/effects/LadspaEffect.cpp ++++ linuxsampler-static-1.0.0+svn2497/src/effects/LadspaEffect.cpp +@@ -374,6 +374,7 @@ static String defaultLadspaDir() { + + std::vector LadspaEffect::AvailableEffects() { + std::vector v; // will be filled in callback function _foundLadspaDll() ++ return v; + + char* pcLadspaPath = getenv("LADSPA_PATH"); + String ladspaDir = pcLadspaPath ? pcLadspaPath : defaultLadspaDir();