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
316 # We rely on clearlooks, so include a version from our own build tree
317 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
319 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
320 mkdir -p $GTK_ENGINE_DIR
322 echo "Copying GTK engines ..."
323 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
324 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
326 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
327 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
330 if test x$WITH_LADSPA != x ; then
331 if test x$MIXBUS != x ; then
332 plugdir=mixbus_ladspa
336 echo "Copying `ls $plugdir | wc -l` plugins ..."
337 if [ -d $plugdir ] ; then
338 cp -r $plugdir/* $Plugins
343 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
344 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
347 # got to be careful with names here
348 for x in $BUILD_ROOT/../midi_maps/*.map ; do
353 # got to be careful with names here
354 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
359 # got to be careful with names here
360 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
361 cp "$x" $MackieControl
365 #for f in $BUILD_ROOT/../templates/* ; do
366 # if [ -d "$f" ] ; then
367 # echo Template: $f ; cp -r "$f" $Templates ;
372 # got to be careful with names here
373 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
374 cp "$x" $ExportFormats
378 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
381 for backend in jack alsa dummy wavesaudio ; do
382 cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
385 # VAMP plugins that we use
386 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
388 # Suil modules (new dir 'build-stack')
389 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
390 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
393 # Suil modules (old dir 'build-ardour-stack')
394 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
395 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
398 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
399 # (if build with wine: ardour-vst-scanner is a wrapper
400 # script for ardour-vst-scanner.exe.so, if VST is disabled
401 # neither binary nor script exists)
402 if test -d $BUILD_ROOT/libs/fst ; then
403 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
407 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
408 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
411 # ALSA device reservation tool (if available)
412 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
413 cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
416 OURLIBDIR=$BUILD_ROOT/libs
417 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
419 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
426 filelist=`find $APPLIB/ -type f`
427 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
429 for file in $filelist ; do
430 if ! file $file | grep -qs ELF ; then
434 # speed this up a bit by not checking things multiple times.
435 for i in "${depCheckedList[@]}"; do
436 if [ $i == $file ]; then
440 depCheckedList[$checkIdx]=$file
441 checkIdx=$(($checkIdx + 1))
443 # ignore suil/qt wrappers - the plugin will pull in QT4.
444 if echo $file | grep -qs 'libsuil_.*qt4' ; then continue; fi
446 # do not include libjack
447 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
450 for dep in $deps ; do
451 if test "not" = ${dep}; then
453 echo "!!! ERROR !!! - Missing dependant library for $file."
454 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
456 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
458 echo "!!! ERROR !!! - See Above"
462 # don't use anything mapped at a specific address
463 if echo $dep | grep -qs '0x' ; then continue; fi
465 if echo $dep | grep -qs "^/lib/" ; then continue; fi
467 if echo $dep | grep -qs libjack ; then continue; fi
469 if echo $dep | grep -qs libasound ; then continue; fi
470 # don't include any X Window libraries
471 if echo $dep | grep -qs libX\. ; then continue; fi
472 if echo $dep | grep -qs libxcb ; then continue; fi
473 if echo $dep | grep -qs libICE\. ; then continue; fi
474 if echo $dep | grep -qs libSM\. ; then continue; fi
476 if echo $dep | grep -qs 'libc\.' ; then continue; fi
477 # don't include libstdc++
478 if echo $dep | grep -qs libstdc++ ; then continue; fi
479 # don't include libdbus
480 if echo $dep | grep -qs libdbus ; then continue; fi
483 if ! test -f $Libraries/$base; then
484 parent=$(basename ${file})
485 if echo $dep | grep -sq '^libs' ; then
486 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
487 cp $BUILD_ROOT/$dep $Libraries
489 echo "Copying dependant lib $dep (required by ${parent})"
493 # reset RPATH so that the runtime linker never looks
494 # in places we don't want it to
496 chrpath -r foo $Libraries/`basename $dep`
497 if echo $dep | grep -sq '^/' ; then
498 # absolute path, candidate for stripping
499 deplibs="$deplibs $base"
505 if test x$missing = xfalse ; then
506 # everything has been found
513 if test x$STRIP = xall ; then
514 echo Stripping all libraries
515 # Must be writable so that we can strip
516 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod u+w
518 find $APPLIB/ -name "*.so*" -print0 | xargs -0 strip -s
519 elif test x$STRIP = xsome ; then
520 echo Stripping dependent libraries
521 for l in $deplibs ; do
526 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod a+rx
528 echo "Copying other stuff to $APPDIR ..."
530 # these are all generated by waf
531 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
532 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
533 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
534 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
536 # Copied directly from source tree
538 cp ../../system_config $Etc/system_config
539 cp ../../gtk2_ardour/dark.colors $Etc
540 cp ../../instant.xml $Shared/instant.xml
541 cp ../../gtk2_ardour/step_editing.bindings $Etc
542 cp ../../gtk2_ardour/mixer.bindings $Etc
543 cp -r ../../gtk2_ardour/icons $Shared
544 cp -r ../../gtk2_ardour/pixmaps $Shared
545 cp -r ../../gtk2_ardour/splash.png $Shared
546 cp -r ../../gtk2_ardour/small-splash.png $Shared
547 cp -r ../../gtk2_ardour/ArdourMono.ttf $Shared
550 # put sooper sekrit ingredients here and they will be copied
553 if [ -d specialSauce ] ; then
554 cp -r specialSauce $Etc
557 # install bundled LV2s to <app>/lib/LV2/
558 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
560 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
561 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
562 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 $APPLIB/LV2/
563 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
564 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 $APPLIB/LV2/
567 # go through and recursively remove any .svn dirs in the bundle
568 for svndir in `find $APPDIR -name .svn -type d`; do
573 ################################################################################
574 ### Mixbus plugins, etc
575 if test -n "$MIXBUS"; then
578 #curl -s http://www.harrisonconsoles.com/mixbus/mb3/${WARCH}/harrison_lv2s.zip \
579 # | tar -C "$APPLIB/LV2/" -xf -
582 METERS_VERSION=$(curl -s -S http://gareus.org/x42/linux/x42-meters.latest.txt)
583 rsync -a -q --partial \
584 rsync://gareus.org/x42/linux/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip \
585 "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
586 unzip -d "$APPLIB/LV2/" "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
588 SETBFREE_VERSION=$(curl -s -S http://gareus.org/x42/linux/setBfree.latest.txt)
589 rsync -a -q --partial \
590 rsync://gareus.org/x42/linux/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip \
591 "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
592 unzip -d "$APPLIB/LV2/" "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
594 MIDIFILTER_VERSION=$(curl -s -S http://gareus.org/x42/linux/x42-midifilter.latest.txt)
595 rsync -a -q --partial \
596 rsync://gareus.org/x42/linux/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip \
597 "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
598 unzip -d "$APPLIB/LV2/" "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
601 ################################################################################
604 if test x$WITH_HARVID != x ; then
606 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
607 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
610 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
611 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
614 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
615 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
618 --exclude=README --exclude=harvid.1 --strip-components=1 \
619 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
622 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
623 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
629 # Add the uninstaller
631 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
632 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
635 # Add the stage2.run script
637 sed -e "s/%REPLACE_MAJOR_VERSION%/${major_version}/" < stage2.run.in > stage2.run
642 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
643 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
645 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
649 echo "Building tarball ..."
651 rm -f $APPDIR.tar.bz2
652 tar -cjf $APPDIR.tar.bz2 $APPDIR
654 echo "Calculating bundle size"
655 du -sb $APPDIR/ | awk '{print $1}' > $APPDIR.size
657 ( cd $APPDIR ; find . ) > file_list.txt