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 . ./define_versions.sh
92 echo "Version is $version / $commit"
93 info_string="$version ($commit) 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 if [ x$DEBUG = xT ]; then
118 if [ x$STRIP = xall ] ; then
119 echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
124 # setup directory structure
126 if [ -z "${BUILDTYPE}" ]; then
127 APPDIR=${APPNAME}_${ARCH}-${version}
128 APP_VER_NAME=${APPNAME}-${version}
130 APPDIR=${APPNAME}_${ARCH}-${version}-${BUILDTYPE}
131 APP_VER_NAME=${APPNAME}-${version}-${BUILDTYPE}
140 Plugins=$APPLIB/plugins
141 Surfaces=$APPLIB/surfaces
142 Panners=$APPLIB/panners
144 Modules=$Libraries/modules
145 Loaders=$Libraries/loaders
147 Templates=$Shared/templates
148 ExportFormats=$Shared/export
149 Locale=$Shared/locale
150 MidiMaps=$Shared/midi_maps
151 PatchFiles=$Shared/patchfiles
152 MackieControl=$Shared/mcp
154 if [ x$PRINT_SYSDEPS != x ] ; then
156 # print system dependencies
159 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
160 if ! file $file | grep -qs Mach-O ; then
163 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
168 echo "Removing old $APPDIR tree ..."
171 echo "Building new app directory structure ..."
173 # only bother to make the longest paths
187 mkdir -p $MackieControl
188 mkdir -p $ExportFormats
191 mkdir -p $Shared/templates
194 # maybe set variables
195 ENVIRONMENT=environment
199 if test x$MIXBUS != x ; then
200 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
202 # current default for MIXBUS version is US keyboard layout without a keypad
204 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
205 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
206 echo export ARDOUR3_UI_RC=ardour3_ui_dark.rc >> $ENVIRONMENT
210 # if we're not going to bundle JACK, make sure we can find
211 # jack in the places where it might be
214 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
216 # create startup helper script
218 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour3
219 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour3
220 # the 3.0 here is not the same as "release-version" because the latter may include "-betaN" etc.
221 MAIN_EXECUTABLE=ardour-3.0
223 echo "Copying ardour executable ...."
224 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
225 if test x$STRIP = xall ; then
226 strip $APPBIN/$MAIN_EXECUTABLE
230 # note that at present(feb 2011), the .mo files end up in the source tree which is
231 # not really as it should be.
232 if test x$WITH_NLS != x ; then
233 echo "NLS support ..."
234 echo "I hope you remembered to run scons msgupdate!"
237 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
238 files=`find ../../$pkg -name "*.mo"`
241 # the package name is appended with a number so that
242 # it can be parallel installed during a regular install
243 # with older (and newer) versions. it is just the major
244 # number of the release (i.e. leading digits)
247 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
249 if [ -z "$files" ]; then
251 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
258 lang=`basename $file | sed 's/\.mo//'`
259 mkdir -p $Locale/$lang/LC_MESSAGES
260 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
261 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
262 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
265 LINGUAS="$LINGUAS $lang"
270 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
271 LOCALEROOT=$GTKSTACK_ROOT/share/locale
273 for l in $LINGUAS ; do
274 echo "Copying GTK i18n files for $l..."
275 for MO in $GTK_MESSAGES ; do
276 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
277 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
279 # try with just the language spec
280 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
281 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
282 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
288 echo "Skipping NLS support"
292 # Copy stuff that may be dynamically loaded
295 cp -R $GTKSTACK_ROOT/etc/* $Etc
296 echo "Copying all Pango modules ..."
297 cp -R $GTKSTACK_ROOT/lib/pango/1.6.0/modules/*.so $Modules
298 echo "Copying all GDK Pixbuf loaders ..."
299 cp -R $GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so $Loaders
301 # Generate a pango module file using the actual Pango that we're going to bundle
305 ModulesPath=$GTKSTACK_ROOT/lib/pango/1.6.0/modules
307 env PANGO_RC_FILE=pangorc $GTKSTACK_ROOT/bin/pango-querymodules | sed "s?$GTKSTACK_ROOT/lib/pango/1.6.0/?@ROOTDIR@/?" > $Etc/pango.modules.in
310 # Ditto for gdk-pixbuf loaders
311 gdk-pixbuf-query-loaders | sed "s?$GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
313 # We rely on clearlooks, so include a version from our own build tree
314 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
316 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
317 mkdir -p $GTK_ENGINE_DIR
319 echo "Copying GTK engines ..."
320 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
321 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
323 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
324 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
327 if test x$WITH_LADSPA != x ; then
328 if test x$MIXBUS != x ; then
329 plugdir=mixbus_ladspa
333 echo "Copying `ls $plugdir | wc -l` plugins ..."
334 if [ -d $plugdir ] ; then
335 cp -r $plugdir/* $Plugins
340 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
341 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
344 # got to be careful with names here
345 for x in $BUILD_ROOT/../midi_maps/*.map ; do
350 # got to be careful with names here
351 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
356 # got to be careful with names here
357 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
358 cp "$x" $MackieControl
362 for f in $BUILD_ROOT/../templates/* ; do
363 if [ -d "$f" ] ; then
364 echo Template: $f ; cp -r "$f" $Templates ;
369 # got to be careful with names here
370 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
371 cp "$x" $ExportFormats
375 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
377 # VAMP plugins that we use
378 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
381 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
383 OURLIBDIR=$BUILD_ROOT/libs
384 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/libltc:$OURLIBDIR/qm-dsp
386 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
393 filelist=`find $APPLIB/ -type f`
394 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
396 for file in $filelist ; do
397 if ! file $file | grep -qs ELF ; then
401 # speed this up a bit by not checking things multiple times.
402 for i in "${depCheckedList[@]}"; do
403 if [ $i == $file ]; then
407 depCheckedList[$checkIdx]=$file
408 checkIdx=$(($checkIdx + 1))
410 # do not include libjack
411 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
414 for dep in $deps ; do
415 if test "not" = ${dep}; then
417 echo "!!! ERROR !!! - Missing dependant library for $file."
418 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
420 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
422 echo "!!! ERROR !!! - See Above"
426 # don't use anything mapped at a specific address
427 if echo $dep | grep -qs '0x' ; then continue; fi
429 if echo $dep | grep -qs "^/lib/" ; then continue; fi
431 if echo $dep | grep -qs libjack ; then continue; fi
433 if echo $dep | grep -qs libasound ; then continue; fi
434 # don't include any X Window libraries
435 if echo $dep | grep -qs libX\. ; then continue; fi
436 if echo $dep | grep -qs libxcb ; then continue; fi
437 if echo $dep | grep -qs libICE\. ; then continue; fi
438 if echo $dep | grep -qs libSM\. ; then continue; fi
440 if echo $dep | grep -qs 'libc\.' ; then continue; fi
441 # don't include libstdc++
442 if echo $dep | grep -qs libstdc++ ; then continue; fi
445 if ! test -f $Libraries/$base; then
446 parent=$(basename ${file})
447 if echo $dep | grep -sq '^libs' ; then
448 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
449 cp $BUILD_ROOT/$dep $Libraries
451 echo "Copying dependant lib $dep (required by ${parent})"
455 # reset RPATH so that the runtime linker never looks
456 # in places we don't want it to
458 chrpath -r foo $Libraries/`basename $dep`
459 if echo $dep | grep -sq '^/' ; then
460 # absolute path, candidate for stripping
461 deplibs="$deplibs $base"
467 if test x$missing = xfalse ; then
468 # everything has been found
475 if test x$STRIP = xall ; then
476 echo Stripping all libraries
477 # Must be writable so that we can strip
478 find $APPLIB/ -name "*.so*" | xargs chmod u+w
480 find $APPLIB/ -name "*.so*" | xargs strip
481 elif test x$STRIP = xsome ; then
482 echo Stripping dependent libraries
483 for l in $deplibs ; do
488 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
490 echo "Copying other stuff to $APPDIR ..."
492 # these are all generated by waf
493 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Etc
494 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
495 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
496 cp ../../ardour_system.rc $Etc/ardour_system.rc
497 cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_*.rc $Etc
499 # these are copied straight from the source tree
501 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui_default.conf
502 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui.conf
503 cp ../../instant.xml $Etc/instant.xml
504 cp ../../gtk2_ardour/step_editing.bindings $Etc
505 cp ../../gtk2_ardour/mixer.bindings $Etc
506 cp -r ../../gtk2_ardour/icons $Shared
507 cp -r ../../gtk2_ardour/pixmaps $Shared
511 # put sooper sekrit ingredients here and they will be copied
514 if [ -d specialSauce ] ; then
515 cp -r specialSauce $Etc
520 cp -R ../../gtk2_ardour/splash.png $Shared
521 cp -R ../../gtk2_ardour/ArdourMono.ttf $Shared
523 # go through and recursively remove any .svn dirs in the bundle
524 for svndir in `find $APPDIR -name .svn -type d`; do
529 # Add the uninstaller
531 sed -e "s/%REPLACE_PGM%/${APPNAME}/" -e "s/%REPLACE_VENDOR%/${VENDOR}/" -e "s/%REPLACE_VERSION%/${version}/" -e "s/%REPLACE_TYPE%/${BUILDTYPE}/" < uninstall.sh.in > $APPBIN/${APP_VER_NAME}.uninstall.sh
532 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
535 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
536 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
538 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
542 echo "Building tarball ..."
544 rm -f $APPDIR.tar.bz2
545 tar -cjf $APPDIR.tar.bz2 $APPDIR
547 echo "Calculating bundle size"
548 du -sb $APPDIR/ | awk '{print $1}' > $APPDIR.size