7 # script for pulling together a Linux app bundle.
18 if [ $# -eq 0 ] ; then
20 echo "ERROR - Please specify build type"
27 while [ $# -gt 0 ] ; do
32 # top level build targets
67 --test) SAE= ; INTERNAL_JACK=; WITH_LADSPA=; STRIP= ; shift ;;
70 # specific build flags
73 --nojack) INTERNAL_JACK= ; shift ;;
74 --noladspa) WITH_LADSPA= ; shift ;;
75 --nostrip) STRIP= ; shift ;;
76 --sysdeps) PRINT_SYSDEPS=1; shift ;;
77 --nls) WITH_NLS=1 ; shift ;;
78 --external_jack) EXTERNAL_JACK=$2; shift ; shift ;;
81 #catch all for unknown arguments
83 echo "!!! ERROR !!! - Unknown argument $1"
90 if [ x$EXTERNAL_JACK != x -a x$INTERNAL_JACK != x ] ; then
91 echo "It makes no sense to package JACK internally and externally. Please pick one."
94 release_version=`grep -m 1 '^ardour_version' ../../SConstruct | cut -d' ' -f 3 | sed "s/'//g"`
95 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d' ' -f 6 | sed 's/[";]//g'`
96 echo "Version is $release_version / $svn_version"
97 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
98 echo "Info string is $info_string"
100 # Figure out our CPU type
102 i[3456789]86|x86|i86pc)
103 echo "Architecture is x86"
108 echo "Architecture is x86_64"
114 echo "ERROR - Unknown architecture `uname -m`"
120 # setup directory structure
122 APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}
128 Plugins=$APPLIB/plugins
129 Surfaces=$APPLIB/surfaces
130 Panners=$APPLIB/panners
131 Locale=$Shared/locale
132 Modules=$Libraries/modules
133 Loaders=$Libraries/loaders
136 if [ x$PRINT_SYSDEPS != x ] ; then
138 # print system dependencies
141 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
142 if ! file $file | grep -qs Mach-O ; then
145 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
150 echo "Removing old $APPDIR tree ..."
153 echo "Building new app directory structure ..."
155 # only bother to make the longest paths
168 mkdir -p $Shared/templates
170 # maybe set variables
171 ENVIRONMENT=environment
175 if test x$SAE != x ; then
176 echo "export ARDOUR_SAE=true" >> $ENVIRONMENT
178 # current default for SAE version is German keyboard layout without a keypad
180 echo export ARDOUR_KEYBOARD_LAYOUT=de-nokeypad >> $ENVIRONMENT
181 echo export ARDOUR_UI_CONF=ardour2_ui_sae.conf >> $ENVIRONMENT
182 echo export ARDOUR2_UI_RC=ardour2_ui_dark_sae.rc >> $ENVIRONMENT
183 elif test x$MIXBUS != x ; then
184 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
186 # current default for MIXBUS version is US keyboard layout without a keypad
188 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
189 echo export ARDOUR_UI_CONF=ardour2_ui.conf >> $ENVIRONMENT
190 echo export ARDOUR2_UI_RC=ardour2_ui_dark.rc >> $ENVIRONMENT
194 # if we're not going to bundle JACK, make sure we can find
195 # jack in the places where it might be
198 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
200 # create startup helper script
202 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour2
203 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour2
204 MAIN_EXECUTABLE=ardour-$release_version
206 echo "Copying ardour executable ...."
207 cp ../../gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
208 if test x$STRIP != x ; then
209 strip $APPBIN/$MAIN_EXECUTABLE
213 if test x$WITH_NLS != x ; then
214 echo "NLS support ..."
215 echo "I hope you remembered to run scons msgupdate!"
217 files=`find ../../gtk2_ardour/ -name "*.mo"`
219 if [ -z "$files" ]; then
221 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../gtk2_ardour"
228 lang=`basename $file | sed 's/\.mo//'`
229 mkdir -p $Locale/$lang/LC_MESSAGES
230 cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo
231 LINGUAS="$LINGUAS $lang"
234 files=`find ../../libs/ardour/ -name "*.mo"`
236 if [ -z "$files" ]; then
238 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../libs/ardour"
245 lang=`basename $file | sed 's/\.mo//'`
246 mkdir -p $Locale/$lang/LC_MESSAGES
247 cp $file $Locale/$lang/LC_MESSAGES/libardour.mo
250 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
251 LOCALEROOT=/usr/share/locale
253 for l in $LINGUAS ; do
254 echo "Copying GTK i18n files for $l..."
255 for MO in $GTK_MESSAGES ; do
256 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
257 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
259 # try with just the language spec
260 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
261 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
262 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
268 echo "Skipping NLS support"
272 GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
273 if [ ! -z "$GTKROOT" ]; then
274 echo "Found GTKROOT using pkg-config"
275 elif [ -d /usr/lib/gtk-2.0 ]; then
276 GTKROOT="/usr/lib/gtk-2.0"
277 elif [ -d /usr/local/lib/gtk-2.0 ]; then
278 GTKROOT="/usr/local/lib/gtk-2.0"
281 echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit"
286 echo "GTKROOT is ${GTKROOT}"
287 versionDir=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
290 for name in $versionDir ; do
294 if [ $num -eq 1 ]; then
295 GTKLIB=${GTKROOT}/gtk-2.0/$versionDir
296 echo "GTKLIB is ${GTKLIB}"
299 echo "!!! ERROR !!! - More than one gtk-2.0 version found in ${GTKROOT}/gtk-2.0/ ( $versionDir ). Packager will exit"
306 PANGOROOT=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g"`
307 if [ ! -z "$PANGOROOT" ]; then
308 echo "Found PANGOROOT using pkg-config"
309 elif [ -d /usr/lib/pango ]; then
310 PANGOROOT="/usr/lib/pango"
311 elif [ -d /usr/local/lib/pango ]; then
312 PANGOROOT="/usr/local/lib/pango"
315 echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit"
320 echo "PANGOROOT is ${PANGOROOT}"
321 versionDir=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
324 for name in $versionDir ; do
328 if [ $num -eq 1 ]; then
329 PANGOLIB=${PANGOROOT}/pango/$versionDir
330 echo "PANGOLIB is ${PANGOLIB}"
333 echo "!!! ERROR !!! - More than one pango version found in ${PANGOROOT}/pango/ ( $versionDir ). Packager will exit"
339 ### Find gdk-pixbuf ###
340 GDKPIXBUFROOT=`pkg-config --libs-only-L gdk-pixbuf-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
341 if [ ! -z "$GDKPIXBUFROOT" ]; then
342 echo "Found GDKPIXBUFROOT using pkg-config"
343 elif [ -d /usr/lib/gdk-pixbuf-2.0 ]; then
344 GDKPIXBUFROOT="/usr/lib/gdk-pixbuf-2.0"
345 elif [ -d /usr/local/lib/gdk-pixbuf-2.0 ]; then
346 GDKPIXBUFROOT="/usr/local/lib/gdk-pixbuf-2.0"
347 elif [ -d ${GTKLIB}/loaders ]; then #odd ball case
348 GDKPIXBUFROOT=${GTKROOT}
349 GDKPIXBUFLIB=${GTKLIB}
352 echo "!!! ERROR !!! - Unable to locate gdk-pixbuf-2.0 directory. Packager will exit"
357 echo "GDKPIXBUFROOT is ${GDKPIXBUFROOT}"
359 if [ -z ${GDKPIXBUFLIB} ]; then
360 versionDir=`ls ${GDKPIXBUFROOT}/gdk-pixbuf-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
363 for name in $versionDir ; do
367 if [ $num -eq 1 ]; then
368 GDKPIXBUFLIB=${GDKPIXBUFROOT}/gdk-pixbuf-2.0/$versionDir
369 echo "GDKPIXBUFLIB is ${GDKPIXBUFLIB}"
372 echo "!!! ERROR !!! - More than one gdk-pixbuf-2.0 version found in ${GDKPIXBUFROOT}/pango/ ( $versionDir ). Packager will exit"
380 echo "Copying all Pango modules ..."
381 cp -R $PANGOLIB/modules/*.so $Modules
383 echo "Copying all GDK Pixbuf loaders ..."
384 cp -R $GDKPIXBUFLIB/loaders/*.so $Loaders
386 pango-querymodules | sed "s?$PANGOLIB/?@ROOTDIR@/?" > $Etc/pango.modules.in
387 gdk-pixbuf-query-loaders | sed "s?$GDKPIXBUFLIB/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
389 # We sort of rely on clearlooks, so include a version
390 # this one is special - we will set GTK_PATH to $Libraries/clearlooks
392 if [ ! -e ${GTKLIB}/engines/libclearlooks.so ]; then
394 echo "!!! ERROR !!! - not able to locate libclearlooks.so"
396 echo "Packager with exit"
400 echo "Copying clearlooks ..."
401 cp ${GTKLIB}/engines/libclearlooks.so $Libraries
402 mkdir -p $Libraries/clearlooks/engines
403 (cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks* libclearlooks.so )
406 if test x$WITH_LADSPA != x ; then
407 if test x$SAE != x ; then
409 elif test x$MIXBUS != x ; then
410 plugdir=mixbus_ladspa
414 echo "Copying `ls $plugdir | wc -l` plugins ..."
415 if [ -d $plugdir ] ; then
416 cp -r $plugdir/* $Plugins
420 # XXX STILL NEED TO DO PANNERS FOR TRUNK
421 cp ../../libs/surfaces/*/libardour_*.so* $Surfaces
422 # hack ... move libardour_cp back into Libraries
423 mv $Surfaces/libardour_cp.so* $Libraries
425 # VAMP plugins that we use
426 cp ../../libs/vamp-plugins/libardourvampplugins.so* $Libraries
429 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
431 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
437 filelist=`find $APPLIB/ -type f`
438 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
440 for file in $filelist ; do
441 if ! file $file | grep -qs ELF ; then
445 # speed this up a bit by not checking things multiple times.
446 for i in "${depCheckedList[@]}"; do
447 if [ $i == $file ]; then
451 depCheckedList[$checkIdx]=$file
454 # do not include libjack
455 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
457 # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.'
459 for dep in $deps ; do
460 if test "not" = ${dep}; then
462 echo "!!! ERROR !!! - Missing dependant library for $file."
464 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
466 echo "!!! ERROR !!! - See Above"
470 # don't use anything mapped at a specific address
471 if echo $dep | grep -qs '0x' ; then continue; fi
473 if echo $dep | grep -qs "^/lib/" ; then continue; fi
475 if echo $dep | grep -qs libjack ; then continue; fi
476 # don't include any X Window libraries
477 if echo $dep | grep -qs libX ; then continue; fi
478 if echo $dep | grep -qs libxcb ; then continue; fi
480 if echo $dep | grep -qs 'libc\.' ; then continue; fi
481 # don't include libstdc++
482 if echo $dep | grep -qs libstdc++ ; 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 ../../$dep (required by ${parent})"
489 cp ../../$dep $Libraries
491 echo "Copying dependant lib $dep (required by ${parent})"
498 if test x$missing = xfalse ; then
499 # everything has been found
506 echo Stripping libraries
507 find $APPLIB/ -name "*.so*" | xargs strip
508 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
510 echo "Copying other stuff to $APPDIR ..."
512 cp ../../gtk2_ardour/ergonomic-us.bindings $Etc
513 cp ../../gtk2_ardour/mnemonic-us.bindings $Etc
514 cp ../../gtk2_ardour/SAE-de-keypad.bindings $Etc
515 cp ../../gtk2_ardour/SAE-de-nokeypad.bindings $Etc
516 cp ../../gtk2_ardour/SAE-us-keypad.bindings $Etc
517 cp ../../gtk2_ardour/SAE-us-nokeypad.bindings $Etc
518 cp ../../gtk2_ardour/ardour.menus $Etc
519 cp ../../gtk2_ardour/ardour-sae.menus $Etc
520 if test x$SAE != x ; then
521 cp ../../ardour_system_sae.rc $Etc/ardour_system.rc
522 echo cp ../../ardour_system_sae.rc $Etc/ardour_system.rc
523 cp ../../instant.xml.sae $Etc/instant.xml
524 echo cp ../../instant.xml.sae $Etc/instant.xml
526 cp ../../ardour_system.rc $Etc/ardour_system.rc
527 echo cp ../../ardour_system.rc $Etc/ardour_system.rc
528 cp ../../instant.xml $Etc/instant.xml
529 echo cp ../../instant.xml $Etc/instant.xml
531 cp ../../gtk2_ardour/ardour2_ui_sae.conf $Etc
532 cp ../../gtk2_ardour/ardour2_ui_default.conf $Etc
533 cp ../../gtk2_ardour/ardour2_ui_default.conf $Etc/ardour2_ui.conf
534 cp ../../gtk2_ardour/ardour2_ui_light.rc $Etc
535 cp ../../gtk2_ardour/ardour2_ui_dark.rc $Etc
536 cp ../../gtk2_ardour/ardour2_ui_light_sae.rc $Etc
537 cp ../../gtk2_ardour/ardour2_ui_dark_sae.rc $Etc
539 cp -r ../../gtk2_ardour/icons $Etc
540 cp -r ../../gtk2_ardour/pixmaps $Etc
543 # put sooper sekrit ingredients here and they will be copied
546 if [ -d specialSauce ] ; then
547 cp -r specialSauce $Etc
552 cp -R ../../gtk2_ardour/splash.png $Shared
553 cp ../../templates/*.template $Shared/templates/
555 # go through and recursively remove any .svn dirs in the bundle
556 for svndir in `find $APPDIR -name .svn -type d`; do
561 if [ -e ../sanity_check/sanityCheck ]; then
562 cp ../sanity_check/sanityCheck $APPDIR
564 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
569 # and now ... the final package
572 if [ x$SAE != x ] ; then
576 echo "Creating SAE packaging directory"
577 cp HowToInstallArdourSAE.pdf "$APPDIR/How To Install Ardour SAE.pdf"
578 cp SAE-de-keypad.pdf "$APPDIR/Ardour SAE Shortcuts (keypad).pdf"
579 cp SAE-de-nokeypad.pdf "$APPDIR/Ardour SAE Shortcuts.pdf"
581 elif [ x$MIXBUS != x ] ; then
585 echo "Creating Mixbus packaging directory"
586 cp MixBus_Install_QuickStart.pdf "$APPDIR/Mixbus Install & Quick Start Guide.pdf"
588 if [ -x $EXTERNAL_JACK != x ] ; then
589 cp $EXTERNAL_JACK $PRODUCT_PKG_DIR
593 echo "Building tarball ..."
595 rm -f $APPDIR.tar.bz2
596 tar -cjf $APPDIR.tar.bz2 $APPDIR