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
26 if [ $# -eq 0 ] ; then
28 echo "ERROR - Please specify build type"
35 while [ $# -gt 0 ] ; do
40 # top level build targets
62 --test) WITH_LADSPA=; STRIP= ; shift ;;
65 # specific build flags
68 --nojack) INTERNAL_JACK= ; shift ;;
69 --noladspa) WITH_LADSPA= ; shift ;;
70 --strip) STRIP=$2 ; shift ; shift ;;
71 --sysdeps) PRINT_SYSDEPS=1; shift ;;
72 --nls) WITH_NLS=1 ; shift ;;
75 #catch all for unknown arguments
77 echo "!!! ERROR !!! - Unknown argument $1"
84 if test x$STRIP != xall -a x$STRIP != xnone -a x$STRIP != xsome ; then
85 echo "Unknown strip option \"$STRIP\""
86 echo "Legal values are: all, none, some"
90 release_version=`grep -m 1 '^VERSION' ../../wscript | awk '{print $3}' | sed "s/'//g"`
91 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d"'" -f 2`
92 echo "Version is $release_version / $svn_version"
93 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
94 echo "Info string is $info_string"
96 # Figure out our CPU type
98 i[3456789]86|x86|i86pc)
99 echo "Architecture is x86"
104 echo "Architecture is x86_64"
110 echo "ERROR - Unknown architecture `uname -m`"
116 # Figure out the Build Type
117 if grep -q "DEBUG = True" ../../build/c4che/default.cache.py; then
123 if [ x$DEBUG = xT ]; then
125 if [ x$STRIP = xall ] ; then
126 echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
131 # setup directory structure
133 if [ -z "${BUILDTYPE}" ]; then
134 APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}
135 APP_VER_NAME=${APPNAME}-${release_version}_${svn_version}
137 APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}-${BUILDTYPE}
138 APP_VER_NAME=${APPNAME}-${release_version}_${svn_version}-${BUILDTYPE}
147 Plugins=$APPLIB/plugins
148 Surfaces=$APPLIB/surfaces
149 Panners=$APPLIB/panners
151 Modules=$Libraries/modules
152 Loaders=$Libraries/loaders
154 Templates=$Shared/templates
155 ExportFormats=$Shared/export
156 Locale=$Shared/locale
157 MidiMaps=$Shared/midi_maps
158 PatchFiles=$Shared/patchfiles
159 MackieControl=$Shared/mcp
161 if [ x$PRINT_SYSDEPS != x ] ; then
163 # print system dependencies
166 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
167 if ! file $file | grep -qs Mach-O ; then
170 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
175 echo "Removing old $APPDIR tree ..."
178 echo "Building new app directory structure ..."
180 # only bother to make the longest paths
194 mkdir -p $MackieControl
195 mkdir -p $ExportFormats
198 mkdir -p $Shared/templates
201 # maybe set variables
202 ENVIRONMENT=environment
206 if test x$MIXBUS != x ; then
207 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
209 # current default for MIXBUS version is US keyboard layout without a keypad
211 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
212 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
213 echo export ARDOUR3_UI_RC=ardour3_ui_dark.rc >> $ENVIRONMENT
217 # if we're not going to bundle JACK, make sure we can find
218 # jack in the places where it might be
221 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
223 # create startup helper script
225 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour3
226 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour3
227 # the 3.0 here is not the same as "release-version" because the latter may include "-betaN" etc.
228 MAIN_EXECUTABLE=ardour-3.0
230 echo "Copying ardour executable ...."
231 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
232 if test x$STRIP = xall ; then
233 strip $APPBIN/$MAIN_EXECUTABLE
237 # note that at present(feb 2011), the .mo files end up in the source tree which is
238 # not really as it should be.
239 if test x$WITH_NLS != x ; then
240 echo "NLS support ..."
241 echo "I hope you remembered to run scons msgupdate!"
244 for dl in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
245 files=`find ../../$dl -name "*.mo"`
247 if [ -z "$files" ]; then
249 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$dl"
256 lang=`basename $file | sed 's/\.mo//'`
257 mkdir -p $Locale/$lang/LC_MESSAGES
258 cp $file $Locale/$lang/LC_MESSAGES/`basename $dl`
259 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
262 LINGUAS="$LINGUAS $lang"
267 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
268 LOCALEROOT=/usr/share/locale
270 for l in $LINGUAS ; do
271 echo "Copying GTK i18n files for $l..."
272 for MO in $GTK_MESSAGES ; do
273 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
274 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
276 # try with just the language spec
277 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
278 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
279 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
285 echo "Skipping NLS support"
289 # Copy stuff that may be dynamically loaded
292 cp -R $GTKSTACK_ROOT/etc/fonts $Etc
293 cp -R $GTKSTACK_ROOT/etc/* $Etc
294 echo "Copying all Pango modules ..."
295 cp -R $GTKSTACK_ROOT/lib/pango/1.6.0/modules/*.so $Modules
296 echo "Copying all GDK Pixbuf loaders ..."
297 cp -R $GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so $Loaders
299 cp -R $GTKSTACK_ROOT/lib/charset.alias $Etc
301 pango-querymodules | sed "s?$GTKSTACK_ROOT/lib/pango/1.6.0/?@ROOTDIR@/?" > $Etc/pango.modules.in
302 gdk-pixbuf-query-loaders | sed "s?$GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
304 # We sort of rely on clearlooks, so include a version
305 # this one is special - we will set GTK_PATH to $Libraries/clearlooks
307 clearlooks_so=${GTKLIB}/engines/libclearlooks.so
308 if [ ! -e $clearlooks.so ]; then
309 echo "!!! ERROR !!! - not able to locate libclearlooks.so"
311 echo "Packager with exit"
315 echo "Copying clearlooks ..."
316 cp $clearlooks_so $Libraries
317 mkdir -p $Libraries/clearlooks/engines
318 (cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks* libclearlooks.so )
321 if test x$WITH_LADSPA != x ; then
322 if test x$MIXBUS != x ; then
323 plugdir=mixbus_ladspa
327 echo "Copying `ls $plugdir | wc -l` plugins ..."
328 if [ -d $plugdir ] ; then
329 cp -r $plugdir/* $Plugins
334 cp $BUILD_ROOT/libs/surfaces/*/libardour*.so* $Surfaces
335 # hack ... move libardour_cp back into Libraries
336 mv $Surfaces/libardourcp.so* $Libraries
339 # got to be careful with names here
340 for x in $BUILD_ROOT/../midi_maps/*.map ; do
342 echo Copied MIDI map $x
346 # got to be careful with names here
347 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
349 echo Copied MIDNAM file "$x"
353 # got to be careful with names here
354 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
355 cp "$x" $MackieControl
356 echo Copied Mackie Control file $x
360 for f in $BUILD_ROOT/../templates/* ; do
361 if [ -d "$f" ] ; then
362 echo Template: $f ; cp -r "$f" $Templates ;
367 # got to be careful with names here
368 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
369 cp "$x" $ExportFormats
373 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
375 # VAMP plugins that we use
376 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
379 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
381 OURLIBDIR=$BUILD_ROOT/libs
382 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/libgnomecanvasmm:$OURLIBDIR/libsndfile:$OURLIBDIR/evoral:$OURLIBDIR/evoral/src/libsmf:$OURLIBDIR/audiographer:$OURLIBDIR/timecode:$OURLIBDIR/taglib:$OURLIBDIR/qm-dsp
384 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
391 filelist=`find $APPLIB/ -type f`
392 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
394 for file in $filelist ; do
395 if ! file $file | grep -qs ELF ; then
399 # speed this up a bit by not checking things multiple times.
400 for i in "${depCheckedList[@]}"; do
401 if [ $i == $file ]; then
405 depCheckedList[$checkIdx]=$file
406 checkIdx=$(($checkIdx + 1))
408 # do not include libjack
409 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
412 for dep in $deps ; do
413 if test "not" = ${dep}; then
415 echo "!!! ERROR !!! - Missing dependant library for $file."
417 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
419 echo "!!! ERROR !!! - See Above"
423 # don't use anything mapped at a specific address
424 if echo $dep | grep -qs '0x' ; then continue; fi
426 if echo $dep | grep -qs "^/lib/" ; then continue; fi
428 if echo $dep | grep -qs libjack ; then continue; fi
430 if echo $dep | grep -qs libasound ; then continue; fi
431 # don't include any X Window libraries
432 if echo $dep | grep -qs libX\. ; then continue; fi
433 if echo $dep | grep -qs libxcb ; then continue; fi
434 if echo $dep | grep -qs libICE\. ; then continue; fi
435 if echo $dep | grep -qs libSM\. ; then continue; fi
437 if echo $dep | grep -qs 'libc\.' ; then continue; fi
438 # don't include libstdc++
439 if echo $dep | grep -qs libstdc++ ; then continue; fi
442 if ! test -f $Libraries/$base; then
443 parent=$(basename ${file})
444 if echo $dep | grep -sq '^libs' ; then
445 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
446 cp $BUILD_ROOT/$dep $Libraries
448 echo "Copying dependant lib $dep (required by ${parent})"
451 if echo $dep | grep -sq '^/' ; then
452 # absolute path, candidate for stripping
453 deplibs="$deplibs $base"
459 if test x$missing = xfalse ; then
460 # everything has been found
467 if test x$STRIP = xall ; then
468 echo Stripping all libraries
469 # Must be writable so that we can strip
470 find $APPLIB/ -name "*.so*" | xargs chmod u+w
472 find $APPLIB/ -name "*.so*" | xargs strip
473 elif test x$STRIP = xsome ; then
474 echo Stripping dependent libraries
475 for l in $deplibs ; do
480 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
482 echo "Copying other stuff to $APPDIR ..."
484 # these are all generated by waf
485 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Etc
486 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
487 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
488 cp $BUILD_ROOT/ardour_system.rc $Etc/ardour_system.rc
489 cp $BUILD_ROOT/gtk2_ardour/ardour3*.rc $Etc
491 # these are copied straight from the source tree
493 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui_default.conf
494 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui.conf
495 cp ../../instant.xml $Etc/instant.xml
496 cp ../../gtk2_ardour/step_editing.bindings $Etc
497 cp ../../gtk2_ardour/mixer.bindings $Etc
498 cp -r ../../gtk2_ardour/icons $Shared
499 cp -r ../../gtk2_ardour/pixmaps $Shared
503 # put sooper sekrit ingredients here and they will be copied
506 if [ -d specialSauce ] ; then
507 cp -r specialSauce $Etc
512 cp -R ../../gtk2_ardour/splash.png $Shared
514 # go through and recursively remove any .svn dirs in the bundle
515 for svndir in `find $APPDIR -name .svn -type d`; do
520 # Add the uninstaller
522 sed -e "s/%REPLACE_PGM%/${APPNAME}/" -e "s/%REPLACE_VENDOR%/${VENDOR}/" -e "s/%REPLACE_VERSION%/${release_version}/" -e "s/%REPLACE_BUILD%/${svn_version}/" -e "s/%REPLACE_TYPE%/${BUILDTYPE}/" < uninstall.sh.in > $APPBIN/${APP_VER_NAME}.uninstall.sh
523 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
526 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
527 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
529 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
533 echo "Building tarball ..."
535 rm -f $APPDIR.tar.bz2
536 tar -cjf $APPDIR.tar.bz2 $APPDIR
538 echo "Calculating bundle size"
539 du -sb $APPDIR/ | awk '{print $1}' > $APPDIR.size