diff --git a/tools/linux_packaging/ardour.sh.in b/tools/linux_packaging/ardour.sh.in index c36e91bc24..d288cf6159 100644 --- a/tools/linux_packaging/ardour.sh.in +++ b/tools/linux_packaging/ardour.sh.in @@ -1,5 +1,10 @@ #!/bin/sh +#LD_LIBRARY_PATH needs to be set (empty) so that epa can swap between the original and the bundled version +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + +export PREBUNDLE_ENV="$(env)" + BIN_DIR=$(dirname $(readlink -f $0)) INSTALL_DIR=$(dirname $BIN_DIR) LIB_DIR=$INSTALL_DIR/lib @@ -20,6 +25,7 @@ export ARDOUR_BUNDLED=true %ENV% export GTK_PATH=$INSTALL_DIR${GTK_PATH:+:$GTK_PATH} +export GTK_MODULES="" # Disable extra modules from being loaded by gtk (example, libcanberra-gtk-module.so) export LD_LIBRARY_PATH=$INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} # create install-location-dependent config files for Pango and GDK image loaders @@ -28,7 +34,7 @@ export LD_LIBRARY_PATH=$INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} sed "s?@ROOTDIR@/modules?$LIB_DIR/modules?" < $ETC_DIR/pango.modules.in > $USER_ARDOUR_DIR/pango.modules sed "s?@ROOTDIR@/loaders?$LIB_DIR/loaders?" < $ETC_DIR/gdk-pixbuf.loaders.in > $USER_ARDOUR_DIR/gdk-pixbuf.loaders -exec $INSTALL_DIR/bin/ardour-2.8.11 "$@" +exec $INSTALL_DIR/bin/ardour-%VER% "$@" diff --git a/tools/linux_packaging/build b/tools/linux_packaging/build index 4d2d0d9f1a..1c80f8d45b 100755 --- a/tools/linux_packaging/build +++ b/tools/linux_packaging/build @@ -15,42 +15,55 @@ PRINT_SYSDEPS= WITH_NLS= EXTERNAL_JACK= +if [ $# -eq 0 ] ; then + echo "" + echo "ERROR - Please specify build type" + echo " --public" + echo " --sae" + echo "" + exit 1 +fi + while [ $# -gt 0 ] ; do - echo "arg = $1" - case $1 in + echo "arg = $1" + case $1 in # # top level build targets # - --sae) WITH_NLS= ; - SAE=1 ; - INTERNAL_JACK=1; - WITH_LADSPA=1; - STRIP= ; - APPNAME=Ardour ; - shift ;; - --mixbus) MIXBUS=1; - WITH_NLS=1 ; - SAE= ; - INTERNAL_JACK=; - WITH_LADSPA=; - STRIP= ; - APPNAME=Mixbus ; - shift ;; - --public) WITH_NLS=1 ; - SAE= ; - INTERNAL_JACK=; - WITH_LADSPA=; - STRIP= ; - APPNAME=Ardour ; - shift ;; - --allinone) SAE= ; - WITH_NLS= ; - INTERNAL_JACK=1; - WITH_LADSPA=1; - STRIP= ; - shift ;; + --sae) + WITH_NLS= ; + SAE=1 ; + INTERNAL_JACK=1; + WITH_LADSPA=1; + STRIP= ; + APPNAME=Ardour ; + shift ;; + --mixbus) + MIXBUS=1; + WITH_NLS=1 ; + SAE= ; + INTERNAL_JACK=; + WITH_LADSPA=; + STRIP= ; + APPNAME=Mixbus ; + shift ;; + --public) + WITH_NLS=1 ; + SAE= ; + INTERNAL_JACK=; + WITH_LADSPA=; + STRIP= ; + APPNAME=Ardour ; + shift ;; + --allinone) + SAE= ; + WITH_NLS= ; + INTERNAL_JACK=1; + WITH_LADSPA=1; + STRIP= ; + shift ;; --test) SAE= ; INTERNAL_JACK=; WITH_LADSPA=; STRIP= ; shift ;; # @@ -63,11 +76,19 @@ while [ $# -gt 0 ] ; do --sysdeps) PRINT_SYSDEPS=1; shift ;; --nls) WITH_NLS=1 ; shift ;; --external_jack) EXTERNAL_JACK=$2; shift ; shift ;; - esac + + *) + #catch all for unknown arguments + echo "" + echo "!!! ERROR !!! - Unknown argument $1" + echo "" + exit 1 + ;; + esac done if [ x$EXTERNAL_JACK != x -a x$INTERNAL_JACK != x ] ; then - echo "It makes no sense to package JACK internally and externally. Please pick one." + echo "It makes no sense to package JACK internally and externally. Please pick one." fi release_version=`grep -m 1 '^ardour_version' ../../SConstruct | cut -d' ' -f 3 | sed "s/'//g"` @@ -76,9 +97,29 @@ echo "Version is $release_version / $svn_version" info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`" echo "Info string is $info_string" +# Figure out our CPU type +case `uname -m` in + i[3456789]86|x86|i86pc) + echo "Architecture is x86" + ARCH='x86' + ARCH_BITS='32-bit' + ;; + x86_64|amd64|AMD64) + echo "Architecture is x86_64" + ARCH='x86_64' + ARCH_BITS='64-bit' + ;; + *) + echo "" + echo "ERROR - Unknown architecture `uname -m`" + echo "" + exit 1 + ;; +esac + # setup directory structure -APPDIR=${APPNAME} +APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version} APPBIN=$APPDIR/bin APPLIB=$APPDIR/lib Libraries=$APPLIB @@ -91,23 +132,23 @@ Locale=$Shared/locale Modules=$Libraries/modules Loaders=$Libraries/loaders + if [ x$PRINT_SYSDEPS != x ] ; then # # print system dependencies # - for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do - if ! file $file | grep -qs Mach-O ; then - continue - fi - otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)" - done | sort | uniq - exit 0 + for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do + if ! file $file | grep -qs Mach-O ; then + continue + fi + otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)" + done | sort | uniq + exit 0 fi echo "Removing old $APPDIR tree ..." - -rm -rf $APPDIR +rm -rf $APPDIR/ echo "Building new app directory structure ..." @@ -132,25 +173,21 @@ rm -f $ENVIRONMENT touch $ENVIRONMENT if test x$SAE != x ; then - appname="Ardour2/SAE" - echo "export ARDOUR_SAE=true" >> $ENVIRONMENT - # - # current default for SAE version is German keyboard layout without a keypad - # - echo export ARDOUR_KEYBOARD_LAYOUT=de-nokeypad >> $ENVIRONMENT - echo export ARDOUR_UI_CONF=ardour2_ui_sae.conf >> $ENVIRONMENT - echo export ARDOUR2_UI_RC=ardour2_ui_dark_sae.rc >> $ENVIRONMENT + echo "export ARDOUR_SAE=true" >> $ENVIRONMENT + # + # current default for SAE version is German keyboard layout without a keypad + # + echo export ARDOUR_KEYBOARD_LAYOUT=de-nokeypad >> $ENVIRONMENT + echo export ARDOUR_UI_CONF=ardour2_ui_sae.conf >> $ENVIRONMENT + echo export ARDOUR2_UI_RC=ardour2_ui_dark_sae.rc >> $ENVIRONMENT elif test x$MIXBUS != x ; then - appname="Ardour2/Mixbus" - echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT - # - # current default for MIXBUS version is US keyboard layout without a keypad - # - echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT - echo export ARDOUR_UI_CONF=ardour2_ui.conf >> $ENVIRONMENT - echo export ARDOUR2_UI_RC=ardour2_ui_dark.rc >> $ENVIRONMENT -else - appname="Ardour2" + echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT + # + # current default for MIXBUS version is US keyboard layout without a keypad + # + echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT + echo export ARDOUR_UI_CONF=ardour2_ui.conf >> $ENVIRONMENT + echo export ARDOUR2_UI_RC=ardour2_ui_dark.rc >> $ENVIRONMENT fi # @@ -162,95 +199,223 @@ echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT # create startup helper script -sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' < ardour.sh.in > $APPBIN/ardour2 +sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour2 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour2 MAIN_EXECUTABLE=ardour-$release_version echo "Copying ardour executable ...." cp ../../gtk2_ardour/$MAIN_EXECUTABLE $APPBIN if test x$STRIP != x ; then - strip $APPBIN/$MAIN_EXECUTABLE + strip $APPBIN/$MAIN_EXECUTABLE fi # copy locale files if test x$WITH_NLS != x ; then - echo "NLS support ..." - echo "I hope you remembered to run scons msgupdate!" - LINGUAS= - for file in ../../gtk2_ardour/*.mo - do - lang=`basename $file | sed 's/\.mo//'` - mkdir -p $Locale/$lang/LC_MESSAGES - cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo - LINGUAS="$LINGUAS $lang" - done - for file in ../../libs/ardour/*.mo - do - lang=`basename $file | sed 's/\.mo//'` - mkdir -p $Locale/$lang/LC_MESSAGES - cp $file $Locale/$lang/LC_MESSAGES/libardour.mo - done + echo "NLS support ..." + echo "I hope you remembered to run scons msgupdate!" + LINGUAS= + files=`find ../../gtk2_ardour/ -name "*.mo"` - GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo" - LOCALEROOT=/usr/share/locale + if [ -z "$files" ]; then + echo "" + echo "!!!! WARNING !!!! - Did not find any .mo files in ../../gtk2_ardour" + echo "" + fi + + for file in $files + do + echo $file + lang=`basename $file | sed 's/\.mo//'` + mkdir -p $Locale/$lang/LC_MESSAGES + cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo + LINGUAS="$LINGUAS $lang" + done - for l in $LINGUAS ; do - echo "Copying GTK i18n files for $l..." - for MO in $GTK_MESSAGES ; do - if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then - cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES - else - # try with just the language spec - just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'` - if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then - cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES - fi - fi - done - done + files=`find ../../libs/ardour/ -name "*.mo"` + + if [ -z "$files" ]; then + echo "" + echo "!!!! WARNING !!!! - Did not find any .mo files in ../../libs/ardour" + echo "" + fi + + for file in $files + do + echo $file + lang=`basename $file | sed 's/\.mo//'` + mkdir -p $Locale/$lang/LC_MESSAGES + cp $file $Locale/$lang/LC_MESSAGES/libardour.mo + done + + GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo" + LOCALEROOT=/usr/share/locale + + for l in $LINGUAS ; do + echo "Copying GTK i18n files for $l..." + for MO in $GTK_MESSAGES ; do + if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then + cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES + else + # try with just the language spec + just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'` + if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then + cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES + fi + fi + done + done else - echo "Skipping NLS support" + echo "Skipping NLS support" +fi + +### Find gtk ### +GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"` +if [ ! -z "$GTKROOT" ]; then + echo "Found GTKROOT using pkg-config" +elif [ -d /usr/lib/gtk-2.0 ]; then + GTKROOT="/usr/lib/gtk-2.0" +elif [ -d /usr/local/lib/gtk-2.0 ]; then + GTKROOT="/usr/local/lib/gtk-2.0" +else + echo "" + echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit" + echo "" + exit 1 +fi + +echo "GTKROOT is ${GTKROOT}" +versionDir=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"` + +num=0 +for name in $versionDir ; do + let "num += 1" +done + +if [ $num -eq 1 ]; then + GTKLIB=${GTKROOT}/gtk-2.0/$versionDir + echo "GTKLIB is ${GTKLIB}" +else + echo "" + echo "!!! ERROR !!! - More than one gtk-2.0 version found in ${GTKROOT}/gtk-2.0/ ( $versionDir ). Packager will exit" + echo "" + exit 1 +fi + + +### Find pango ### +PANGOROOT=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g"` +if [ ! -z "$PANGOROOT" ]; then + echo "Found PANGOROOT using pkg-config" +elif [ -d /usr/lib/pango ]; then + PANGOROOT="/usr/lib/pango" +elif [ -d /usr/local/lib/pango ]; then + PANGOROOT="/usr/local/lib/pango" +else + echo "" + echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit" + echo "" + exit 1 +fi + +echo "PANGOROOT is ${PANGOROOT}" +versionDir=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"` + +num=0 +for name in $versionDir ; do + let "num += 1" +done + +if [ $num -eq 1 ]; then + PANGOLIB=${PANGOROOT}/pango/$versionDir + echo "PANGOLIB is ${PANGOLIB}" +else + echo "" + echo "!!! ERROR !!! - More than one pango version found in ${PANGOROOT}/pango/ ( $versionDir ). Packager will exit" + echo "" + exit 1 +fi + + +### Find gdk-pixbuf ### +GDKPIXBUFROOT=`pkg-config --libs-only-L gdk-pixbuf-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"` +if [ ! -z "$GDKPIXBUFROOT" ]; then + echo "Found GDKPIXBUFROOT using pkg-config" +elif [ -d /usr/lib/gdk-pixbuf-2.0 ]; then + GDKPIXBUFROOT="/usr/lib/gdk-pixbuf-2.0" +elif [ -d /usr/local/lib/gdk-pixbuf-2.0 ]; then + GDKPIXBUFROOT="/usr/local/lib/gdk-pixbuf-2.0" +elif [ -d ${GTKLIB}/loaders ]; then #odd ball case + GDKPIXBUFROOT=${GTKROOT} + GDKPIXBUFLIB=${GTKLIB} +else + echo "" + echo "!!! ERROR !!! - Unable to locate gdk-pixbuf-2.0 directory. Packager will exit" + echo "" + exit 1 +fi + +echo "GDKPIXBUFROOT is ${GDKPIXBUFROOT}" + +if [ -z ${GDKPIXBUFLIB} ]; then + versionDir=`ls ${GDKPIXBUFROOT}/gdk-pixbuf-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"` + + num=0 + for name in $versionDir ; do + let "num += 1" + done + + if [ $num -eq 1 ]; then + GDKPIXBUFLIB=${GDKPIXBUFROOT}/gdk-pixbuf-2.0/$versionDir + echo "GDKPIXBUFLIB is ${GDKPIXBUFLIB}" + else + echo "" + echo "!!! ERROR !!! - More than one gdk-pixbuf-2.0 version found in ${GDKPIXBUFROOT}/pango/ ( $versionDir ). Packager will exit" + echo "" + exit 1 + fi fi -GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed s/-L//` -GTKROOT=`dirname $GTKROOT` -echo GTK stack root is $GTKROOT -GTKETC=${GTKROOT}/etc/gtk-2.0 -GTKLIB=${GTKROOT}/lib/gtk-2.0/2.10.0 -PANGOLIB=${GTKROOT}/lib/pango/1.6.0 -GDKPIXBUFLIB=${GTKROOT}/lib/gdk-pixbuf-2.0/2.10.0 -cp -R $GTKETC/* $Etc echo "Copying all Pango modules ..." cp -R $PANGOLIB/modules/*.so $Modules + echo "Copying all GDK Pixbuf loaders ..." cp -R $GDKPIXBUFLIB/loaders/*.so $Loaders -pwd=`pwd` - -if test x$WITH_LADSPA != x ; then - if test x$SAE != x ; then - plugdir=sae_ladspa - elif test x$MIXBUS != x ; then - plugdir=mixbus_ladspa - else - plugdir=ladspa - fi - echo "Copying `ls $plugdir | wc -l` plugins ..." - if [ -d $plugdir ] ; then - cp -r $plugdir/* $Plugins - fi -fi - -pango-querymodules | sed "s?$GTKROOT/lib/pango/[0-9][0-9]*\.[0-9][0-9]*.[0-9][0-9]*/?@ROOTDIR@/?" > $Etc/pango.modules.in -gdk-pixbuf-query-loaders | sed "s?$GTKROOT/lib/gdk-pixbuf-2.0/[0-9][0-9]*\.[0-9][0-9]*.[0-9][0-9]*/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in +pango-querymodules | sed "s?$PANGOLIB/?@ROOTDIR@/?" > $Etc/pango.modules.in +gdk-pixbuf-query-loaders | sed "s?$GDKPIXBUFLIB/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in # We sort of rely on clearlooks, so include a version # this one is special - we will set GTK_PATH to $Libraries/clearlooks -cp /usr/lib64/gtk-2.0/2.10.0/engines/libclearlooks.so $Libraries + +if [ ! -e ${GTKLIB}/engines/libclearlooks.so ]; then + echo "" + echo "!!! ERROR !!! - not able to locate libclearlooks.so" + echo "" + echo "Packager with exit" + exit 1 +fi + +echo "Copying clearlooks ..." +cp ${GTKLIB}/engines/libclearlooks.so $Libraries mkdir -p $Libraries/clearlooks/engines -(cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks.so* ) +(cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks* libclearlooks.so ) + +# LADSPA +if test x$WITH_LADSPA != x ; then + if test x$SAE != x ; then + plugdir=sae_ladspa + elif test x$MIXBUS != x ; then + plugdir=mixbus_ladspa + else + plugdir=ladspa + fi + echo "Copying `ls $plugdir | wc -l` plugins ..." + if [ -d $plugdir ] ; then + cp -r $plugdir/* $Plugins + fi +fi # XXX STILL NEED TO DO PANNERS FOR TRUNK cp ../../libs/surfaces/*/libardour_*.so* $Surfaces @@ -263,56 +428,88 @@ cp ../../libs/vamp-plugins/libardourvampplugins.so* $Libraries OURLIBDIR=../../libs OURLIBS=$OURLIBDIR/vamp-sdk:$OURLIBDIR/surfaces/control_protocol:$OURLIBDIR/ardour:$OURLIBDIR/midi++2:$OURLIBDIR/pbd:$OURLIBDIR/rubberband:$OURLIBDIR/soundtouch:$OURLIBDIR/gtkmm2ext:$OURLIBDIR/sigc++2:$OURLIBDIR/glibmm2:$OURLIBDIR/gtkmm2/atk:$OURLIBDIR/gtkmm2/pango:$OURLIBDIR/gtkmm2/gdk:$OURLIBDIR/gtkmm2/gtk:$OURLIBDIR/libgnomecanvasmm:$OURLIBDIR/libsndfile +echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + +checkedIdx=0 + while [ true ] ; do - missing=false - for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do - if ! file $file | grep -qs ELF ; then - continue - fi - # do not include libjack - deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}' | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.'` - # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.' - echo -n "." - for dep in $deps ; do - if [ "x$dep" = "xnot" ] ; then - echo "Missing dependant library. Use ldd to find and fix" - exit 1 - fi + missing=false + filelist=`find $APPLIB/ -type f` + filelist="$APPBIN/$MAIN_EXECUTABLE $filelist" - # don't use anything mapped at a specific address - if echo $dep | grep -qs '0x' ; then continue; fi - # don't include any X Window libraries - if echo $dep | grep -qs libX ; then continue; fi - # don't include libc - if echo $dep | grep -qs 'libc\.' ; then continue; fi - - base=`basename $dep` - if ! test -f $Libraries/$base; then - if echo $dep | grep -sq '^libs' ; then - # echo Copying ../../$dep - cp ../../$dep $Libraries - else - # echo Copying $dep - cp $dep $Libraries + for file in $filelist ; do + if ! file $file | grep -qs ELF ; then + continue fi - missing=true - fi + + # speed this up a bit by not checking things multiple times. + for i in "${depCheckedList[@]}"; do + if [ $i == $file ]; then + continue 2 + fi + done + depCheckedList[$checkIdx]=$file + let "checkIdx += 1" + + # do not include libjack + deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'` + + # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.' + echo -n "." + for dep in $deps ; do + if test "not" = ${dep}; then + echo "" + echo "!!! ERROR !!! - Missing dependant library for $file." + echo "" + (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file) + echo "" + echo "!!! ERROR !!! - See Above" + exit 1 + fi + + # don't use anything mapped at a specific address + if echo $dep | grep -qs '0x' ; then continue; fi + # don't include /lib + if echo $dep | grep -qs "^/lib/" ; then continue; fi + # don't include jack + if echo $dep | grep -qs libjack ; then continue; fi + # don't include any X Window libraries + if echo $dep | grep -qs libX ; then continue; fi + if echo $dep | grep -qs libxcb ; then continue; fi + # don't include libc + if echo $dep | grep -qs 'libc\.' ; then continue; fi + # don't include libstdc++ + if echo $dep | grep -qs libstdc++ ; then continue; fi + + base=`basename $dep` + if ! test -f $Libraries/$base; then + parent=$(basename ${file}) + if echo $dep | grep -sq '^libs' ; then + echo "Copying dependant lib ../../$dep (required by ${parent})" + cp ../../$dep $Libraries + else + echo "Copying dependant lib $dep (required by ${parent})" + cp $dep $Libraries + fi + missing=true + fi + done done - done - if test x$missing = xfalse ; then - # everything has been found - break - fi + if test x$missing = xfalse ; then + # everything has been found + break + fi done echo # strip libraries echo Stripping libraries -strip $APPLIB/*.so* +find $APPLIB/ -name "*.so*" | xargs strip +find $APPLIB/ -name "*.so*" | xargs chmod a+rx echo "Copying other stuff to $APPDIR ..." -cp ../../gtk2_ardour/ergonomic-us.bindings $Etc +cp ../../gtk2_ardour/ergonomic-us.bindings $Etc cp ../../gtk2_ardour/mnemonic-us.bindings $Etc cp ../../gtk2_ardour/SAE-de-keypad.bindings $Etc cp ../../gtk2_ardour/SAE-de-nokeypad.bindings $Etc @@ -321,15 +518,15 @@ cp ../../gtk2_ardour/SAE-us-nokeypad.bindings $Etc cp ../../gtk2_ardour/ardour.menus $Etc cp ../../gtk2_ardour/ardour-sae.menus $Etc if test x$SAE != x ; then - cp ../../ardour_system_sae.rc $Etc/ardour_system.rc - echo cp ../../ardour_system_sae.rc $Etc/ardour_system.rc - cp ../../instant.xml.sae $Etc/instant.xml - echo cp ../../instant.xml.sae $Etc/instant.xml + cp ../../ardour_system_sae.rc $Etc/ardour_system.rc + echo cp ../../ardour_system_sae.rc $Etc/ardour_system.rc + cp ../../instant.xml.sae $Etc/instant.xml + echo cp ../../instant.xml.sae $Etc/instant.xml else -# cp ../../ardour_system.rc $Etc/ardour_system.rc -# echo FOO cp ../../ardour_system.rc $Etc/ardour_system.rc - cp ../../instant.xml $Etc/instant.xml - echo cp ../../instant.xml $Etc/instant.xml + cp ../../ardour_system.rc $Etc/ardour_system.rc + echo cp ../../ardour_system.rc $Etc/ardour_system.rc + cp ../../instant.xml $Etc/instant.xml + echo cp ../../instant.xml $Etc/instant.xml fi cp ../../gtk2_ardour/ardour2_ui_sae.conf $Etc cp ../../gtk2_ardour/ardour2_ui_default.conf $Etc @@ -347,7 +544,7 @@ cp -r ../../gtk2_ardour/pixmaps $Etc # if [ -d specialSauce ] ; then - cp -r specialSauce $Etc + cp -r specialSauce $Etc fi # share stuff @@ -357,38 +554,46 @@ cp ../../templates/*.template $Shared/templates/ # go through and recursively remove any .svn dirs in the bundle for svndir in `find $APPDIR -name .svn -type d`; do - rm -rf $svndir + rm -rf $svndir done +#Sanity Check file +if [ -e ../sanity_check/sanityCheck ]; then + cp ../sanity_check/sanityCheck $APPDIR +else + echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete" + exit 1 +fi + # # and now ... the final package # if [ x$SAE != x ] ; then - # SAE packaging - - echo "Creating SAE packaging directory" - cp HowToInstallArdourSAE.pdf "$APPDIR/How To Install Ardour SAE.pdf" - cp SAE-de-keypad.pdf "$APPDIR/Ardour SAE Shortcuts (keypad).pdf" - cp SAE-de-nokeypad.pdf "$APPDIR/Ardour SAE Shortcuts.pdf" - + # SAE packaging + + echo "Creating SAE packaging directory" + cp HowToInstallArdourSAE.pdf "$APPDIR/How To Install Ardour SAE.pdf" + cp SAE-de-keypad.pdf "$APPDIR/Ardour SAE Shortcuts (keypad).pdf" + cp SAE-de-nokeypad.pdf "$APPDIR/Ardour SAE Shortcuts.pdf" + elif [ x$MIXBUS != x ] ; then - # Mixbus packaging + # Mixbus packaging - echo "Creating Mixbus packaging directory" - cp MixBus_Install_QuickStart.pdf "$APPDIR/Mixbus Install & Quick Start Guide.pdf" - - if [ -x $EXTERNAL_JACK != x ] ; then - cp $EXTERNAL_JACK $PRODUCT_PKG_DIR - fi + echo "Creating Mixbus packaging directory" + cp MixBus_Install_QuickStart.pdf "$APPDIR/Mixbus Install & Quick Start Guide.pdf" + + if [ -x $EXTERNAL_JACK != x ] ; then + cp $EXTERNAL_JACK $PRODUCT_PKG_DIR + fi fi -#echo "Building tarball ..." +echo "Building tarball ..." -#rm -f $APPNAME-$release_version.tar.bz2 -#tar -jcf $APPNAME-$release_version.tar.bz2 $APPDIR +rm -f $APPDIR.tar.bz2 +tar -cjf $APPDIR.tar.bz2 $APPDIR echo "Done." diff --git a/tools/linux_packaging/install.sh b/tools/linux_packaging/install.sh new file mode 100755 index 0000000000..43e86b2fb2 --- /dev/null +++ b/tools/linux_packaging/install.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Make sure we have a terminal for the user to see and then run +# the real install script. + +if [ -z $WINDOWID ]; then + if which xterm > /dev/null; then + exec xterm -e ./stage2.run + elif which gnome-terminal > /dev/null; then + exec gnome-terminal -e ./stage2.run + elif which konsole > /dev/null; then + exec konsole -e ./stage2.run + fi +else + ./stage2.run +fi diff --git a/tools/linux_packaging/package b/tools/linux_packaging/package new file mode 100755 index 0000000000..76473e68a6 --- /dev/null +++ b/tools/linux_packaging/package @@ -0,0 +1,85 @@ +#!/bin/bash + +# bundle + +if [ $# -eq 0 ] ; then + echo "" + echo "ERROR - Please specify build type" + echo " --public" + echo " --sae" + echo "" + exit 1 +fi + +while [ $# -gt 0 ] ; do + echo "arg = $1" + case $1 in + + # + # top level build targets + # + + --sae) + APPNAME=Ardour ; + shift ;; + --mixbus) + APPNAME=Mixbus ; + shift ;; + --public) + APPNAME=Ardour ; + shift ;; + + *) + #catch all for unknown arguments + echo "" + echo "!!! ERROR !!! - Unknown argument $1" + echo "" + exit 1 + ;; + esac +done + + +release_version=`grep -m 1 '^ardour_version' ../../SConstruct | cut -d' ' -f 3 | sed "s/'//g"` +svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d' ' -f 6 | sed 's/[";]//g'` + +X86_BUILD="${APPNAME}_x86-${release_version}_${svn_version}.tar.bz2" +X86_64_BUILD="${APPNAME}_x86_64-${release_version}_${svn_version}.tar.bz2" +PACKAGE="${APPNAME}-${release_version}_${svn_version}" + +if [ ! -e ${X86_BUILD} ]; then + echo "" + echo "!!! ERROR !!! - Can't locate x86 build file ${X86_BUILD}" + echo "" + exit 1 +fi + +if [ ! -e ${X86_64_BUILD} ]; then + echo "" + echo "!!! ERROR !!! - Can't locate x86_64 build file ${X86_64_BUILD}" + echo "" + exit 1 +fi + +echo "Cleaning up any old package files for this build" +#Get rid of any old packages of this same name. +rm -f ${PACKAGE}.tar.bz2 +rm -rf ${PACKAGE} + + +echo "Creating new package dir..." +mkdir ${PACKAGE} +mv ${X86_BUILD} ${PACKAGE} +mv ${X86_64_BUILD} ${PACKAGE} +cp install.sh ${PACKAGE} +cp stage2.run ${PACKAGE} + +echo "Creating tarball..." +tar -czf ${PACKAGE}.tar.gz ${PACKAGE} + +echo "Clean up" +rm -rf ${PACKAGE} + +echo "" +echo "Done" +echo "" diff --git a/tools/linux_packaging/stage2.run b/tools/linux_packaging/stage2.run new file mode 100755 index 0000000000..5c0f0dfa71 --- /dev/null +++ b/tools/linux_packaging/stage2.run @@ -0,0 +1,495 @@ +#!/bin/sh + +#################################### +# +# stage2.run +# Ardour/Mixbus bundle installer +# Todd Naugle +# +################################### + + + +PGM_NAME="Ardour" +PGM_VENDOR="Ardour" +PGM_EXEC_FILE="ardour2" + +INSTALL_DEST_BASE="/usr/local/bin" + +#### Derived Variables #### +PGM_NAME_LOWER=$(echo $PGM_NAME | tr '[:upper:]' '[:lower:]') +ICON_NAME="${PGM_VENDOR}-${PGM_NAME}" +MENU_FILE="${PGM_VENDOR}-${PGM_NAME}.desktop" +DESKTOP_LINK_FILE="${PGM_NAME}.desktop" + +PGM_EXEC_PATH="${INSTALL_DEST_BASE}/${PGM_NAME}/bin/${PGM_EXEC_FILE}" +ICON_PATH="${INSTALL_DEST_BASE}/${PGM_NAME}/etc/icons" +MENU_FILE_PATH="${INSTALL_DEST_BASE}/${PGM_NAME}/${MENU_FILE}" + +#### Global Variables #### +HAS_XDG="T" + +######################## +# Function Definitions +######################## + +VaildateYesNoQuestion () +{ + # $1 = Question Text + + local INPUT_OK="n" + local USER_INPUT="" + + until test "y" = $INPUT_OK; + do + echo "" + read -p "$1 [y/n]: " USER_INPUT + echo "" + + if [ ! -z $USER_INPUT ]; + then + if [ "Y" = $USER_INPUT -o "y" = $USER_INPUT -o "n" = $USER_INPUT -o "N" = $USER_INPUT ]; + then + INPUT_OK="y" + fi + fi + done + + echo $USER_INPUT | tr '[:upper:]' '[:lower:]' + +} + +SystemInstall () +{ + + # Determine which software install app to use and then install requested package + # $1 = Package Name + + if which yum > /dev/null; + then + sudo yum -y install $1 + rtrn=$? + + if [ $rtrn -ne 0 ]; + then + echo "" + echo "!!! ERROR !!! yum install failed for an unknown reason." + echo "Please install package $1 after this installer completes." + echo "" + fi + + elif which apt-get > /dev/null; + then + sudo apt-get -y install $1 + rtrn=$? + + if [ $rtrn -ne 0 ]; + then + echo "" + echo "!!! ERROR !!! apt-get install failed for an unknown reason." + echo "Please install package $1 after this installer completes." + echo "" + fi + + else + echo "" + echo "!!! ERROR !!! - Not able to detect which software install tool to use (yum or apt-get)." + echo "Please install package $1 using the system software install tool." + echo "" + rtrn=1 + fi + + return $rtrn + +} + +######################################################################## +# Main +######################################################################## + +############## +# Check sudo +############## + +if ! sudo date; +then + echo "" + echo "!!! ERROR !!!" + echo "" + echo "Either you don't know the root password or the user is not allowed to sudo" + echo "Please correct this and run the installer again (hint: use visudo to edit sudoers file)" + echo "" + read -p "Press ENTER to exit installer:" BLAH + exit 1 +fi + +############################ +# Determine processor type +############################ + +case `uname -m` in + i[3456789]86|x86|i86pc) + echo "Architecture is x86" + ARCH='x86' + BUNDLE_DIR=${PGM_NAME}_${ARCH}-* + ;; + x86_64|amd64|AMD64) + echo "Architecture is x86_64" + ARCH='x86_64' + BUNDLE_DIR=${PGM_NAME}_${ARCH}-* + ;; + *) + echo "" + echo "!!! ERROR !!! - Unknown architecture `uname -m`" + echo "" + read -p "Press ENTER to exit installer:" BLAH + exit 1 + ;; +esac + +# untar the correct bundle for us to install +echo "Unpacking bundle for $ARCH" +tar -xjf ${BUNDLE_DIR}.tar.bz2 + + +####################### +# Check for xdg utils +####################### + +XDG_MENU_VER=$(xdg-desktop-menu --version 2> /dev/null) +if [ -z "$XDG_MENU_VER" ]; +then + echo "System does not have xdg-desktop-menu installed" + HAS_XDG="F" +fi + +XDG_ICON_VER=$(xdg-icon-resource --version 2> /dev/null) +if [ -z "$XDG_ICON_VER" ]; +then + echo "System does not have xdg-icon-resource installed" + HAS_XDG="F" +fi + +################################################# +# Check if system libs are OK (libc, etc) +################################################# + +echo "" +echo "Checking system libs to see if they are compatible with ${PGM_NAME}." +echo "" + +LIB_ERROR="F" +LD_PATH=`pwd`/${BUNDLE_DIR}/lib + +# check the main App +LDD_RESULT=$(LD_LIBRARY_PATH=${LD_PATH} ldd ${BUNDLE_DIR}/bin/${PGM_NAME_LOWER}-* 2>&1 > /dev/null) + +if [ -n "$LDD_RESULT" ]; +then + echo "$LDD_RESULT" + LIB_ERROR="T" +fi + +# check the libs +LIB_FILES=$(find ${BUNDLE_DIR}/lib -name "*.so") + +for path in $LIB_FILES +do + LDD_RESULT=$(LD_LIBRARY_PATH=${LD_PATH} ldd $path 2>&1 > /dev/null) + if [ -n "$LDD_RESULT" ]; + then + echo "$LDD_RESULT" + LIB_ERROR="T" + fi +done + +if test "T" = $LIB_ERROR; +then + echo "" + echo "!!! ERROR !!! - Missing library detected!" + echo "This system does not have the correct libs to run ${PGM_NAME}." + echo "Installation will not complete. Please use a compatible distro." + echo "" + read -p "Press ENTER to exit installer:" BLAH + exit 1 +fi + + + +################################ +# Install bundle and Menu/Link +################################ + +# uninstall any older versions +if [ -d ${INSTALL_DEST_BASE}/${PGM_NAME} ]; +then + echo "" + echo "Removing existing ${PGM_NAME} installation from ${INSTALL_DEST_BASE}" + echo "" + + if [ "T" = ${HAS_XDG} ]; + then + sudo xdg-desktop-menu uninstall ${MENU_FILE_PATH} + sudo xdg-icon-resource uninstall --size 16 ${ICON_NAME} + sudo xdg-icon-resource uninstall --size 22 ${ICON_NAME} + sudo xdg-icon-resource uninstall --size 32 ${ICON_NAME} + sudo xdg-icon-resource uninstall --size 48 ${ICON_NAME} + + if [ -e /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg ]; + then + sudo rm -f /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg + fi + fi + + if [ -e ~/Desktop/${DESKTOP_LINK_FILE} ]; + then + sudo rm -f ~/Desktop/${DESKTOP_LINK_FILE} + fi + + # delete the old package + sudo rm -rf ${INSTALL_DEST_BASE}/${PGM_NAME} +fi + +echo "" +echo "Installing ${PGM_NAME} in ${INSTALL_DEST_BASE}" +echo "" + +# Copy the new version in the install directory +sudo mkdir ${INSTALL_DEST_BASE}/${PGM_NAME} +sudo cp -Rf ${BUNDLE_DIR}/* ${INSTALL_DEST_BASE}/${PGM_NAME} + +# write the desktop/menu file +echo "[Desktop Entry]" > /tmp/${MENU_FILE} +echo "Encoding=UTF-8" >> /tmp/${MENU_FILE} +echo "Version=1.0" >> /tmp/${MENU_FILE} +echo "Type=Application" >> /tmp/${MENU_FILE} +echo "Terminal=false" >> /tmp/${MENU_FILE} +echo "Exec=${PGM_EXEC_PATH}" >> /tmp/${MENU_FILE} +echo "Name=${PGM_NAME}" >> /tmp/${MENU_FILE} +echo "Icon=${ICON_NAME}" >> /tmp/${MENU_FILE} +echo "Comment=Digital Audio Workstation" >> /tmp/${MENU_FILE} +echo "Categories=AudioVideo;Audio;Recorder;" >> /tmp/${MENU_FILE} + +chmod ugo+rx /tmp/${MENU_FILE} +sudo mv /tmp/${MENU_FILE} ${MENU_FILE_PATH} + +# install the Menu, Link, and Icon(s) +if [ "T" = ${HAS_XDG} ]; +then + echo "Adding ${PGM_NAME} to the applications menu" + sudo xdg-icon-resource install --context apps --size 16 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_16px.png ${ICON_NAME} + sudo xdg-icon-resource install --context apps --size 22 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_22px.png ${ICON_NAME} + sudo xdg-icon-resource install --context apps --size 32 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_32px.png ${ICON_NAME} + sudo xdg-icon-resource install --context apps --size 48 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_48px.png ${ICON_NAME} + + if [ -e ${ICON_PATH}/${PGM_NAME_LOWER}_icon.svg -a -d /usr/share/icons/hicolor/scalable/apps ]; + then + sudo cp -f ${ICON_PATH}/${PGM_NAME_LOWER}_icon.svg /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg + fi + + sudo xdg-desktop-menu install ${MENU_FILE_PATH} + + echo "Creating a desktop link for ${PGM_NAME}" + cp ${MENU_FILE_PATH} ~/Desktop/${DESKTOP_LINK_FILE} + chmod ugo+rx ~/Desktop/${DESKTOP_LINK_FILE} +else + echo "Creating a desktop link for ${PGM_NAME}" + cp ${MENU_FILE_PATH} ~/Desktop/${DESKTOP_LINK_FILE} + chmod ugo+rx ~/Desktop/${DESKTOP_LINK_FILE} +fi + + +########################### +# Check Jack and qjackctl +########################### + +echo "" +echo "Checking to see if Jack is installed" + +if ! which jackd > /dev/null; +then + echo "" + echo "The program Jack is missing from this system. Jack is a required component of $PGM_NAME." + echo "" + + ANSWER=$(VaildateYesNoQuestion "Install jack using system software repository?") + + if test "y" = $ANSWER; + then + echo "Attempting to install Jack" + SystemInstall "jackd" + + if [ $? -ne 0 ]; + then + echo "" + read -p "Press ENTER to continue:" BLAH + fi + fi +else + echo "Jack OK" +fi + + +if ! which qjackctl > /dev/null; +then + echo "" + echo "The program QjackCtl is missing from this system. QjackCtl is an OPTIONAL component of $PGM_NAME." + echo "" + + ANSWER=$(VaildateYesNoQuestion "Install QjackCtl using system software repository?") + + if test "y" = $ANSWER; + then + echo "Attempting to install QjackCtl" + SystemInstall "qjackctl" + + if [ $? -ne 0 ]; + then + echo "" + read -p "Press ENTER to continue:" BLAH + fi + fi +fi + + +######################## +# Run Sanity Check +######################## + +USER_GROUP_ADJUSTED="f" + +if ! ./${BUNDLE_DIR}/sanityCheck -a > /dev/null; +then + echo "" + echo "System failed the quick sanity check... Looking for the cause" + + if ! ./${BUNDLE_DIR}/sanityCheck -rt > /dev/null; + then + echo "" + echo "System does not allow realtime for the current user... Looking for a solution" + + if ./${BUNDLE_DIR}/sanityCheck -hasaudiogroup > /dev/null; + then + if ./${BUNDLE_DIR}/sanityCheck -memberaudiogroup > /dev/null 2>&1; + then + ## This is an odd case. We have an audio group and are a member. + echo "" + echo "!!! WARNING !!! - The current user can not execute realtime processes." + echo "This will adversely affect audio latency." + echo "This system has an audio group and the user is a member. If jack was" + echo "just installed, a simple log out/in may fix this." + echo "" + echo "For best results, please correct this on your system." + echo "(Hint: check /etc/security/limits.conf or /etc/security/limits.d/)" + echo "" + read -p "Press ENTER to continue:" BLAH + else + # Not a member of an audio group. Try to fix it. + + if ./${BUNDLE_DIR}/sanityCheck -hasgroup audio > /dev/null && find /etc/security -type f -name "*.conf" | xargs grep -q "^@audio.*rtprio"; + then + # add user to audio group + echo "" + echo "Adding user `whoami` to the audio group." + echo "This should allow you to run realtime tasks. Please re-login for this change to take affect." + echo "" + read -p "Press ENTER to continue:" BLAH + + user=`whoami` + if sudo usermod -a -G audio $user; + then + USER_GROUP_ADJUSTED="t" + else + echo "" + echo "!!! ERROR !!! - Not able to add user to the audio group (usermod failed)!" + echo "" + echo "Please add yourself to the audio group and re-login" + echo "" + read -p "Press ENTER to continue:" BLAH + fi + + elif ./${BUNDLE_DIR}/sanityCheck -hasgroup jackuser > /dev/null && find /etc/security -type f -name "*.conf" | xargs grep -q "^@jackuser.*rtprio"; + then + # add user to jackuser group + echo "" + echo "Adding user `whoami` to the jackuser group." + echo "This should allow you to run realtime tasks. Please re-login for this change to take affect." + echo "" + read -p "Press ENTER to continue:" BLAH + + user=`whoami` + if sudo usermod -a -G jackuser $user; + then + USER_GROUP_ADJUSTED="t" + else + echo "" + echo "!!! ERROR !!! - Not able to add user to the jackuser group." + echo "" + echo "Please add yourself to the audio group and re-login" + echo "" + read -p "Press ENTER to continue:" BLAH + fi + + + fi + fi + else + # No audio group found on this system! + echo "" + echo "!!! WARNING !!! - The system does not seem to have an audio group (audio or jackuser)." + echo "" + echo "We will not attempt to fix this. Please configure your system to allow" + echo "non-root users to execute realtime tasks." + echo "" + read -p "Press ENTER to continue:" BLAH + fi + fi + + if ! ./${BUNDLE_DIR}/sanityCheck -freqscaling > /dev/null; + then + echo "" + echo "!!! WARNING !!! - Your system seems to use frequency scaling." + echo "This can have a serious impact on audio latency. You have two choices:" + echo "(1) turn it off, e.g. by chosing the 'performance' governor." + echo "(2) Use the HPET clocksource by passing \"-c h\" to JACK" + echo "(this second option only works on relatively recent computers)" + echo "" + read -p "Press ENTER to continue:" BLAH + fi + + if [ "f" = $USER_GROUP_ADJUSTED ]; + then + if ! ./${BUNDLE_DIR}/sanityCheck -memlock > /dev/null; + then + echo "" + echo "!!! WARNING !!! - You are not allowed to lock memory." + echo "" + echo "We will not attempt to fix this. Please configure your system to allow" + echo "non-root users to execute lock memory." + echo "" + read -p "Press ENTER to continue:" BLAH + fi + fi +fi + + +######################## +# Install Complete +######################## + +echo "" +echo "Cleaning up" +rm -rf ${BUNDLE_DIR}/ + +echo "" +echo "!!! Install Complete !!!" + +if [ "t" = $USER_GROUP_ADJUSTED ]; +then + echo "You will need to logout and then login again for all changes to be complete" +fi + +echo "" +read -p "Press ENTER to close this window:" BLAH + +