7 # script for pulling together a Linux app bundle.
9 # This will create a bundle for a single architecture.
10 # Execute this scirpt on both x86 and x86_64 and then use
11 # package to merge the 2 bundles into a final package with the
23 if [ $# -eq 0 ] ; then
25 echo "ERROR - Please specify build type"
32 while [ $# -gt 0 ] ; do
37 # top level build targets
59 --test) WITH_LADSPA=; STRIP= ; shift ;;
62 # specific build flags
65 --nojack) INTERNAL_JACK= ; shift ;;
66 --noladspa) WITH_LADSPA= ; shift ;;
67 --nostrip) STRIP= ; shift ;;
68 --sysdeps) PRINT_SYSDEPS=1; shift ;;
69 --nls) WITH_NLS=1 ; shift ;;
72 #catch all for unknown arguments
74 echo "!!! ERROR !!! - Unknown argument $1"
81 release_version=`grep -m 1 '^VERSION' ../../wscript | awk '{print $3}' | sed "s/'//g"`
82 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d"'" -f 2`
83 echo "Version is $release_version / $svn_version"
84 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
85 echo "Info string is $info_string"
87 # Figure out our CPU type
89 i[3456789]86|x86|i86pc)
90 echo "Architecture is x86"
95 echo "Architecture is x86_64"
101 echo "ERROR - Unknown architecture `uname -m`"
107 # Figure out the Build Type
108 if grep -q "DEBUG = True" ../../build/c4che/default.cache.py; then
114 if [ x$DEBUG != x ]; then
115 if [ x$STRIP != x ]; then
122 # the waf build tree to use when copying built/generated files
124 BUILD_ROOT=../../build/default
126 # setup directory structure
128 if [ -z "${BUILDTYPE}" ]; then
129 APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}
130 APP_VER_NAME=${APPNAME}-${release_version}_${svn_version}
132 APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}-${BUILDTYPE}
133 APP_VER_NAME=${APPNAME}-${release_version}_${svn_version}-${BUILDTYPE}
141 Plugins=$APPLIB/plugins
142 Surfaces=$APPLIB/surfaces
143 Panners=$APPLIB/panners
144 Locale=$Shared/locale
145 Modules=$Libraries/modules
146 Loaders=$Libraries/loaders
149 if [ x$PRINT_SYSDEPS != x ] ; then
151 # print system dependencies
154 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
155 if ! file $file | grep -qs Mach-O ; then
158 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
163 echo "Removing old $APPDIR tree ..."
166 echo "Building new app directory structure ..."
168 # only bother to make the longest paths
181 mkdir -p $Shared/templates
184 # maybe set variables
185 ENVIRONMENT=environment
189 if test x$MIXBUS != x ; then
190 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
192 # current default for MIXBUS version is US keyboard layout without a keypad
194 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
195 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
196 echo export ARDOUR3_UI_RC=ardour3_ui_dark.rc >> $ENVIRONMENT
200 # if we're not going to bundle JACK, make sure we can find
201 # jack in the places where it might be
204 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
206 # create startup helper script
208 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour3
209 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour3
210 #MAIN_EXECUTABLE=ardour-$release_version
211 MAIN_EXECUTABLE=ardour-3.0
213 echo "Copying ardour executable ...."
214 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
215 if test x$STRIP != x ; then
216 strip $APPBIN/$MAIN_EXECUTABLE
220 # note that at present(feb 2011), the .mo files end up in the source tree which is
221 # not really as it should be.
222 if test x$WITH_NLS != x ; then
223 echo "NLS support ..."
224 echo "I hope you remembered to run scons msgupdate!"
226 files=`find ../../gtk2_ardour/ -name "*.mo"`
228 if [ -z "$files" ]; then
230 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../gtk2_ardour"
237 lang=`basename $file | sed 's/\.mo//'`
238 mkdir -p $Locale/$lang/LC_MESSAGES
239 cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo
240 LINGUAS="$LINGUAS $lang"
243 files=`find ../../libs/ardour/ -name "*.mo"`
245 if [ -z "$files" ]; then
247 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../libs/ardour"
254 lang=`basename $file | sed 's/\.mo//'`
255 mkdir -p $Locale/$lang/LC_MESSAGES
256 cp $file $Locale/$lang/LC_MESSAGES/libardour.mo
259 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
260 LOCALEROOT=/usr/share/locale
262 for l in $LINGUAS ; do
263 echo "Copying GTK i18n files for $l..."
264 for MO in $GTK_MESSAGES ; do
265 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
266 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
268 # try with just the language spec
269 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
270 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
271 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
277 echo "Skipping NLS support"
281 GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
282 if [ ! -z "$GTKROOT" ]; then
283 echo "Found GTKROOT using pkg-config"
284 elif [ -d /usr/lib/gtk-2.0 ]; then
286 elif [ -d /usr/local/lib/gtk-2.0 ]; then
287 GTKROOT="/usr/local/lib"
290 echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit"
295 echo "GTKROOT is ${GTKROOT}"
296 versionDir=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
299 for name in $versionDir ; do
303 if [ $num -eq 1 ]; then
304 GTKLIB=${GTKROOT}/gtk-2.0/$versionDir
305 echo "GTKLIB is ${GTKLIB}"
308 echo "!!! ERROR !!! - More than one gtk-2.0 version found in ${GTKROOT}/gtk-2.0/ ( $versionDir ). Packager will exit"
315 PANGOROOT=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g"`
316 if [ ! -z "$PANGOROOT" ]; then
317 echo "Found PANGOROOT using pkg-config"
318 elif [ -d /usr/lib/pango ]; then
320 elif [ -d /usr/local/lib/pango ]; then
321 PANGOROOT="/usr/local/lib"
324 echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit"
329 echo "PANGOROOT is ${PANGOROOT}"
330 versionDir=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
333 for name in $versionDir ; do
337 if [ $num -eq 1 ]; then
338 PANGOLIB=${PANGOROOT}/pango/$versionDir
339 echo "PANGOLIB is ${PANGOLIB}"
342 echo "!!! ERROR !!! - More than one pango version found in ${PANGOROOT}/pango/ ( $versionDir ). Packager will exit"
348 ### Find gdk-pixbuf ###
349 GDKPIXBUFROOT=`pkg-config --libs-only-L gdk-pixbuf-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
350 if [ ! -z "$GDKPIXBUFROOT" ]; then
351 echo "Found GDKPIXBUFROOT using pkg-config"
352 elif [ -d /usr/lib/gdk-pixbuf-2.0 ]; then
353 GDKPIXBUFROOT="/usr/lib/gdk-pixbuf-2.0"
354 elif [ -d /usr/local/lib/gdk-pixbuf-2.0 ]; then
355 GDKPIXBUFROOT="/usr/local/lib/gdk-pixbuf-2.0"
356 elif [ -d ${GTKLIB}/loaders ]; then #odd ball case
357 GDKPIXBUFROOT=${GTKROOT}
358 GDKPIXBUFLIB=${GTKLIB}
361 echo "!!! ERROR !!! - Unable to locate gdk-pixbuf-2.0 directory. Packager will exit"
366 echo "GDKPIXBUFROOT is ${GDKPIXBUFROOT}"
368 if [ -z ${GDKPIXBUFLIB} ]; then
369 versionDir=`ls ${GDKPIXBUFROOT}/gdk-pixbuf-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
372 for name in $versionDir ; do
376 if [ $num -eq 1 ]; then
377 GDKPIXBUFLIB=${GDKPIXBUFROOT}/gdk-pixbuf-2.0/$versionDir
378 echo "GDKPIXBUFLIB is ${GDKPIXBUFLIB}"
381 echo "!!! ERROR !!! - More than one gdk-pixbuf-2.0 version found in ${GDKPIXBUFROOT}/pango/ ( $versionDir ). Packager will exit"
389 echo "Copying all Pango modules ..."
390 cp -R $PANGOLIB/modules/*.so $Modules
392 echo "Copying all GDK Pixbuf loaders ..."
393 cp -R $GDKPIXBUFLIB/loaders/*.so $Loaders
395 pango-querymodules | sed "s?$PANGOLIB/?@ROOTDIR@/?" > $Etc/pango.modules.in
396 gdk-pixbuf-query-loaders | sed "s?$GDKPIXBUFLIB/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
398 # We sort of rely on clearlooks, so include a version
399 # this one is special - we will set GTK_PATH to $Libraries/clearlooks
401 if [ ! -e ${GTKLIB}/engines/libclearlooks.so ]; then
403 echo "!!! ERROR !!! - not able to locate libclearlooks.so"
405 echo "Packager with exit"
409 echo "Copying clearlooks ..."
410 cp ${GTKLIB}/engines/libclearlooks.so $Libraries
411 mkdir -p $Libraries/clearlooks/engines
412 (cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks* libclearlooks.so )
415 if test x$WITH_LADSPA != x ; then
416 if test x$MIXBUS != x ; then
417 plugdir=mixbus_ladspa
421 echo "Copying `ls $plugdir | wc -l` plugins ..."
422 if [ -d $plugdir ] ; then
423 cp -r $plugdir/* $Plugins
428 cp $BUILD_ROOT/libs/surfaces/*/libardour*.so* $Surfaces
429 # hack ... move libardour_cp back into Libraries
430 mv $Surfaces/libardourcp.so* $Libraries
433 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
435 # VAMP plugins that we use
436 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
438 OURLIBDIR=$BUILD_ROOT/libs
439 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
441 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
447 filelist=`find $APPLIB/ -type f`
448 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
450 for file in $filelist ; do
451 if ! file $file | grep -qs ELF ; then
455 # speed this up a bit by not checking things multiple times.
456 for i in "${depCheckedList[@]}"; do
457 if [ $i == $file ]; then
461 depCheckedList[$checkIdx]=$file
462 checkIdx=$(($checkIdx + 1))
464 # do not include libjack
465 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
467 # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.'
469 for dep in $deps ; do
470 if test "not" = ${dep}; then
472 echo "!!! ERROR !!! - Missing dependant library for $file."
474 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
476 echo "!!! ERROR !!! - See Above"
480 # don't use anything mapped at a specific address
481 if echo $dep | grep -qs '0x' ; then continue; fi
483 if echo $dep | grep -qs "^/lib/" ; then continue; fi
485 if echo $dep | grep -qs libjack ; then continue; fi
486 # don't include any X Window libraries
487 if echo $dep | grep -qs libX ; then continue; fi
488 if echo $dep | grep -qs libxcb ; then continue; fi
490 if echo $dep | grep -qs 'libc\.' ; then continue; fi
491 # don't include libstdc++
492 if echo $dep | grep -qs libstdc++ ; 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})"
508 if test x$missing = xfalse ; then
509 # everything has been found
516 if test x$STRIP != x ; then
517 echo Stripping libraries
518 find $APPLIB/ -name "*.so*" | xargs strip
520 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
522 echo "Copying other stuff to $APPDIR ..."
524 # these are all generated by waf
525 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Etc
526 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
527 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
528 cp $BUILD_ROOT/ardour_system.rc $Etc/ardour_system.rc
529 cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_light.rc $Etc
530 cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_dark.rc $Etc
532 # these are copied straight from the source tree
534 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui.conf
535 cp ../../instant.xml $Etc/instant.xml
536 cp -r ../../gtk2_ardour/icons $Etc
537 cp -r ../../gtk2_ardour/pixmaps $Etc
540 # put sooper sekrit ingredients here and they will be copied
543 if [ -d specialSauce ] ; then
544 cp -r specialSauce $Etc
549 cp -R ../../gtk2_ardour/splash.png $Shared
550 # currently no templates
551 #cp ../../templates/*.template $Shared/templates/
553 # go through and recursively remove any .svn dirs in the bundle
554 for svndir in `find $APPDIR -name .svn -type d`; do
559 # Add the uninstaller
561 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
562 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
565 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
566 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
568 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
572 echo "Building tarball ..."
574 rm -f $APPDIR.tar.bz2
575 tar -cjf $APPDIR.tar.bz2 $APPDIR