#!/bin/bash clean= makespace= parallel=2 PREFIX=$HOME/a3/inst this_script_dir="`/usr/bin/dirname \"$0\"`" function die () { echo $* exit 1 } function fetch_as () { if [ -f $1 ] ; then return fi if uname -a | grep --silent arwin ; then curl -L -o $1 $2 else wget --no-check-certificate -O $1 $2 fi } function defmod { if [ $# -ne 4 -a $# -ne 6 -a $# -ne 5 ] ; then echo "Incorrect number of arguments ($#) passed to defmod (5, 6 or 7) for $1" exit 1 fi name=$1 ; shift if [ x$target_mods != x ] ; then if echo $target_mods | grep --silent $name ; then : else echo "Skipping $name ..." return fi fi need_unpacked=1 if [ $# -eq 3 ] ; then eval "MOD_${name}_name=\"$name\"" eval "MOD_${name}_version=\"$1\"" ; shift eval "MOD_${name}_source=\"$1\"" ; shift eval "MOD_${name}_compression=\"$1\"" ; shift elif [ $# -eq 4 ] ; then eval "MOD_${name}_name=\"$1\"" ; shift eval "MOD_${name}_version=\"$1\"" ; shift eval "MOD_${name}_source=\"$1\"" ; shift eval "MOD_${name}_compression=\"$1\"" ; shift elif [ $# -eq 5 ] ; then eval "MOD_${name}_name=\"$1\"" ; shift eval "MOD_${name}_version=\"$1\"" ; shift eval "MOD_${name}_source=\"$1\"" ; shift eval "MOD_${name}_compression=\"$1\"" ; shift eval "MOD_${name}_unpacked=\"$1\""; shift need_unpacked=0 fi eval "if [ x\"\$MOD_${name}_version\" = x ] ; then \ MOD_${name}_wholename=\"\$MOD_${name}_name\" ; \ else \ MOD_${name}_wholename=\"\$MOD_${name}_name-\$MOD_${name}_version\"; \ fi" if [ $need_unpacked = 1 ] ; then eval "MOD_${name}_unpacked=\$MOD_${name}_wholename" fi eval "MOD_${name}_url=\$MOD_${name}_source\$MOD_${name}_wholename.tar.\$MOD_${name}_compression" eval "MOD_${name}_local_tarball=\`basename \$MOD_${name}_url\`" MODS="$MODS $name" } function built() { m=$1 built=1 # false in shell terms # if it already unpacked, assume it is built eval "if [ -d \$MOD_${m}_unpacked ] ; then \ built=0 ; fi" return $built } function basic_builder() { m=$1 if built $m ; then return fi # get busy ... eval "tar xf \$MOD_${m}_local_tarball && (cd \$MOD_${m}_unpacked && CFLAGS=\"$GLOBAL_CFLAGS\" LDFLAGS=\"$GLOBAL_LDFLAGS\" ./configure $GLOBAL_CONF && PATH=/usr/bin:$PATH make && make install) || die $m build failed" } function waf_builder() { m=$1 if built $m ; then return; fi eval "tar xf \$MOD_${m}_local_tarball && (cd \$MOD_${m}_unpacked && ./waf configure --prefix=$PREFIX && ./waf build && ./waf install && fix_install_name $PREFIX/lib/lib${m}-0.dylib) || die $m build failed" } function fix_install_name () { # # this is a temporary hack to deal with the fact that the # version of waf used by the LV2 stack does not correctly # set the install name of those libraries. Once that is # fixed in a release version, this function and its # uses can be removed. # if uname -a | grep --silent arwin ; then install_name_tool -id $1 $1 fi } while [ $# -gt 0 ] ; do case $1 in --clean*) clean=1 ; shift ;; --prefix*) PREFIX=`echo $1 | sed 's/--prefix=//'` ; shift ;; --space*) makespace=1 ; shift ;; -j*) parallel=`echo $1 | sed 's/-j//'` ; shift ;; esac done if [ x$clean != x -o x$makespace != x ] ; then if [ ! -d LRDF ] ; then echo "This doesn't appear to be your source directory. Don't run --clean or --space here." exit 1 fi # sudo required because of sudo while installing some python/perl stuff sudo rm -rf `find . -maxdepth 1 -type d | grep -v "^.$"` # sudo required because of its use during the python install step if [ $clean ] ; then sudo rm -rf $PREFIX fi exit 0 fi # DEFINING MODULES # # 3 possible formats # # NAME VERSION URL_FOR_DOWNLOAD_DIR COMPRESSION_TYPE # NAME PACKAGE_NAME VERSION URL_FOR_DOWNLOAD_DIR COMPRESSION_TYPE # NAME PACKAGE_NAME VERSION URL_FOR_DOWNLOAD_DIR COMPRESSION_TYPE UNPACKED_NAME # # the first form is the most common # the second form is required where the package name includes characters not allowed # in shell variables. here, the first NAME should define a legal shell variable name # the third form is required for libraries like boost whose packaging and naming is totally inconsistent # with normal practice # defmod boost boost_1_49_0 '' http://sourceforge.net/projects/boost/files/boost/1.49.0/ bz2 boost_1_49_0 defmod fftw 3.3.1 http://www.fftw.org/ gz defmod glibmm 2.32.0 http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.32/ xz defmod cairomm 1.10.0 http://cairographics.org/releases/ gz defmod pangomm 2.28.4 http://ftp.acc.umu.se/pub/gnome/sources/pangomm/2.28/ xz defmod atkmm 2.22.6 http://ftp.gnome.org/pub/GNOME/sources/atkmm/2.22/ xz defmod gtkmm 2.24.2 http://ftp.acc.umu.se/pub/GNOME/sources/gtkmm/2.24/ xz defmod libart_lgpl 2.3.21 http://ftp.gnome.org/pub/gnome/sources/libart_lgpl/2.3/ bz2 defmod libgnomecanvasmm 2.26.0 http://ftp.acc.umu.se/pub/GNOME/sources/libgnomecanvasmm/2.26/ bz2 defmod liblo 0.26 http://downloads.sourceforge.net/liblo/ gz defmod raptor2 2.0.6 http://download.librdf.org/source/ gz defmod rasqal 0.9.28 http://download.librdf.org/source/ gz defmod redland 1.0.15 http://download.librdf.org/source/ gz defmod libogg 1.3.0 http://downloads.xiph.org/releases/ogg/ xz defmod flac 1.2.1 http://downloads.xiph.org/releases/flac/ gz defmod libvorbis 1.3.2 http://downloads.xiph.org/releases/vorbis/ bz2 defmod libsamplerate 0.1.8 http://www.mega-nerd.com/SRC/ gz defmod aubio 0.3.2 http://aubio.org/pub/ gz defmod rdflib 3.2.0 http://rdflib.googlecode.com/files/ gz defmod setuptools 0.6c11 http://pypi.python.org/packages/source/s/setuptools/ gz defmod isodate 0.4.0 http://pypi.python.org/packages/source/i/isodate/ gz defmod pcre 8.32 http://downloads.sourceforge.net/project/pcre/pcre/8.32/ bz2 defmod lv2 1.2.0 http://lv2plug.in/spec/ bz2 defmod serd 0.18.2 http://download.drobilla.net/ bz2 defmod sord 0.12.0 http://download.drobilla.net/ bz2 defmod sratom 0.4.2 http://download.drobilla.net/ bz2 defmod lilv 0.16.0 http://download.drobilla.net/ bz2 defmod suil 0.6.10 http://download.drobilla.net/ bz2 defmod curl 7.25.0 http://curl.haxx.se/download/ bz2 if [ x$OSX = x ] ; then defmod util_linux util-linux 2.21 http://www.kernel.org/pub/linux/utils/util-linux/v2.21/ xz fi # modified sources downloaded from ardour.org defmod libsigcpp libsigc++ 2.2.10 http://ardour.org/files/deps/ bz2 defmod libgnomecanvas 2.30.3 http://ardour.org/files/deps/ gz defmod libsndfile 1.0.25 http://ardour.org/files/deps/ gz mkdir -p $PREFIX export MAKEFLAGS=-j$parallel PATH=$PREFIX/bin:$PATH OSX= if uname -a | grep --silent arwin ; then # its OS X! run for the hills !! OSX=y # tell perl to look in our $PREFIX tree for additional perl modules export PERL5LIB=$PREFIX/System/Library/Perl/$PERLVERSION export DYLD_FALLBACK_LIBRARY_PATH=$PREFIX/lib${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH} # force compilation to use 10.4 APIs only. could be overkill, but better safe than sorry GLOBAL_CFLAGS="-DMAC_OSX_VERSION_MAX_ALLOWED=1040 -mmacosx-version-min=10.4 -O3" # for 10.5 and above, add to CFLAGS # -sysroot=/Developer/SDKs/MacOSX10.4u.sdk" GLOBAL_LDFLAGS="-headerpad_max_install_names" # for 10.5 and above, add to LDFLAGS # "-syslibroot /Developer/SDKs/MacOSX10.4u.sdk" export MACOSX_DEPLOYMENT_TARGET=10.4 else export LD_LIBRARY_PATH=$PREFIX/lib{$LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} GLOBAL_CFLAGS= GLOBAL_LDFLAGS= fi set -e export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} GLOBAL_CONF="--prefix=$PREFIX" if [ ! -d LRDF ] ; then echo LRDF git clone git://github.com/swh/LRDF.git fi for m in $MODS ; do eval "fetch_as \$MOD_${m}_local_tarball \$MOD_${m}_url || die \"downloading $m failed\"" done if [ x$OSX = x ] ; then tar xf $MOD_util_linux_local_tarball && \ (set -e && cd $MOD_util_linux_unpacked && ./configure --prefix=$PREFIX --enable-shared --disable-most-builds --without-ncurses --enable-libuuid && cd libuuid && make && make install) || die "uuid build failed" fi tar xf $MOD_boost_local_tarball && \ (set -e && cd $MOD_boost_unpacked && ./bootstrap.sh --prefix=$PREFIX --with-libraries=exception && ./b2 && ./b2 install) || die "boost build failed" basic_builder curl tar xf $MOD_fftw_local_tarball && \ (set -e && cd $MOD_fftw_unpacked && ./configure --prefix=$PREFIX --enable-shared && make && make install && make clean && ./configure --prefix=$PREFIX --enable-shared --enable-single && make && make install) || die "fftw build failed" basic_builder libsigcpp basic_builder glibmm basic_builder cairomm basic_builder pangomm basic_builder atkmm basic_builder gtkmm basic_builder libart_lgpl basic_builder libgnomecanvas basic_builder libgnomecanvasmm basic_builder liblo basic_builder raptor2 basic_builder rasqal basic_builder redland basic_builder libogg # FLAC will not build correctly on OS X Lion with asm optimization enabled, so lets at least force SSE if [ x$OSX != x ] ; then tar xf $MOD_flac_local_tarball && \ (set -e && cd $MOD_flac_unpacked && CXXFLAGS="$GLOBAL_CFLAGS" CFLAGS="$GLOBAL_CFLAGS" LDFLAGS="$GLOBAL_LDFLAGS" ./configure --prefix=$PREFIX --disable-cpplibs --disable-asm-optimizations --enable-sse --disable-debug && make && make install) || die "flac build failed" else tar xf $MOD_flac_local_tarball && \ (set -e && cd $MOD_flac_unpacked && CXXFLAGS="$GLOBAL_CFLAGS" CFLAGS="$GLOBAL_CFLAGS" LDFLAGS="$GLOBAL_LDFLAGS" ./configure --prefix=$PREFIX --disable-cpplibs --disable-debug && make && make install) || die "flac build failed" fi basic_builder libvorbis if [ x$OSX != x ] ; then # sndfile-play incorrectly includes which no longer works on Lion tar xf $MOD_libsndfile_local_tarball && \ (set -e && cd $MOD_libsndfile_unpacked && CFLAGS="$GLOBAL_CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers" LDFLAGS="$GLOBAL_LDFLAGS" ./configure --prefix=$PREFIX --disable-silent-rules && make && make install) || die "sndfile build failed" # samplerate incorrectly includes which no longer works on Lion tar xf $MOD_libsamplerate_local_tarball && \ (set -e && cd $MOD_libsamplerate_unpacked && CFLAGS="$GLOBAL_CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers" LDFLAGS="$GLOBAL_LDFLAGS" ./configure --prefix=$PREFIX && make && make install) || die "samplerate build failed" else basic_builder libsndfile basic_builder libsamplerate fi # aubio has an old version of install.sh which can exit with an error during parallel make install # it also doesn't use pkg-config to test for FFTW3, sigh. remove_fftw3_h= if [ ! -f /usr/include/fftw3.h ] ; then remove_fftw3_h=y sudo ln -s $PREFIX/include/fftw3.h /usr/include fi tar xf $MOD_aubio_local_tarball && (set -e && cd $MOD_aubio_unpacked && sed '/no-long-double/d' < ./configure > ./configure.XXX && mv ./configure.XXX ./configure && chmod +x ./configure && \ CFLAGS="$GLOBAL_CFLAGS -I$PREFIX" LDFLAGS="$GLOBAL_LDFLAGS -lm" ./configure --prefix=$PREFIX && make && MAKEFLAGS=-j1 make install) || die "aubio build failed" if [ x$remove_fftw3_h != x ] ; then sudo rm /usr/include/fftw3.h fi # these python lib wants to install to a system-wide location tar xf $MOD_rdflib_local_tarball && \ (set -e && cd $MOD_rdflib_unpacked && unset MACOSX_DEPLOYMENT_TARGET && python ./setup.py build && sudo python ./setup.py install) tar xf $MOD_setuptools_local_tarball && \ (set -e && cd $MOD_setuptools_unpacked && unset MACOSX_DEPLOYMENT_TARGET && python ./setup.py build && sudo python ./setup.py install) tar xf $MOD_isodate_local_tarball && \ (set -e && cd $MOD_isodate_unpacked && unset MACOSX_DEPLOYMENT_TARGET && python ./setup.py build && sudo python ./setup.py install) (set -e && cd LRDF && \ sed 's/glibtoolize/libtoolize/g' < autogen.sh > ag.sh && mv ag.sh autogen.sh && \ CFLAGS="$GLOBAL_CFLAGS -I$PREFIX/include" LDFLAGS="$GLOBAL_LDFLAGS" sh ./autogen.sh --prefix=$PREFIX && make && make install) || die "LRDF build failed" basic_builder pcre tar xf $MOD_lv2_local_tarball && \ (set -e && cd $MOD_lv2_unpacked && unset MACOSX_DEPLOYMENT_TARGET && ./waf configure --prefix=$PREFIX --copy-headers && ./waf build && sudo ./waf install) || die "LV2 build failed" waf_builder serd waf_builder sord waf_builder sratom tar xf $MOD_lilv_local_tarball && \ (set -e && cd $MOD_lilv_unpacked && ./waf configure --prefix=$PREFIX --default-lv2-path='~/.lv2:/usr/local/lib/lv2:/usr/local/lib64/lv2:/usr/lib/lv2:/usr/lib64/lv2' && ./waf build && ./waf install && fix_install_name $PREFIX/lib/liblilv-0.dylib) || die "lilv build failed" tar xf $MOD_suil_local_tarball && \ (set -e && cd $MOD_suil_unpacked && CFLAGS="-I$PREFIX/include" ./waf configure --prefix=$PREFIX && ./waf && ./waf install && fix_install_name $PREFIX/lib/libsuil-0.dylib) || die "suil build failed"