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
38 if [ $# -eq 0 ] ; then
40 echo "ERROR - Please specify build type"
47 while [ $# -gt 0 ] ; do
52 # top level build targets
77 --test) WITH_LADSPA=; STRIP= ; shift ;;
80 # specific build flags
83 --nojack) INTERNAL_JACK= ; shift ;;
84 --noladspa) WITH_LADSPA= ; shift ;;
85 --strip) STRIP=$2 ; shift ; shift ;;
86 --sysdeps) PRINT_SYSDEPS=1; shift ;;
87 --nls) WITH_NLS=1 ; shift ;;
88 --harvid) WITH_HARVID=1 ; shift ;;
91 #catch all for unknown arguments
93 echo "!!! ERROR !!! - Unknown argument $1"
100 if test x$STRIP != xall -a x$STRIP != xnone -a x$STRIP != xsome ; then
101 echo "Unknown strip option \"$STRIP\""
102 echo "Legal values are: all, none, some"
106 . ../define_versions.sh
108 echo "Version is $release_version"
109 if [ "x$commit" != "x" ] ; then
110 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
112 info_string="$release_version built on `hostname` by `whoami` on `date`"
114 echo "Info string is $info_string"
116 # Figure out our CPU type
118 i[3456789]86|x86|i86pc)
119 echo "Architecture is x86"
124 MULTIARCH='i386-linux-gnu'
127 echo "Architecture is x86_64"
132 MULTIARCH='x86_64-linux-gnu'
136 echo "ERROR - Unknown architecture `uname -m`"
142 if [ x$DEBUG = xT ]; then
144 if [ x$STRIP = xall ] ; then
145 echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
150 # setup directory structure
152 if [ -z "${BUILDTYPE}" ]; then
153 APPDIR=${APPNAME}_${ARCH}-${release_version}
154 APP_VER_NAME=${APPNAME}-${release_version}
156 APPDIR=${APPNAME}_${ARCH}-${release_version}-${BUILDTYPE}
157 APP_VER_NAME=${APPNAME}-${release_version}-${BUILDTYPE}
166 Plugins=$APPLIB/plugins
167 Surfaces=$APPLIB/surfaces
168 Panners=$APPLIB/panners
169 Backends=$APPLIB/backends
171 Modules=$Libraries/modules
172 Loaders=$Libraries/loaders
174 Templates=$Shared/templates
175 ExportFormats=$Shared/export
176 Locale=$Shared/locale
177 MidiMaps=$Shared/midi_maps
178 PatchFiles=$Shared/patchfiles
179 MackieControl=$Shared/mcp
180 VFork=$Libraries/vfork
182 if [ x$PRINT_SYSDEPS != x ] ; then
184 # print system dependencies
187 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
188 if ! file $file | grep -qs Mach-O ; then
191 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
196 echo "Removing old $APPDIR tree ..."
199 echo "Building new app directory structure ..."
201 # only bother to make the longest paths
215 mkdir -p $MackieControl
216 mkdir -p $ExportFormats
223 # maybe set variables
224 ENVIRONMENT=environment
228 if test x$MIXBUS != x ; then
229 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
231 # current default for MIXBUS version is US keyboard layout without a keypad
233 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
234 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
238 # if we're not going to bundle JACK, make sure we can find
239 # jack in the places where it might be
242 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
244 # create startup helper script
246 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/;s/%EXENAME%/'"${EXENAME}"'/' < ardour.sh.in > $APPBIN/${EXENAME}${major_version}
247 rm $ENVIRONMENT && chmod 775 $APPBIN/${EXENAME}${major_version}
249 echo "Copying ardour executable ...."
250 cp -v $BUILD_ROOT/gtk2_ardour/ardour-${release_version} $APPBIN/${EXENAME}-${release_version}
251 if test x$STRIP = xall ; then
252 strip $APPBIN/${EXENAME}-${release_version}
256 # note that at present(feb 2011), the .mo files end up in the source tree which is
257 # not really as it should be.
258 if test x$WITH_NLS != x ; then
259 echo "NLS support ..."
260 echo "I hope you remembered to run scons msgupdate!"
263 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
264 files=`find ../../$pkg -name "*.mo"`
267 # the package name is appended with a number so that
268 # it can be parallel installed during a regular install
269 # with older (and newer) versions. it is just the major
270 # number of the release (i.e. leading digits)
273 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
275 if [ -z "$files" ]; then
277 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
284 lang=`basename $file | sed 's/\.mo//'`
285 mkdir -p $Locale/$lang/LC_MESSAGES
286 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
287 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
288 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
291 LINGUAS="$LINGUAS $lang"
296 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
297 LOCALEROOT=$GTKSTACK_ROOT/share/locale
299 for l in $LINGUAS ; do
300 echo "Copying GTK i18n files for $l..."
301 for MO in $GTK_MESSAGES ; do
302 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
303 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
305 # try with just the language spec
306 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
307 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
308 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
314 echo "Skipping NLS support"
318 # Copy stuff that may be dynamically loaded
321 cp -R $GTKSTACK_ROOT/etc/* $Etc
323 # We rely on clearlooks, so include a version from our own build tree
324 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
326 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
327 mkdir -p $GTK_ENGINE_DIR
329 echo "Copying GTK engines ..."
330 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
331 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
333 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
334 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
337 if test x$WITH_LADSPA != x ; then
338 if test x$MIXBUS != x ; then
339 plugdir=mixbus_ladspa
343 echo "Copying `ls $plugdir | wc -l` plugins ..."
344 if [ -d $plugdir ] ; then
345 cp -r $plugdir/* $Plugins
350 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
351 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
354 # got to be careful with names here
355 for x in $BUILD_ROOT/../midi_maps/*.map ; do
360 # got to be careful with names here
361 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
366 # got to be careful with names here
367 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
368 cp "$x" $MackieControl
372 #for f in $BUILD_ROOT/../templates/* ; do
373 # if [ -d "$f" ] ; then
374 # echo Template: $f ; cp -r "$f" $Templates ;
379 # got to be careful with names here
380 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
381 cp "$x" $ExportFormats
385 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
388 for backend in jack alsa dummy wavesaudio ; do
389 cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
392 # VAMP plugins that we use
393 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
395 # Suil modules (new dir 'build-stack')
396 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
397 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
400 # Suil modules (old dir 'build-ardour-stack')
401 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
402 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
405 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
406 # (if build with wine: ardour-vst-scanner is a wrapper
407 # script for ardour-vst-scanner.exe.so, if VST is disabled
408 # neither binary nor script exists)
409 if test -d $BUILD_ROOT/libs/fst ; then
410 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
414 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
415 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
418 # ALSA device reservation tool (if available)
419 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
420 cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
423 OURLIBDIR=$BUILD_ROOT/libs
424 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:$OURLIBDIR/ptformat
426 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
433 filelist=`find $APPLIB/ -type f`
434 filelist="$APPBIN/${EXENAME}-${release_version} $filelist"
436 for file in $filelist ; do
437 if ! file $file | grep -qs ELF ; then
441 # speed this up a bit by not checking things multiple times.
442 for i in "${depCheckedList[@]}"; do
443 if [ $i == $file ]; then
447 depCheckedList[$checkIdx]=$file
448 checkIdx=$(($checkIdx + 1))
450 # ignore suil/qt wrappers - the plugin will pull in QT4.
451 if echo $file | grep -qs 'libsuil_.*qt4' ; then continue; fi
453 # do not include libjack
454 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
457 for dep in $deps ; do
458 if test "not" = ${dep}; then
460 echo "!!! ERROR !!! - Missing dependant library for $file."
461 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
463 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
465 echo "!!! ERROR !!! - See Above"
469 # don't use anything mapped at a specific address
470 if echo $dep | grep -qs '0x' ; then continue; fi
472 if echo $dep | grep -qs "^/lib/" ; then continue; fi
474 if echo $dep | grep -qs libjack ; then continue; fi
476 if echo $dep | grep -qs libasound ; then continue; fi
477 # don't include any X Window libraries
478 if echo $dep | grep -qs libX\. ; then continue; fi
479 if echo $dep | grep -qs libxcb ; then continue; fi
480 if echo $dep | grep -qs libICE\. ; then continue; fi
481 if echo $dep | grep -qs libSM\. ; then continue; fi
483 if echo $dep | grep -qs 'libc\.' ; then continue; fi
484 # don't include libstdc++
485 if echo $dep | grep -qs libstdc++ ; then continue; fi
486 # don't include libdbus
487 if echo $dep | grep -qs libdbus ; then continue; fi
490 if ! test -f $Libraries/$base; then
491 parent=$(basename ${file})
492 if echo $dep | grep -sq '^libs' ; then
493 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
494 cp $BUILD_ROOT/$dep $Libraries
496 echo "Copying dependant lib $dep (required by ${parent})"
500 # reset RPATH so that the runtime linker never looks
501 # in places we don't want it to
503 chrpath -r foo $Libraries/`basename $dep`
504 if echo $dep | grep -sq '^/' ; then
505 # absolute path, candidate for stripping
506 deplibs="$deplibs $base"
512 if test x$missing = xfalse ; then
513 # everything has been found
520 if test x$STRIP = xall ; then
521 echo Stripping all libraries
522 # Must be writable so that we can strip
523 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod u+w
525 find $APPLIB/ -name "*.so*" -print0 | xargs -0 strip -s
526 elif test x$STRIP = xsome ; then
527 echo Stripping dependent libraries
528 for l in $deplibs ; do
533 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod a+rx
535 echo "Copying other stuff to $APPDIR ..."
537 # these are all generated by waf
538 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
539 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
540 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
541 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
543 # Copied directly from source tree
545 cp ../../system_config $Etc/system_config
546 cp ../../gtk2_ardour/dark.colors $Etc
547 cp ../../instant.xml $Shared/instant.xml
548 cp ../../gtk2_ardour/step_editing.bindings $Etc
549 cp ../../gtk2_ardour/mixer.bindings $Etc
550 cp -r ../../gtk2_ardour/icons $Shared
551 cp -r ../../gtk2_ardour/pixmaps $Shared
552 cp -r ../../gtk2_ardour/splash.png $Shared
553 cp -r ../../gtk2_ardour/small-splash.png $Shared
554 cp -r ../../gtk2_ardour/ArdourMono.ttf $Shared
557 # put sooper sekrit ingredients here and they will be copied
560 if [ -d specialSauce ] ; then
561 cp -r specialSauce $Etc
564 # install bundled LV2s to <app>/lib/LV2/
565 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
567 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
568 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
569 mkdir -p $APPLIB/LV2/lv2core.lv2
570 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
571 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
572 mkdir -p $APPLIB/LV2/lv2core.lv2
573 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
576 # go through and recursively remove any .svn dirs in the bundle
577 for svndir in `find $APPDIR -name .svn -type d`; do
582 ################################################################################
583 ### Mixbus plugins, etc
584 if test x$WITH_HARRISON_LV2 != x ; then
585 echo "Adding Harrison LV2s"
588 curl -s -S --fail -# \
589 -z "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
590 -o "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
591 http://www.harrisonconsoles.com/mixbus/mb3/${HARCH}/harrison_lv2s.zip
592 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/harrison_lv2s.${HARCH}.zip"
595 if test -n "$MIXBUS"; then
596 echo "Adding Mixbus Channelstrip"
598 mkdir -p $APPLIB/ladspa/strip/
599 curl -s -S --fail -# \
600 -z "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
601 -o "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
602 http://www.harrisonconsoles.com/mixbus/mb3/${HARCH}/harrison_channelstrip.so
604 cp "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
605 $APPLIB/ladspa/strip/harrison_channelstrip.so
606 chmod +x $APPLIB/ladspa/strip/harrison_channelstrip.so
609 if test x$WITH_X42_LV2 != x ; then
610 METERS_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/x42-meters.latest.txt)
611 rsync -a -q --partial \
612 rsync://x42-plugins.com/x42/linux/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip \
613 "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
614 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
616 SETBFREE_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/setBfree.latest.txt)
617 rsync -a -q --partial \
618 rsync://x42-plugins.com/x42/linux/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip \
619 "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
620 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
622 MIDIFILTER_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/x42-midifilter.latest.txt)
623 rsync -a -q --partial \
624 rsync://x42-plugins.com/x42/linux/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip \
625 "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
626 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
629 ################################################################################
632 if test x$WITH_HARVID != x ; then
634 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
635 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
638 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
639 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
642 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
643 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
646 --exclude=README --exclude=harvid.1 --strip-components=1 \
647 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
650 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
651 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
657 # Add the uninstaller
659 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
660 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
663 # Add the stage2.run script
665 sed -e "s/%REPLACE_MAJOR_VERSION%/${major_version}/;s/%REPLACE_PGM%/${APPNAME}/;s/%REPLACE_VENDOR%/${VENDOR}/;s/%REPLACE_EXE%/${EXENAME}/" < stage2.run.in > stage2.run
670 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
671 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
673 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
677 echo "Building tarball ..."
679 rm -f $APPDIR.tar.bz2
680 tar -cjf $APPDIR.tar.bz2 $APPDIR
682 echo "Calculating bundle size"
683 du -sb $APPDIR/ | awk '{print $1}' > $APPDIR.size
685 ( cd $APPDIR ; find . ) > file_list.txt