7 # script for pulling together a Linux app bundle.
17 if [ $# -eq 0 ] ; then
19 echo "ERROR - Please specify build type"
26 while [ $# -gt 0 ] ; do
31 # top level build targets
53 --test) WITH_LADSPA=; STRIP= ; shift ;;
56 # specific build flags
59 --nojack) INTERNAL_JACK= ; shift ;;
60 --noladspa) WITH_LADSPA= ; shift ;;
61 --nostrip) STRIP= ; shift ;;
62 --sysdeps) PRINT_SYSDEPS=1; shift ;;
63 --nls) WITH_NLS=1 ; shift ;;
66 #catch all for unknown arguments
68 echo "!!! ERROR !!! - Unknown argument $1"
75 release_version=`grep -m 1 '^VERSION' ../../wscript | awk '{print $3}' | sed "s/'//g"`
76 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d"'" -f 2`
77 echo "Version is $release_version / $svn_version"
78 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
79 echo "Info string is $info_string"
81 # Figure out our CPU type
83 i[3456789]86|x86|i86pc)
84 echo "Architecture is x86"
89 echo "Architecture is x86_64"
95 echo "ERROR - Unknown architecture `uname -m`"
101 # the waf build tree to use when copying built/generated files
103 BUILD_ROOT=../../build/default
105 # setup directory structure
107 APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}
113 Plugins=$APPLIB/plugins
114 Surfaces=$APPLIB/surfaces
115 Panners=$APPLIB/panners
116 Locale=$Shared/locale
117 Modules=$Libraries/modules
118 Loaders=$Libraries/loaders
121 if [ x$PRINT_SYSDEPS != x ] ; then
123 # print system dependencies
126 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
127 if ! file $file | grep -qs Mach-O ; then
130 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
135 echo "Removing old $APPDIR tree ..."
138 echo "Building new app directory structure ..."
140 # only bother to make the longest paths
153 mkdir -p $Shared/templates
155 # maybe set variables
156 ENVIRONMENT=environment
160 if test x$MIXBUS != x ; then
161 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
163 # current default for MIXBUS version is US keyboard layout without a keypad
165 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
166 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
167 echo export ARDOUR3_UI_RC=ardour3_ui_dark.rc >> $ENVIRONMENT
171 # if we're not going to bundle JACK, make sure we can find
172 # jack in the places where it might be
175 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
177 # create startup helper script
179 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour3
180 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour3
181 #MAIN_EXECUTABLE=ardour-$release_version
182 MAIN_EXECUTABLE=ardour-3.0
184 echo "Copying ardour executable ...."
185 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
186 if test x$STRIP != x ; then
187 strip $APPBIN/$MAIN_EXECUTABLE
191 # note that at present(feb 2011), the .mo files end up in the source tree which is
192 # not really as it should be.
193 if test x$WITH_NLS != x ; then
194 echo "NLS support ..."
195 echo "I hope you remembered to run scons msgupdate!"
197 files=`find ../../gtk2_ardour/ -name "*.mo"`
199 if [ -z "$files" ]; then
201 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../gtk2_ardour"
208 lang=`basename $file | sed 's/\.mo//'`
209 mkdir -p $Locale/$lang/LC_MESSAGES
210 cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo
211 LINGUAS="$LINGUAS $lang"
214 files=`find ../../libs/ardour/ -name "*.mo"`
216 if [ -z "$files" ]; then
218 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../libs/ardour"
225 lang=`basename $file | sed 's/\.mo//'`
226 mkdir -p $Locale/$lang/LC_MESSAGES
227 cp $file $Locale/$lang/LC_MESSAGES/libardour.mo
230 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
231 LOCALEROOT=/usr/share/locale
233 for l in $LINGUAS ; do
234 echo "Copying GTK i18n files for $l..."
235 for MO in $GTK_MESSAGES ; do
236 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
237 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
239 # try with just the language spec
240 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
241 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
242 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
248 echo "Skipping NLS support"
252 GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
253 if [ ! -z "$GTKROOT" ]; then
254 echo "Found GTKROOT using pkg-config"
255 elif [ -d /usr/lib/gtk-2.0 ]; then
256 GTKROOT="/usr/lib/gtk-2.0"
257 elif [ -d /usr/local/lib/gtk-2.0 ]; then
258 GTKROOT="/usr/local/lib/gtk-2.0"
261 echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit"
266 echo "GTKROOT is ${GTKROOT}"
267 versionDir=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
270 for name in $versionDir ; do
274 if [ $num -eq 1 ]; then
275 GTKLIB=${GTKROOT}/gtk-2.0/$versionDir
276 echo "GTKLIB is ${GTKLIB}"
279 echo "!!! ERROR !!! - More than one gtk-2.0 version found in ${GTKROOT}/gtk-2.0/ ( $versionDir ). Packager will exit"
286 PANGOROOT=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g"`
287 if [ ! -z "$PANGOROOT" ]; then
288 echo "Found PANGOROOT using pkg-config"
289 elif [ -d /usr/lib/pango ]; then
290 PANGOROOT="/usr/lib/pango"
291 elif [ -d /usr/local/lib/pango ]; then
292 PANGOROOT="/usr/local/lib/pango"
295 echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit"
300 echo "PANGOROOT is ${PANGOROOT}"
301 versionDir=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
304 for name in $versionDir ; do
308 if [ $num -eq 1 ]; then
309 PANGOLIB=${PANGOROOT}/pango/$versionDir
310 echo "PANGOLIB is ${PANGOLIB}"
313 echo "!!! ERROR !!! - More than one pango version found in ${PANGOROOT}/pango/ ( $versionDir ). Packager will exit"
319 ### Find gdk-pixbuf ###
320 GDKPIXBUFROOT=`pkg-config --libs-only-L gdk-pixbuf-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
321 if [ ! -z "$GDKPIXBUFROOT" ]; then
322 echo "Found GDKPIXBUFROOT using pkg-config"
323 elif [ -d /usr/lib/gdk-pixbuf-2.0 ]; then
324 GDKPIXBUFROOT="/usr/lib/gdk-pixbuf-2.0"
325 elif [ -d /usr/local/lib/gdk-pixbuf-2.0 ]; then
326 GDKPIXBUFROOT="/usr/local/lib/gdk-pixbuf-2.0"
327 elif [ -d ${GTKLIB}/loaders ]; then #odd ball case
328 GDKPIXBUFROOT=${GTKROOT}
329 GDKPIXBUFLIB=${GTKLIB}
332 echo "!!! ERROR !!! - Unable to locate gdk-pixbuf-2.0 directory. Packager will exit"
337 echo "GDKPIXBUFROOT is ${GDKPIXBUFROOT}"
339 if [ -z ${GDKPIXBUFLIB} ]; then
340 versionDir=`ls ${GDKPIXBUFROOT}/gdk-pixbuf-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
343 for name in $versionDir ; do
347 if [ $num -eq 1 ]; then
348 GDKPIXBUFLIB=${GDKPIXBUFROOT}/gdk-pixbuf-2.0/$versionDir
349 echo "GDKPIXBUFLIB is ${GDKPIXBUFLIB}"
352 echo "!!! ERROR !!! - More than one gdk-pixbuf-2.0 version found in ${GDKPIXBUFROOT}/pango/ ( $versionDir ). Packager will exit"
360 echo "Copying all Pango modules ..."
361 cp -R $PANGOLIB/modules/*.so $Modules
363 echo "Copying all GDK Pixbuf loaders ..."
364 cp -R $GDKPIXBUFLIB/loaders/*.so $Loaders
366 pango-querymodules | sed "s?$PANGOLIB/?@ROOTDIR@/?" > $Etc/pango.modules.in
367 gdk-pixbuf-query-loaders | sed "s?$GDKPIXBUFLIB/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
369 # We sort of rely on clearlooks, so include a version
370 # this one is special - we will set GTK_PATH to $Libraries/clearlooks
372 if [ ! -e ${GTKLIB}/engines/libclearlooks.so ]; then
374 echo "!!! ERROR !!! - not able to locate libclearlooks.so"
376 echo "Packager with exit"
380 echo "Copying clearlooks ..."
381 cp ${GTKLIB}/engines/libclearlooks.so $Libraries
382 mkdir -p $Libraries/clearlooks/engines
383 (cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks* libclearlooks.so )
386 if test x$WITH_LADSPA != x ; then
387 if test x$MIXBUS != x ; then
388 plugdir=mixbus_ladspa
392 echo "Copying `ls $plugdir | wc -l` plugins ..."
393 if [ -d $plugdir ] ; then
394 cp -r $plugdir/* $Plugins
399 cp $BUILD_ROOT/libs/surfaces/*/libardour*.so* $Surfaces
400 # hack ... move libardour_cp back into Libraries
401 mv $Surfaces/libardourcp.so* $Libraries
404 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
406 # VAMP plugins that we use
407 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
409 OURLIBDIR=$BUILD_ROOT/libs
410 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
412 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
418 filelist=`find $APPLIB/ -type f`
419 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
421 for file in $filelist ; do
422 if ! file $file | grep -qs ELF ; then
426 # speed this up a bit by not checking things multiple times.
427 for i in "${depCheckedList[@]}"; do
428 if [ $i == $file ]; then
432 depCheckedList[$checkIdx]=$file
433 checkIdx=$(($checkIdx + 1))
435 # do not include libjack
436 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
438 # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.'
440 for dep in $deps ; do
441 if test "not" = ${dep}; then
443 echo "!!! ERROR !!! - Missing dependant library for $file."
445 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
447 echo "!!! ERROR !!! - See Above"
451 # don't use anything mapped at a specific address
452 if echo $dep | grep -qs '0x' ; then continue; fi
454 if echo $dep | grep -qs "^/lib/" ; then continue; fi
456 if echo $dep | grep -qs libjack ; then continue; fi
457 # don't include any X Window libraries
458 if echo $dep | grep -qs libX ; then continue; fi
459 if echo $dep | grep -qs libxcb ; then continue; fi
461 if echo $dep | grep -qs 'libc\.' ; then continue; fi
462 # don't include libstdc++
463 if echo $dep | grep -qs libstdc++ ; then continue; fi
466 if ! test -f $Libraries/$base; then
467 parent=$(basename ${file})
468 if echo $dep | grep -sq '^libs' ; then
469 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
470 cp $BUILD_ROOT/$dep $Libraries
472 echo "Copying dependant lib $dep (required by ${parent})"
479 if test x$missing = xfalse ; then
480 # everything has been found
487 if test x$STRIP != x ; then
488 echo Stripping libraries
489 find $APPLIB/ -name "*.so*" | xargs strip
491 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
493 echo "Copying other stuff to $APPDIR ..."
495 # these are all generated by waf
496 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Etc
497 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
498 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
499 cp $BUILD_ROOT/ardour_system.rc $Etc/ardour_system.rc
500 # temporarily unavailable
501 #cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_light.rc $Etc
502 cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_dark.rc $Etc
504 # these are copied straight from the source tree
506 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui.conf
507 cp ../../instant.xml $Etc/instant.xml
508 cp -r ../../gtk2_ardour/icons $Etc
509 cp -r ../../gtk2_ardour/pixmaps $Etc
512 # put sooper sekrit ingredients here and they will be copied
515 if [ -d specialSauce ] ; then
516 cp -r specialSauce $Etc
521 cp -R ../../gtk2_ardour/splash.png $Shared
522 # currently no templates
523 #cp ../../templates/*.template $Shared/templates/
525 # go through and recursively remove any .svn dirs in the bundle
526 for svndir in `find $APPDIR -name .svn -type d`; do
531 # Add the uninstaller
533 APP_VER_NAME=${APPNAME}-${release_version}_${svn_version}
534 sed -e "s/%REPLACE_PGM%/${APPNAME}/" -e "s/%REPLACE_VENDOR%/${VENDOR}/" -e "s/%REPLACE_VERSION%/${release_version}/" -e "s/%REPLACE_BUILD%/${svn_version}/" < uninstall.sh.in > $APPBIN/${APP_VER_NAME}.uninstall.sh
535 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
538 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
539 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
541 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
546 # and now ... the final package
549 if [ x$MIXBUS != x ] ; then
553 echo "Creating Mixbus packaging directory"
554 cp MixBus_Install_QuickStart.pdf "$APPDIR/Mixbus Install & Quick Start Guide.pdf"
557 echo "Building tarball ..."
559 rm -f $APPDIR.tar.bz2
560 tar -cjf $APPDIR.tar.bz2 $APPDIR