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
39 if [ $# -eq 0 ] ; then
41 echo "ERROR - Please specify build type"
48 while [ $# -gt 0 ] ; do
53 # top level build targets
78 --test) WITH_LADSPA=; STRIP= ; shift ;;
81 # specific build flags
84 --nojack) INTERNAL_JACK= ; shift ;;
85 --noladspa) WITH_LADSPA= ; shift ;;
86 --strip) STRIP=$2 ; shift ; shift ;;
87 --sysdeps) PRINT_SYSDEPS=1; shift ;;
88 --nls) WITH_NLS=1 ; shift ;;
89 --harvid) WITH_HARVID=1 ; shift ;;
90 --gcc5abi) GCC5ABI=true ; shift ;;
93 #catch all for unknown arguments
95 echo "!!! ERROR !!! - Unknown argument $1"
102 if test x$STRIP != xall -a x$STRIP != xnone -a x$STRIP != xsome ; then
103 echo "Unknown strip option \"$STRIP\""
104 echo "Legal values are: all, none, some"
108 . ../define_versions.sh
110 echo "Version is $release_version"
111 if [ "x$commit" != "x" ] ; then
112 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
114 info_string="$release_version built on `hostname` by `whoami` on `date`"
116 echo "Info string is $info_string"
118 # Figure out our CPU type
120 i[3456789]86|x86|i86pc)
121 echo "Architecture is x86"
126 MULTIARCH='i386-linux-gnu'
129 echo "Architecture is x86_64"
134 MULTIARCH='x86_64-linux-gnu'
138 echo "ERROR - Unknown architecture `uname -m`"
144 if [ x$DEBUG = xT ]; then
146 if [ x$STRIP = xall ] ; then
147 echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
152 # setup directory structure
154 if [ -z "${BUILDTYPE}" ]; then
155 APPDIR=${APPNAME}_${ARCH}-${release_version}
156 APP_VER_NAME=${APPNAME}-${release_version}
158 APPDIR=${APPNAME}_${ARCH}-${release_version}-${BUILDTYPE}
159 APP_VER_NAME=${APPNAME}-${release_version}-${BUILDTYPE}
168 Plugins=$APPLIB/plugins
169 Surfaces=$APPLIB/surfaces
170 Panners=$APPLIB/panners
171 Backends=$APPLIB/backends
173 Templates=$Shared/templates
174 ExportFormats=$Shared/export
175 Locale=$Shared/locale
176 MidiMaps=$Shared/midi_maps
177 PatchFiles=$Shared/patchfiles
178 MackieControl=$Shared/mcp
180 if [ x$PRINT_SYSDEPS != x ] ; then
182 # print system dependencies
185 for file in $APPBIN/* $Libraries/* $Plugins/*.so ; do
186 if ! file $file | grep -qs Mach-O ; then
189 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
194 echo "Removing old $APPDIR tree ..."
197 echo "Building new app directory structure ..."
199 # only bother to make the longest paths
210 mkdir -p $MackieControl
211 mkdir -p $ExportFormats
217 # maybe set variables
218 ENVIRONMENT=environment
222 if test x$MIXBUS != x ; then
223 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
225 # current default for MIXBUS version is US keyboard layout without a keypad
227 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
228 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
232 # if we're not going to bundle JACK, make sure we can find
233 # jack in the places where it might be
236 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
238 # create startup helper script
240 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/;s/%EXENAME%/'"${EXENAME}"'/' < ardour.sh.in > $APPBIN/${EXENAME}${major_version}
241 rm $ENVIRONMENT && chmod 775 $APPBIN/${EXENAME}${major_version}
243 echo "Copying ardour executable ...."
244 cp -v $BUILD_ROOT/gtk2_ardour/ardour-${release_version} $APPBIN/${EXENAME}-${release_version}
245 if test x$STRIP = xall ; then
246 strip $APPBIN/${EXENAME}-${release_version}
250 # note that at present(feb 2011), the .mo files end up in the source tree which is
251 # not really as it should be.
252 if test x$WITH_NLS != x ; then
253 echo "NLS support ..."
254 echo "I hope you remembered to run scons msgupdate!"
257 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
258 files=`find ../../$pkg -name "*.mo"`
261 # the package name is appended with a number so that
262 # it can be parallel installed during a regular install
263 # with older (and newer) versions. it is just the major
264 # number of the release (i.e. leading digits)
267 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
269 if [ -z "$files" ]; then
271 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
278 lang=`basename $file | sed 's/\.mo//'`
279 mkdir -p $Locale/$lang/LC_MESSAGES
280 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
281 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
282 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
285 LINGUAS="$LINGUAS $lang"
290 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
291 LOCALEROOT=$GTKSTACK_ROOT/share/locale
293 for l in $LINGUAS ; do
294 echo "Copying GTK i18n files for $l..."
295 for MO in $GTK_MESSAGES ; do
296 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
297 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
299 # try with just the language spec
300 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
301 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
302 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
308 echo "Skipping NLS support"
312 # Copy stuff that may be dynamically loaded
315 cp -R $GTKSTACK_ROOT/etc/* $Etc
317 # We rely on clearlooks, so include a version from our own build tree
318 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
320 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
321 mkdir -p $GTK_ENGINE_DIR
323 echo "Copying GTK engines ..."
324 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
325 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
327 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
328 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
331 if test x$WITH_LADSPA != x ; then
332 if test x$MIXBUS != x ; then
333 plugdir=mixbus_ladspa
337 echo "Copying `ls $plugdir | wc -l` plugins ..."
338 if [ -d $plugdir ] ; then
340 cp -r $plugdir/* $Plugins
345 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
346 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
349 # got to be careful with names here
350 for x in $BUILD_ROOT/../midi_maps/*.map ; do
355 # got to be careful with names here
356 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
361 # got to be careful with names here
362 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
363 cp "$x" $MackieControl
367 #for f in $BUILD_ROOT/../templates/* ; do
368 # if [ -d "$f" ] ; then
369 # echo Template: $f ; cp -r "$f" $Templates ;
374 # got to be careful with names here
375 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
376 cp "$x" $ExportFormats
380 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
383 for backend in jack alsa dummy wavesaudio ; do
384 cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
387 # VAMP plugins that we use
388 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
390 # Suil modules (new dir 'build-stack')
391 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
392 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
395 # Suil modules (old dir 'build-ardour-stack')
396 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
397 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
400 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
401 # (if build with wine: ardour-vst-scanner is a wrapper
402 # script for ardour-vst-scanner.exe.so, if VST is disabled
403 # neither binary nor script exists)
404 if test -d $BUILD_ROOT/libs/fst ; then
405 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
409 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
410 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
413 # ALSA device reservation tool (if available)
414 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
415 cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
418 OURLIBDIR=$BUILD_ROOT/libs
419 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
421 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
428 filelist=`find $APPLIB/ -type f`
429 filelist="$APPBIN/${EXENAME}-${release_version} $filelist"
431 for file in $filelist ; do
432 if ! file $file | grep -qs ELF ; then
436 # speed this up a bit by not checking things multiple times.
437 for i in "${depCheckedList[@]}"; do
438 if [ $i == $file ]; then
442 depCheckedList[$checkIdx]=$file
443 checkIdx=$(($checkIdx + 1))
445 # ignore suil/qt wrappers - the plugin will pull in QT4.
446 if echo $file | grep -qs 'libsuil_.*qt4' ; then continue; fi
448 # do not include libjack
449 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
452 for dep in $deps ; do
453 if test "not" = ${dep}; then
455 echo "!!! ERROR !!! - Missing dependant library for $file."
456 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
458 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
460 echo "!!! ERROR !!! - See Above"
464 # don't use anything mapped at a specific address
465 if echo $dep | grep -qs '0x' ; then continue; fi
467 if echo $dep | grep -qs "^/lib/" ; then continue; fi
469 if echo $dep | grep -qs libjack ; then continue; fi
471 if echo $dep | grep -qs libasound ; then continue; fi
472 # don't include any X Window libraries
473 if echo $dep | grep -qs libX\. ; then continue; fi
474 if echo $dep | grep -qs libxcb ; then continue; fi
475 if echo $dep | grep -qs libICE\. ; then continue; fi
476 if echo $dep | grep -qs libSM\. ; then continue; fi
478 if echo $dep | grep -qs 'libc\.' ; then continue; fi
479 # don't include libstdc++
480 if echo $dep | grep -qs libstdc++ ; then continue; fi
481 # don't include libdbus
482 if echo $dep | grep -qs libdbus ; then continue; fi
485 if ! test -f $Libraries/$base; then
486 parent=$(basename ${file})
487 if echo $dep | grep -sq '^libs' ; then
488 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
489 cp $BUILD_ROOT/$dep $Libraries
491 echo "Copying dependant lib $dep (required by ${parent})"
495 # reset RPATH so that the runtime linker never looks
496 # in places we don't want it to
498 chrpath -r foo $Libraries/`basename $dep`
499 if echo $dep | grep -sq '^/' ; then
500 # absolute path, candidate for stripping
501 deplibs="$deplibs $base"
507 if test x$missing = xfalse ; then
508 # everything has been found
515 if test x$STRIP = xall ; then
516 echo Stripping all libraries
517 # Must be writable so that we can strip
518 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod u+w
520 find $APPLIB/ -name "*.so*" -print0 | xargs -0 strip -s
521 elif test x$STRIP = xsome ; then
522 echo Stripping dependent libraries
523 for l in $deplibs ; do
528 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod a+rx
530 echo "Copying other stuff to $APPDIR ..."
532 # these are all generated by waf
533 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
534 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
535 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
536 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
538 # Copied directly from source tree
540 cp ../../system_config $Etc/system_config
541 cp ../../gtk2_ardour/dark.colors $Etc
542 cp ../../instant.xml $Shared/instant.xml
543 cp ../../gtk2_ardour/step_editing.bindings $Etc
544 cp ../../gtk2_ardour/mixer.bindings $Etc
545 cp -r ../../gtk2_ardour/icons $Shared
546 cp -r ../../gtk2_ardour/pixmaps $Shared
547 cp -r ../../gtk2_ardour/splash.png $Shared
548 cp -r ../../gtk2_ardour/small-splash.png $Shared
549 cp -r ../../gtk2_ardour/ArdourMono.ttf $Shared
552 # put sooper sekrit ingredients here and they will be copied
555 if [ -d specialSauce ] ; then
556 cp -r specialSauce $Etc
559 # install bundled LV2s to <app>/lib/LV2/
560 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
562 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
563 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
564 mkdir -p $APPLIB/LV2/lv2core.lv2
565 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
566 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
567 mkdir -p $APPLIB/LV2/lv2core.lv2
568 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
571 # go through and recursively remove any .svn dirs in the bundle
572 for svndir in `find $APPDIR -name .svn -type d`; do
577 ################################################################################
578 ### Mixbus plugins, etc
579 if test x$WITH_HARRISON_LV2 != x ; then
580 echo "Adding Harrison LV2s"
583 curl -s -S --fail -# \
584 -z "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
585 -o "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
586 http://www.harrisonconsoles.com/mixbus/mb3/${HARCH}/harrison_lv2s.zip
587 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/harrison_lv2s.${HARCH}.zip"
590 if test -n "$MIXBUS"; then
591 echo "Adding Mixbus Channelstrip"
593 mkdir -p $APPLIB/ladspa/strip/
594 curl -s -S --fail -# \
595 -z "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
596 -o "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
597 http://www.harrisonconsoles.com/mixbus/mb3/${HARCH}/harrison_channelstrip.so
599 cp "${CACHEDIR}/harrison_channelstrip.${HARCH}.so" \
600 $APPLIB/ladspa/strip/harrison_channelstrip.so
601 chmod +x $APPLIB/ladspa/strip/harrison_channelstrip.so
604 if test x$WITH_X42_LV2 != x ; then
605 METERS_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/x42-meters.latest.txt)
606 rsync -a -q --partial \
607 rsync://x42-plugins.com/x42/linux/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip \
608 "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
609 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
611 SETBFREE_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/setBfree.latest.txt)
612 rsync -a -q --partial \
613 rsync://x42-plugins.com/x42/linux/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip \
614 "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
615 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
617 MIDIFILTER_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/x42-midifilter.latest.txt)
618 rsync -a -q --partial \
619 rsync://x42-plugins.com/x42/linux/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip \
620 "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
621 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
624 ################################################################################
627 if test x$WITH_HARVID != x ; then
629 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
630 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
633 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
634 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
637 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
638 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
641 --exclude=README --exclude=harvid.1 --strip-components=1 \
642 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
645 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
646 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
652 # Add the uninstaller
654 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
655 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
658 # Add the stage2.run script
660 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
664 # gcc4/5 ABI test tool
665 if [ -e $BUILD_ROOT/tools/gccabicheck/gcc-glibmm-abi-check ]; then
666 cp $BUILD_ROOT/tools/gccabicheck/gcc-glibmm-abi-check $APPBIN
668 echo "!!!ERROR !!! gcc-glibmm-abi-check program is missing. packager will exit without being complete"
673 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
674 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
676 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
680 echo "Building tarball ..."
682 rm -f $APPDIR.tar.bz2
683 tar -cjf $APPDIR.tar.bz2 $APPDIR
685 echo "Calculating bundle size"
686 du -sb $APPDIR/ | awk '{print $1}' > $APPDIR.size
688 ( cd $APPDIR ; find . ) > file_list.txt