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
37 NOSTRIP="libsuil|libserd|libsord|liblilv|libsratom|liblrdf|libardour|libpbd|libevoral"
40 if [ $# -eq 0 ] ; then
42 echo "ERROR - Please specify build type"
49 while [ $# -gt 0 ] ; do
54 # top level build targets
79 --test) WITH_LADSPA=; STRIP= ; shift ;;
82 # specific build flags
85 --nojack) INTERNAL_JACK= ; shift ;;
86 --noladspa) WITH_LADSPA= ; shift ;;
87 --strip) STRIP=$2 ; shift ; shift ;;
88 --sysdeps) PRINT_SYSDEPS=1; shift ;;
89 --nls) WITH_NLS=1 ; shift ;;
90 --harvid) WITH_HARVID=1 ; shift ;;
91 --gcc5abi) GCC5ABI=true ; shift ;;
94 #catch all for unknown arguments
96 echo "!!! ERROR !!! - Unknown argument $1"
103 if test x$STRIP != xall -a x$STRIP != xnone -a x$STRIP != xsome ; then
104 echo "Unknown strip option \"$STRIP\""
105 echo "Legal values are: all, none, some"
109 . ../define_versions.sh
111 echo "Version is $release_version"
112 if [ "x$commit" != "x" ] ; then
113 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
115 info_string="$release_version built on `hostname` by `whoami` on `date`"
117 echo "Info string is $info_string"
119 # Figure out our CPU type
121 i[3456789]86|x86|i86pc)
122 echo "Architecture is x86"
127 MULTIARCH='i386-linux-gnu'
130 echo "Architecture is x86_64"
135 MULTIARCH='x86_64-linux-gnu'
139 echo "ERROR - Unknown architecture `uname -m`"
145 if [ x$DEBUG = xT ]; then
147 if [ x$STRIP = xall ] ; then
148 echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
153 # setup directory structure
155 if [ -z "${BUILDTYPE}" ]; then
156 APPDIR=${APPNAME}_${ARCH}-${release_version}
157 APP_VER_NAME=${APPNAME}-${release_version}
159 APPDIR=${APPNAME}_${ARCH}-${release_version}-${BUILDTYPE}
160 APP_VER_NAME=${APPNAME}-${release_version}-${BUILDTYPE}
169 Plugins=$APPLIB/plugins
170 Surfaces=$APPLIB/surfaces
171 Panners=$APPLIB/panners
172 Backends=$APPLIB/backends
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
181 if [ x$PRINT_SYSDEPS != x ] ; then
183 # print system dependencies
186 for file in $APPBIN/* $Libraries/* $Plugins/*.so ; do
187 if ! file $file | grep -qs Mach-O ; then
190 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
195 echo "Removing old $APPDIR tree ..."
198 echo "Building new app directory structure ..."
200 # only bother to make the longest paths
211 mkdir -p $MackieControl
212 mkdir -p $ExportFormats
218 # maybe set variables
219 ENVIRONMENT=environment
223 if test x$MIXBUS != x ; then
224 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
226 # current default for MIXBUS version is US keyboard layout without a keypad
228 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
229 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
233 # if we're not going to bundle JACK, make sure we can find
234 # jack in the places where it might be
237 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
239 # create startup helper script
241 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/;s/%EXENAME%/'"${EXENAME}"'/' < ardour.sh.in > $APPBIN/${EXENAME}${major_version}
242 rm $ENVIRONMENT && chmod 775 $APPBIN/${EXENAME}${major_version}
244 echo "Copying ardour executable ...."
245 cp -v $BUILD_ROOT/gtk2_ardour/ardour-${release_version} $APPBIN/${EXENAME}-${release_version}
246 if test x$STRIP = xall ; then
247 strip -s $APPBIN/${EXENAME}-${release_version}
251 # note that at present(feb 2011), the .mo files end up in the source tree which is
252 # not really as it should be.
253 if test x$WITH_NLS != x ; then
254 echo "NLS support ..."
255 echo "I hope you remembered to run scons msgupdate!"
258 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
259 files=`find ../../$pkg -name "*.mo"`
262 # the package name is appended with a number so that
263 # it can be parallel installed during a regular install
264 # with older (and newer) versions. it is just the major
265 # number of the release (i.e. leading digits)
268 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
270 if [ -z "$files" ]; then
272 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
279 lang=`basename $file | sed 's/\.mo//'`
280 mkdir -p $Locale/$lang/LC_MESSAGES
281 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
282 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
283 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
286 LINGUAS="$LINGUAS $lang"
291 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
292 LOCALEROOT=$GTKSTACK_ROOT/share/locale
294 for l in $LINGUAS ; do
295 echo "Copying GTK i18n files for $l..."
296 for MO in $GTK_MESSAGES ; do
297 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
298 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
300 # try with just the language spec
301 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
302 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
303 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
309 echo "Skipping NLS support"
313 # Copy stuff that may be dynamically loaded
316 cp -R $GTKSTACK_ROOT/etc/* $Etc
318 # We rely on clearlooks, so include a version from our own build tree
319 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
321 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
322 mkdir -p $GTK_ENGINE_DIR
324 echo "Copying GTK engines ..."
325 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
326 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
328 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
329 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
332 if test x$WITH_LADSPA != x ; then
333 if test x$MIXBUS != x ; then
334 plugdir=mixbus_ladspa
338 echo "Copying `ls $plugdir | wc -l` plugins ..."
339 if [ -d $plugdir ] ; then
341 cp -r $plugdir/* $Plugins
346 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
347 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
350 # got to be careful with names here
351 for x in $BUILD_ROOT/../midi_maps/*.map ; do
356 # got to be careful with names here
357 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
362 # got to be careful with names here
363 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
364 cp "$x" $MackieControl
368 #for f in $BUILD_ROOT/../templates/* ; do
369 # if [ -d "$f" ] ; then
370 # echo Template: $f ; cp -r "$f" $Templates ;
375 # got to be careful with names here
376 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
377 cp "$x" $ExportFormats
381 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
384 for backend in jack alsa dummy wavesaudio ; do
385 cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
388 # VAMP plugins that we use
389 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
391 # Suil modules (new dir 'build-stack')
392 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
393 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
396 # Suil modules (old dir 'build-ardour-stack')
397 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
398 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
401 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
402 # (if build with wine: ardour-vst-scanner is a wrapper
403 # script for ardour-vst-scanner.exe.so, if VST is disabled
404 # neither binary nor script exists)
405 if test -d $BUILD_ROOT/libs/fst ; then
406 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
407 if test x$STRIP = xall ; then
408 strip -s $APPLIB/ardour-vst-scanner*
413 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
414 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
415 if test x$STRIP = xall ; then
416 strip -s $APPLIB/ardour-exec-wrapper
420 # ALSA device reservation tool (if available)
421 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
422 cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
423 if test x$STRIP = xall ; then
424 strip -s $APPLIB/ardour-request-device
428 OURLIBDIR=$BUILD_ROOT/libs
429 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
431 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
438 filelist=`find $APPLIB/ -type f`
439 filelist="$APPBIN/${EXENAME}-${release_version} $filelist"
441 for file in $filelist ; do
442 if ! file $file | grep -qs ELF ; then
446 # speed this up a bit by not checking things multiple times.
447 for i in "${depCheckedList[@]}"; do
448 if [ $i == $file ]; then
452 depCheckedList[$checkIdx]=$file
453 checkIdx=$(($checkIdx + 1))
455 # ignore suil/qt wrappers - the plugin will pull in QT4.
456 if echo $file | grep -qs 'libsuil_.*qt4' ; then continue; fi
458 # do not include libjack
459 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
462 for dep in $deps ; do
463 if test "not" = ${dep}; then
465 echo "!!! ERROR !!! - Missing dependant library for $file."
466 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
468 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
470 echo "!!! ERROR !!! - See Above"
474 # don't use anything mapped at a specific address
475 if echo $dep | grep -qs '0x' ; then continue; fi
477 if echo $dep | grep -qs "^/lib/" ; then continue; fi
479 if echo $dep | grep -qs libjack ; then continue; fi
481 if echo $dep | grep -qs libasound ; then continue; fi
482 # don't include any X Window libraries
483 if echo $dep | grep -qs libX\. ; then continue; fi
484 if echo $dep | grep -qs libxcb ; then continue; fi
485 if echo $dep | grep -qs libICE\. ; then continue; fi
486 if echo $dep | grep -qs libSM\. ; then continue; fi
488 if echo $dep | grep -qs 'libc\.' ; then continue; fi
489 # don't include libstdc++
490 if echo $dep | grep -qs libstdc++ ; then continue; fi
491 # don't include libdbus
492 if echo $dep | grep -qs libdbus ; then continue; fi
495 if ! test -f $Libraries/$base; then
496 parent=$(basename ${file})
497 if echo $dep | grep -sq '^libs' ; then
498 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
499 cp $BUILD_ROOT/$dep $Libraries
501 echo "Copying dependant lib $dep (required by ${parent})"
505 # reset RPATH so that the runtime linker never looks
506 # in places we don't want it to
508 chrpath -r foo $Libraries/`basename $dep`
509 if echo $dep | grep -sq '^/' ; then
510 # absolute path, candidate for stripping
511 deplibs="$deplibs $base"
517 if test x$missing = xfalse ; then
518 # everything has been found
525 if test x$STRIP = xall ; then
526 echo Stripping all libraries
527 # Must be writable so that we can strip
528 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod u+w
530 find $APPLIB/ -name "*.so*" -print0 | xargs -0 strip -s
531 elif test x$STRIP = xsome ; then
532 echo Stripping dependent libraries
533 for l in $deplibs ; do
534 if echo "$l" | grep -qE "$NOSTRIP"; then
541 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod a+rx
543 echo "Copying other stuff to $APPDIR ..."
545 # these are all generated by waf
546 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
547 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
548 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
549 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
551 # Copied directly from source tree
553 cp ../../system_config $Etc/system_config
554 cp ../../gtk2_ardour/dark.colors $Etc
555 cp ../../instant.xml $Shared/instant.xml
556 cp ../../gtk2_ardour/step_editing.bindings $Etc
557 cp ../../gtk2_ardour/mixer.bindings $Etc
558 cp -r ../../gtk2_ardour/icons $Shared
559 cp -r ../../gtk2_ardour/pixmaps $Shared
560 cp -r ../../gtk2_ardour/splash.png $Shared
561 cp -r ../../gtk2_ardour/small-splash.png $Shared
562 cp -r ../../gtk2_ardour/ArdourMono.ttf $Shared
565 # put sooper sekrit ingredients here and they will be copied
568 if [ -d specialSauce ] ; then
569 cp -r specialSauce $Etc
572 # install bundled LV2s to <app>/lib/LV2/
573 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
575 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
576 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
577 mkdir -p $APPLIB/LV2/lv2core.lv2
578 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
579 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
580 mkdir -p $APPLIB/LV2/lv2core.lv2
581 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
584 # go through and recursively remove any .svn dirs in the bundle
585 for svndir in `find $APPDIR -name .svn -type d`; do
590 ################################################################################
591 ### Mixbus plugins, etc
592 if test x$WITH_HARRISON_LV2 != x ; then
593 echo "Adding Harrison LV2s"
596 curl -s -S --fail -# \
597 -z "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
598 -o "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
599 http://www.harrisonconsoles.com/mixbus/mb3/${HARCH}/harrison_lv2s.zip
600 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/harrison_lv2s.${HARCH}.zip"
603 if test -n "$MIXBUS"; then
604 echo "Adding Mixbus Channelstrip"
606 mkdir -p $APPLIB/ladspa/strip/
607 curl -s -S --fail -# \
608 -z "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
609 -o "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
610 http://www.harrisonconsoles.com/mixbus/mb3/${HARCH}/harrison_channelstrip.so
612 cp "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
613 $APPLIB/ladspa/strip/harrison_channelstrip.so
614 chmod +x $APPLIB/ladspa/strip/harrison_channelstrip.so
617 if test x$WITH_X42_LV2 != x ; then
618 METERS_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/x42-meters.latest.txt)
619 rsync -a -q --partial \
620 rsync://x42-plugins.com/x42/linux/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip \
621 "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
622 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
624 SETBFREE_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/setBfree.latest.txt)
625 rsync -a -q --partial \
626 rsync://x42-plugins.com/x42/linux/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip \
627 "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
628 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
630 MIDIFILTER_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/x42-midifilter.latest.txt)
631 rsync -a -q --partial \
632 rsync://x42-plugins.com/x42/linux/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip \
633 "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
634 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
637 ################################################################################
640 if test x$WITH_HARVID != x ; then
642 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
643 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
646 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
647 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
650 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
651 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
654 --exclude=README --exclude=harvid.1 --strip-components=1 \
655 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
658 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
659 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
665 # Add the uninstaller
667 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
668 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
671 # Add the stage2.run script
673 sed -e "s/%REPLACE_MAJOR_VERSION%/${major_version}/;s/%REPLACE_PGM%/${APPNAME}/;s/%REPLACE_VENDOR%/${VENDOR}/;s/%REPLACE_EXE%/${EXENAME}/;s/%REPLACE_GCC5%/${GCC5ABI}/" < stage2.run.in > stage2.run
678 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
679 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
681 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
685 echo "Building tarball ..."
687 rm -f $APPDIR.tar.bz2
688 tar -cjf $APPDIR.tar.bz2 $APPDIR
690 echo "Calculating bundle size"
691 du -sb $APPDIR/ | awk '{print $1}' > $APPDIR.size
693 ( cd $APPDIR ; find . ) > file_list.txt