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
55 --test) INTERNAL_JACK=; WITH_LADSPA=; STRIP= ; shift ;;
58 # specific build flags
61 --nojack) INTERNAL_JACK= ; shift ;;
62 --noladspa) WITH_LADSPA= ; shift ;;
63 --nostrip) STRIP= ; shift ;;
64 --sysdeps) PRINT_SYSDEPS=1; shift ;;
65 --nls) WITH_NLS=1 ; shift ;;
66 --external_jack) EXTERNAL_JACK=$2; shift ; shift ;;
69 #catch all for unknown arguments
71 echo "!!! ERROR !!! - Unknown argument $1"
78 if [ x$EXTERNAL_JACK != x -a x$INTERNAL_JACK != x ] ; then
79 echo "It makes no sense to package JACK internally and externally. Please pick one."
82 release_version=`grep -m 1 '^VERSION' ../../wscript | awk '{print $3}' | sed "s/'//g"`
83 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d"'" -f 2`
84 echo "Version is $release_version / $svn_version"
85 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
86 echo "Info string is $info_string"
88 # Figure out our CPU type
90 i[3456789]86|x86|i86pc)
91 echo "Architecture is x86"
96 echo "Architecture is x86_64"
102 echo "ERROR - Unknown architecture `uname -m`"
108 # the waf build tree to use when copying built/generated files
110 BUILD_ROOT=../../build/default
112 # setup directory structure
114 APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}
120 Plugins=$APPLIB/plugins
121 Surfaces=$APPLIB/surfaces
122 Panners=$APPLIB/panners
123 Locale=$Shared/locale
124 Modules=$Libraries/modules
125 Loaders=$Libraries/loaders
128 if [ x$PRINT_SYSDEPS != x ] ; then
130 # print system dependencies
133 for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do
134 if ! file $file | grep -qs Mach-O ; then
137 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
142 echo "Removing old $APPDIR tree ..."
145 echo "Building new app directory structure ..."
147 # only bother to make the longest paths
160 mkdir -p $Shared/templates
162 # maybe set variables
163 ENVIRONMENT=environment
167 if test x$MIXBUS != x ; then
168 echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
170 # current default for MIXBUS version is US keyboard layout without a keypad
172 echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
173 echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
174 echo export ARDOUR3_UI_RC=ardour3_ui_dark.rc >> $ENVIRONMENT
178 # if we're not going to bundle JACK, make sure we can find
179 # jack in the places where it might be
182 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
184 # create startup helper script
186 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour3
187 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour3
188 #MAIN_EXECUTABLE=ardour-$release_version
189 MAIN_EXECUTABLE=ardour-3.0
191 echo "Copying ardour executable ...."
192 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
193 if test x$STRIP != x ; then
194 strip $APPBIN/$MAIN_EXECUTABLE
198 if test x$WITH_NLS != x ; then
199 echo "NLS support ..."
200 echo "I hope you remembered to run scons msgupdate!"
202 files=`find $BUILD_ROOT/gtk2_ardour/ -name "*.mo"`
204 if [ -z "$files" ]; then
206 echo "!!!! WARNING !!!! - Did not find any .mo files in $BUILD_ROOT/gtk2_ardour"
213 lang=`basename $file | sed 's/\.mo//'`
214 mkdir -p $Locale/$lang/LC_MESSAGES
215 cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo
216 LINGUAS="$LINGUAS $lang"
219 files=`find ../../libs/ardour/ -name "*.mo"`
221 if [ -z "$files" ]; then
223 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../libs/ardour"
230 lang=`basename $file | sed 's/\.mo//'`
231 mkdir -p $Locale/$lang/LC_MESSAGES
232 cp $file $Locale/$lang/LC_MESSAGES/libardour.mo
235 GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
236 LOCALEROOT=/usr/share/locale
238 for l in $LINGUAS ; do
239 echo "Copying GTK i18n files for $l..."
240 for MO in $GTK_MESSAGES ; do
241 if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
242 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
244 # try with just the language spec
245 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
246 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
247 cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
253 echo "Skipping NLS support"
257 GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
258 if [ ! -z "$GTKROOT" ]; then
259 echo "Found GTKROOT using pkg-config"
260 elif [ -d /usr/lib/gtk-2.0 ]; then
261 GTKROOT="/usr/lib/gtk-2.0"
262 elif [ -d /usr/local/lib/gtk-2.0 ]; then
263 GTKROOT="/usr/local/lib/gtk-2.0"
266 echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit"
271 echo "GTKROOT is ${GTKROOT}"
272 versionDir=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
275 for name in $versionDir ; do
279 if [ $num -eq 1 ]; then
280 GTKLIB=${GTKROOT}/gtk-2.0/$versionDir
281 echo "GTKLIB is ${GTKLIB}"
284 echo "!!! ERROR !!! - More than one gtk-2.0 version found in ${GTKROOT}/gtk-2.0/ ( $versionDir ). Packager will exit"
291 PANGOROOT=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g"`
292 if [ ! -z "$PANGOROOT" ]; then
293 echo "Found PANGOROOT using pkg-config"
294 elif [ -d /usr/lib/pango ]; then
295 PANGOROOT="/usr/lib/pango"
296 elif [ -d /usr/local/lib/pango ]; then
297 PANGOROOT="/usr/local/lib/pango"
300 echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit"
305 echo "PANGOROOT is ${PANGOROOT}"
306 versionDir=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
309 for name in $versionDir ; do
313 if [ $num -eq 1 ]; then
314 PANGOLIB=${PANGOROOT}/pango/$versionDir
315 echo "PANGOLIB is ${PANGOLIB}"
318 echo "!!! ERROR !!! - More than one pango version found in ${PANGOROOT}/pango/ ( $versionDir ). Packager will exit"
324 ### Find gdk-pixbuf ###
325 GDKPIXBUFROOT=`pkg-config --libs-only-L gdk-pixbuf-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
326 if [ ! -z "$GDKPIXBUFROOT" ]; then
327 echo "Found GDKPIXBUFROOT using pkg-config"
328 elif [ -d /usr/lib/gdk-pixbuf-2.0 ]; then
329 GDKPIXBUFROOT="/usr/lib/gdk-pixbuf-2.0"
330 elif [ -d /usr/local/lib/gdk-pixbuf-2.0 ]; then
331 GDKPIXBUFROOT="/usr/local/lib/gdk-pixbuf-2.0"
332 elif [ -d ${GTKLIB}/loaders ]; then #odd ball case
333 GDKPIXBUFROOT=${GTKROOT}
334 GDKPIXBUFLIB=${GTKLIB}
337 echo "!!! ERROR !!! - Unable to locate gdk-pixbuf-2.0 directory. Packager will exit"
342 echo "GDKPIXBUFROOT is ${GDKPIXBUFROOT}"
344 if [ -z ${GDKPIXBUFLIB} ]; then
345 versionDir=`ls ${GDKPIXBUFROOT}/gdk-pixbuf-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
348 for name in $versionDir ; do
352 if [ $num -eq 1 ]; then
353 GDKPIXBUFLIB=${GDKPIXBUFROOT}/gdk-pixbuf-2.0/$versionDir
354 echo "GDKPIXBUFLIB is ${GDKPIXBUFLIB}"
357 echo "!!! ERROR !!! - More than one gdk-pixbuf-2.0 version found in ${GDKPIXBUFROOT}/pango/ ( $versionDir ). Packager will exit"
365 echo "Copying all Pango modules ..."
366 cp -R $PANGOLIB/modules/*.so $Modules
368 echo "Copying all GDK Pixbuf loaders ..."
369 cp -R $GDKPIXBUFLIB/loaders/*.so $Loaders
371 pango-querymodules | sed "s?$PANGOLIB/?@ROOTDIR@/?" > $Etc/pango.modules.in
372 gdk-pixbuf-query-loaders | sed "s?$GDKPIXBUFLIB/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
374 # We sort of rely on clearlooks, so include a version
375 # this one is special - we will set GTK_PATH to $Libraries/clearlooks
377 #if [ ! -e ${GTKLIB}/engines/libclearlooks.so ]; then
379 # echo "!!! ERROR !!! - not able to locate libclearlooks.so"
381 # echo "Packager with exit"
385 #echo "Copying clearlooks ..."
386 #cp ${GTKLIB}/engines/libclearlooks.so $Libraries
387 #mkdir -p $Libraries/clearlooks/engines
388 #(cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks* libclearlooks.so )
391 if test x$WITH_LADSPA != x ; then
392 if test x$MIXBUS != x ; then
393 plugdir=mixbus_ladspa
397 echo "Copying `ls $plugdir | wc -l` plugins ..."
398 if [ -d $plugdir ] ; then
399 cp -r $plugdir/* $Plugins
404 cp $BUILD_ROOT/libs/surfaces/*/libardour*.so* $Surfaces
405 # hack ... move libardour_cp back into Libraries
406 mv $Surfaces/libardourcp.so* $Libraries
409 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
411 # VAMP plugins that we use
412 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
414 OURLIBDIR=$BUILD_ROOT/libs
415 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
417 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
423 filelist=`find $APPLIB/ -type f`
424 filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
426 for file in $filelist ; do
427 if ! file $file | grep -qs ELF ; then
431 # speed this up a bit by not checking things multiple times.
432 for i in "${depCheckedList[@]}"; do
433 if [ $i == $file ]; then
437 depCheckedList[$checkIdx]=$file
438 checkIdx=$(($checkIdx + 1))
440 # do not include libjack
441 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
443 # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.'
445 for dep in $deps ; do
446 if test "not" = ${dep}; then
448 echo "!!! ERROR !!! - Missing dependant library for $file."
450 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
452 echo "!!! ERROR !!! - See Above"
456 # don't use anything mapped at a specific address
457 if echo $dep | grep -qs '0x' ; then continue; fi
459 if echo $dep | grep -qs "^/lib/" ; then continue; fi
461 if echo $dep | grep -qs libjack ; then continue; fi
462 # don't include any X Window libraries
463 if echo $dep | grep -qs libX ; then continue; fi
464 if echo $dep | grep -qs libxcb ; then continue; fi
466 if echo $dep | grep -qs 'libc\.' ; then continue; fi
467 # don't include libstdc++
468 if echo $dep | grep -qs libstdc++ ; then continue; fi
471 if ! test -f $Libraries/$base; then
472 parent=$(basename ${file})
473 if echo $dep | grep -sq '^libs' ; then
474 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
475 cp $BUILD_ROOT/$dep $Libraries
477 echo "Copying dependant lib $dep (required by ${parent})"
484 if test x$missing = xfalse ; then
485 # everything has been found
492 echo Stripping libraries
493 find $APPLIB/ -name "*.so*" | xargs strip
494 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
496 echo "Copying other stuff to $APPDIR ..."
498 # these are all generated by waf
499 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Etc
500 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Etc
501 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
502 cp $BUILD_ROOT/ardour_system.rc $Etc/ardour_system.rc
503 # temporarily unavailable
504 #cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_light.rc $Etc
505 cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_dark.rc $Etc
507 # these are copied straight from the source tree
509 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui.conf
510 cp ../../instant.xml $Etc/instant.xml
511 cp -r ../../gtk2_ardour/icons $Etc
512 cp -r ../../gtk2_ardour/pixmaps $Etc
515 # put sooper sekrit ingredients here and they will be copied
518 if [ -d specialSauce ] ; then
519 cp -r specialSauce $Etc
524 cp -R ../../gtk2_ardour/splash.png $Shared
525 # currently no templates
526 #cp ../../templates/*.template $Shared/templates/
528 # go through and recursively remove any .svn dirs in the bundle
529 for svndir in `find $APPDIR -name .svn -type d`; do
534 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
535 cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPDIR
537 echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
542 # and now ... the final package
545 if [ x$MIXBUS != x ] ; then
549 echo "Creating Mixbus packaging directory"
550 cp MixBus_Install_QuickStart.pdf "$APPDIR/Mixbus Install & Quick Start Guide.pdf"
552 if [ -x $EXTERNAL_JACK != x ] ; then
553 cp $EXTERNAL_JACK $PRODUCT_PKG_DIR
557 echo "Building tarball ..."
559 rm -f $APPDIR.tar.bz2
560 tar -cjf $APPDIR.tar.bz2 $APPDIR