3 # script for pulling together a Linux app bundle.
5 # This will create a bundle for a single architecture.
6 # Execute this scirpt on both x86 and x86_64 and then use
7 # package to merge the 2 bundles into a final package with the
8 # installer. See "noderun" for a complete build script.
10 # where the GTK stack is installed
11 GTKSTACK_ROOT=$HOME/gtk/inst
12 # where the Ardour dependencies are installed
13 ARDOURSTACK_ROOT=$HOME/a3/inst
14 # the waf build tree to use when copying built/generated files
15 BUILD_ROOT=../../build
17 . ../define_versions.sh
19 # where harvid and xjadeo binaries are cached
20 if test -z "$CACHEDIR" -o ! -d "$CACHEDIR"; then
35 if [ $# -eq 0 ] ; then
37 echo "ERROR - Please specify build type"
44 while [ $# -gt 0 ] ; do
49 # top level build targets
71 --test) WITH_LADSPA=; STRIP= ; shift ;;
74 # specific build flags
77 --nojack) INTERNAL_JACK= ; shift ;;
78 --noladspa) WITH_LADSPA= ; shift ;;
79 --strip) STRIP=$2 ; shift ; shift ;;
80 --sysdeps) PRINT_SYSDEPS=1; shift ;;
81 --nls) WITH_NLS=1 ; shift ;;
82 --harvid) WITH_HARVID=1 ; shift ;;
85 #catch all for unknown arguments
87 echo "!!! ERROR !!! - Unknown argument $1"
94 if test x$STRIP != xall -a x$STRIP != xnone -a x$STRIP != xsome ; then
95 echo "Unknown strip option \"$STRIP\""
96 echo "Legal values are: all, none, some"
100 . ../define_versions.sh
102 echo "Version is $release_version"
103 if [ "x$commit" != "x" ] ; then
104 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
106 info_string="$release_version built on `hostname` by `whoami` on `date`"
108 echo "Info string is $info_string"
110 # Figure out our CPU type
112 i[3456789]86|x86|i86pc)
113 echo "Architecture is x86"
117 MULTIARCH='i386-linux-gnu'
120 echo "Architecture is x86_64"
124 MULTIARCH='x86_64-linux-gnu'
128 echo "ERROR - Unknown architecture `uname -m`"
134 if [ x$DEBUG = xT ]; then
136 if [ x$STRIP = xall ] ; then
137 echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
142 # setup directory structure
144 if [ -z "${BUILDTYPE}" ]; then
145 APPDIR=${APPNAME}_${ARCH}-${release_version}
146 APP_VER_NAME=${APPNAME}-${release_version}
148 APPDIR=${APPNAME}_${ARCH}-${release_version}-${BUILDTYPE}
149 APP_VER_NAME=${APPNAME}-${release_version}-${BUILDTYPE}
158 Plugins=$APPLIB/plugins
159 Surfaces=$APPLIB/surfaces
160 Panners=$APPLIB/panners
161 Backends=$APPLIB/backends
163 Modules=$Libraries/modules
164 Loaders=$Libraries/loaders
166 Templates=$Shared/templates
167 ExportFormats=$Shared/export
168 Locale=$Shared/locale
169 MidiMaps=$Shared/midi_maps
170 PatchFiles=$Shared/patchfiles
171 MackieControl=$Shared/mcp
172 VFork=$Libraries/vfork
174 if [ x$PRINT_SYSDEPS != x ] ; then
176 # print system dependencies
179 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
180 if ! file $file | grep -qs Mach-O ; then
183 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
188 echo "Removing old $APPDIR tree ..."
191 echo "Building new app directory structure ..."
193 # only bother to make the longest paths
207 mkdir -p $MackieControl
208 mkdir -p $ExportFormats
215 # maybe set variables
216 ENVIRONMENT=environment
220 if test x$MIXBUS != x ; then
221 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
223 # current default for MIXBUS version is US keyboard layout without a keypad
225 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
226 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
230 # if we're not going to bundle JACK, make sure we can find
231 # jack in the places where it might be
234 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
236 # create startup helper script
238 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour${major_version}
239 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour${major_version}
240 MAIN_EXECUTABLE=ardour-${release_version}
242 echo "Copying ardour executable ...."
243 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
244 if test x$STRIP = xall ; then
245 strip $APPBIN/$MAIN_EXECUTABLE
249 # note that at present(feb 2011), the .mo files end up in the source tree which is
250 # not really as it should be.
251 if test x$WITH_NLS != x ; then
252 echo "NLS support ..."
253 echo "I hope you remembered to run scons msgupdate!"
256 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
257 files=`find ../../$pkg -name "*.mo"`
260 # the package name is appended with a number so that
261 # it can be parallel installed during a regular install
262 # with older (and newer) versions. it is just the major
263 # number of the release (i.e. leading digits)
266 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
268 if [ -z "$files" ]; then
270 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
277 lang=`basename $file | sed 's/\.mo//'`
278 mkdir -p $Locale/$lang/LC_MESSAGES
279 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
280 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
281 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
284 LINGUAS="$LINGUAS $lang"
289 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
290 LOCALEROOT=$GTKSTACK_ROOT/share/locale
292 for l in $LINGUAS ; do
293 echo "Copying GTK i18n files for $l..."
294 for MO in $GTK_MESSAGES ; do
295 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
296 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
298 # try with just the language spec
299 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
300 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
301 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
307 echo "Skipping NLS support"
311 # Copy stuff that may be dynamically loaded
314 cp -R $GTKSTACK_ROOT/etc/* $Etc
315 echo "Copying all Pango modules ..."
316 cp -R $GTKSTACK_ROOT/lib/pango/1.8.0/modules/*.so $Modules
317 echo "Copying all GDK Pixbuf loaders ..."
318 cp -R $GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so $Loaders
320 # Generate a pango module file using the actual Pango that we're going to bundle
324 ModulesPath=$GTKSTACK_ROOT/lib/pango/1.8.0/modules
326 env PANGO_RC_FILE=pangorc $GTKSTACK_ROOT/bin/pango-querymodules | sed "s?$GTKSTACK_ROOT/lib/pango/1.8.0/?@ROOTDIR@/?" > $Etc/pango.modules.in
329 # Ditto for gdk-pixbuf loaders
330 gdk-pixbuf-query-loaders | sed "s?$GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
332 # We rely on clearlooks, so include a version from our own build tree
333 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
335 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
336 mkdir -p $GTK_ENGINE_DIR
338 echo "Copying GTK engines ..."
339 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
340 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
342 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
343 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
346 if test x$WITH_LADSPA != x ; then
347 if test x$MIXBUS != x ; then
348 plugdir=mixbus_ladspa
352 echo "Copying `ls $plugdir | wc -l` plugins ..."
353 if [ -d $plugdir ] ; then
354 cp -r $plugdir/* $Plugins
359 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
360 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
363 # got to be careful with names here
364 for x in $BUILD_ROOT/../midi_maps/*.map ; do
369 # got to be careful with names here
370 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
375 # got to be careful with names here
376 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
377 cp "$x" $MackieControl
381 #for f in $BUILD_ROOT/../templates/* ; do
382 # if [ -d "$f" ] ; then
383 # echo Template: $f ; cp -r "$f" $Templates ;
388 # got to be careful with names here
389 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
390 cp "$x" $ExportFormats
394 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
397 for backend in jack alsa dummy wavesaudio ; do
398 cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
401 # VAMP plugins that we use
402 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
404 # Suil modules (new dir 'build-stack')
405 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
406 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
409 # Suil modules (old dir 'build-ardour-stack')
410 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
411 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
414 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
415 # (if build with wine: ardour-vst-scanner is a wrapper
416 # script for ardour-vst-scanner.exe.so, if VST is disabled
417 # neither binary nor script exists)
418 if test -d $BUILD_ROOT/libs/fst ; then
419 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
423 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
424 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
427 # ALSA device reservation tool (if available)
428 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
429 cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
432 OURLIBDIR=$BUILD_ROOT/libs
433 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/canvas:$OURLIBDIR/libsndfile:$OURLIBDIR/evoral:$OURLIBDIR/evoral/src/libsmf:$OURLIBDIR/audiographer:$OURLIBDIR/timecode:$OURLIBDIR/taglib:$OURLIBDIR/libltc:$OURLIBDIR/qm-dsp:$OURLIBDIR/ardouralsautil
435 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
442 filelist=`find $APPLIB/ -type f`
443 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
445 for file in $filelist ; do
446 if ! file $file | grep -qs ELF ; then
450 # speed this up a bit by not checking things multiple times.
451 for i in "${depCheckedList[@]}"; do
452 if [ $i == $file ]; then
456 depCheckedList[$checkIdx]=$file
457 checkIdx=$(($checkIdx + 1))
459 # ignore suil/qt wrappers - the plugin will pull in QT4.
460 if echo $file | grep -qs 'libsuil_.*qt4' ; then continue; fi
462 # do not include libjack
463 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
466 for dep in $deps ; do
467 if test "not" = ${dep}; then
469 echo "!!! ERROR !!! - Missing dependant library for $file."
470 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
472 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
474 echo "!!! ERROR !!! - See Above"
478 # don't use anything mapped at a specific address
479 if echo $dep | grep -qs '0x' ; then continue; fi
481 if echo $dep | grep -qs "^/lib/" ; then continue; fi
483 if echo $dep | grep -qs libjack ; then continue; fi
485 if echo $dep | grep -qs libasound ; then continue; fi
486 # don't include any X Window libraries
487 if echo $dep | grep -qs libX\. ; then continue; fi
488 if echo $dep | grep -qs libxcb ; then continue; fi
489 if echo $dep | grep -qs libICE\. ; then continue; fi
490 if echo $dep | grep -qs libSM\. ; then continue; fi
492 if echo $dep | grep -qs 'libc\.' ; then continue; fi
493 # don't include libstdc++
494 if echo $dep | grep -qs libstdc++ ; then continue; fi
495 # don't include libdbus
496 if echo $dep | grep -qs libdbus ; then continue; fi
499 if ! test -f $Libraries/$base; then
500 parent=$(basename ${file})
501 if echo $dep | grep -sq '^libs' ; then
502 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
503 cp $BUILD_ROOT/$dep $Libraries
505 echo "Copying dependant lib $dep (required by ${parent})"
509 # reset RPATH so that the runtime linker never looks
510 # in places we don't want it to
512 chrpath -r foo $Libraries/`basename $dep`
513 if echo $dep | grep -sq '^/' ; then
514 # absolute path, candidate for stripping
515 deplibs="$deplibs $base"
521 if test x$missing = xfalse ; then
522 # everything has been found
529 if test x$STRIP = xall ; then
530 echo Stripping all libraries
531 # Must be writable so that we can strip
532 find $APPLIB/ -name "*.so*" | xargs chmod u+w
534 find $APPLIB/ -name "*.so*" | xargs strip
535 elif test x$STRIP = xsome ; then
536 echo Stripping dependent libraries
537 for l in $deplibs ; do
542 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
544 echo "Copying other stuff to $APPDIR ..."
546 # these are all generated by waf
547 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
548 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
549 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
550 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
552 # Copied directly from source tree
554 cp ../../system_config $Etc/system_config
555 cp ../../gtk2_ardour/dark.colors $Etc
556 cp ../../instant.xml $Shared/instant.xml
557 cp ../../gtk2_ardour/step_editing.bindings $Etc
558 cp ../../gtk2_ardour/mixer.bindings $Etc
559 cp -r ../../gtk2_ardour/icons $Shared
560 cp -r ../../gtk2_ardour/pixmaps $Shared
561 cp -r ../../gtk2_ardour/splash.png $Shared
562 cp -r ../../gtk2_ardour/small-splash.png $Shared
563 cp -r ../../gtk2_ardour/ArdourMono.ttf $Shared
566 # put sooper sekrit ingredients here and they will be copied
569 if [ -d specialSauce ] ; then
570 cp -r specialSauce $Etc
573 # install bundled LV2s to <app>/lib/LV2/
574 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
576 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
577 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
578 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 $APPLIB/LV2/
579 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
580 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 $APPLIB/LV2/
583 # go through and recursively remove any .svn dirs in the bundle
584 for svndir in `find $APPDIR -name .svn -type d`; do
589 ################################################################################
590 ### Mixbus plugins, etc
591 if test -n "$MIXBUS"; then
594 METERS_VERSION=$(curl -s -S http://gareus.org/x42/linux/x42-meters.latest.txt)
595 rsync -a -q --partial \
596 rsync://gareus.org/x42/linux/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip \
597 "${SRCDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
598 unzip -d "$APPLIB/LV2/" "${SRCDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
600 SETBFREE_VERSION=$(curl -s -S http://gareus.org/x42/linux/setBfree.latest.txt)
601 rsync -a -q --partial \
602 rsync://gareus.org/x42/linux/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip \
603 "${SRCDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
604 unzip -d "$APPLIB/LV2/" "${SRCDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
606 MIDIFILTER_VERSION=$(curl -s -S http://gareus.org/x42/linux/x42-midifilter.latest.txt)
607 rsync -a -q --partial \
608 rsync://gareus.org/x42/linux/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip \
609 "${SRCDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
610 unzip -d "$APPLIB/LV2/" "${SRCDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
613 ################################################################################
616 if test x$WITH_HARVID != x ; then
618 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
619 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
622 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
623 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
626 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
627 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
630 --exclude=README --exclude=harvid.1 --strip-components=1 \
631 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
634 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
635 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
641 # Add the uninstaller
643 sed -e "s/%REPLACE_PGM%/${APPNAME}/" -e "s/%REPLACE_VENDOR%/${VENDOR}/" -e "s/%REPLACE_MAJOR_VERSION%/${major_version}/" -e "s/%REPLACE_VERSION%/${release_version}/" -e "s/%REPLACE_TYPE%/${BUILDTYPE}/" < uninstall.sh.in > $APPBIN/${APP_VER_NAME}.uninstall.sh
644 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
647 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
648 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
650 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
654 echo "Building tarball ..."
656 rm -f $APPDIR.tar.bz2
657 tar -cjf $APPDIR.tar.bz2 $APPDIR
659 echo "Calculating bundle size"
660 du -sb $APPDIR/ | awk '{print $1}' > $APPDIR.size
662 ( cd $APPDIR ; find . ) > file_list.txt