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 # note that at present(feb 2011), the .mo files end up in the source tree which is
199 # not really as it should be.
200 if test x
$WITH_NLS != x
; then
201 echo "NLS support ..."
202 echo "I hope you remembered to run scons msgupdate!"
204 files
=`find ../../gtk2_ardour/ -name "*.mo"`
206 if [ -z "$files" ]; then
208 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../gtk2_ardour"
215 lang
=`basename $file | sed 's/\.mo//'`
216 mkdir
-p $Locale/$lang/LC_MESSAGES
217 cp $file $Locale/$lang/LC_MESSAGES
/gtk2_ardour.mo
218 LINGUAS
="$LINGUAS $lang"
221 files
=`find ../../libs/ardour/ -name "*.mo"`
223 if [ -z "$files" ]; then
225 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../libs/ardour"
232 lang
=`basename $file | sed 's/\.mo//'`
233 mkdir
-p $Locale/$lang/LC_MESSAGES
234 cp $file $Locale/$lang/LC_MESSAGES
/libardour.mo
237 GTK_MESSAGES
="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
238 LOCALEROOT
=/usr
/share
/locale
240 for l
in $LINGUAS ; do
241 echo "Copying GTK i18n files for $l..."
242 for MO
in $GTK_MESSAGES ; do
243 if [ -f $LOCALEROOT/$l/LC_MESSAGES
/$MO ] ; then
244 cp $LOCALEROOT/$l/LC_MESSAGES
/$MO $Locale/$l/LC_MESSAGES
246 # try with just the language spec
247 just_lang
=`echo $l | sed 's/_[A-Z][A-Z]$//'`
248 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES
/$MO ] ; then
249 cp $LOCALEROOT/$just_lang/LC_MESSAGES
/$MO $Locale/$just_lang/LC_MESSAGES
255 echo "Skipping NLS support"
259 GTKROOT
=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
260 if [ ! -z "$GTKROOT" ]; then
261 echo "Found GTKROOT using pkg-config"
262 elif [ -d /usr
/lib
/gtk-2.0
]; then
263 GTKROOT
="/usr/lib/gtk-2.0"
264 elif [ -d /usr
/local
/lib
/gtk-2.0
]; then
265 GTKROOT
="/usr/local/lib/gtk-2.0"
268 echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit"
273 echo "GTKROOT is ${GTKROOT}"
274 versionDir
=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
277 for name
in $versionDir ; do
281 if [ $num -eq 1 ]; then
282 GTKLIB
=${GTKROOT}/gtk-2.0
/$versionDir
283 echo "GTKLIB is ${GTKLIB}"
286 echo "!!! ERROR !!! - More than one gtk-2.0 version found in ${GTKROOT}/gtk-2.0/ ( $versionDir ). Packager will exit"
293 PANGOROOT
=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g"`
294 if [ ! -z "$PANGOROOT" ]; then
295 echo "Found PANGOROOT using pkg-config"
296 elif [ -d /usr
/lib
/pango
]; then
297 PANGOROOT
="/usr/lib/pango"
298 elif [ -d /usr
/local
/lib
/pango
]; then
299 PANGOROOT
="/usr/local/lib/pango"
302 echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit"
307 echo "PANGOROOT is ${PANGOROOT}"
308 versionDir
=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
311 for name
in $versionDir ; do
315 if [ $num -eq 1 ]; then
316 PANGOLIB
=${PANGOROOT}/pango
/$versionDir
317 echo "PANGOLIB is ${PANGOLIB}"
320 echo "!!! ERROR !!! - More than one pango version found in ${PANGOROOT}/pango/ ( $versionDir ). Packager will exit"
326 ### Find gdk-pixbuf ###
327 GDKPIXBUFROOT
=`pkg-config --libs-only-L gdk-pixbuf-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
328 if [ ! -z "$GDKPIXBUFROOT" ]; then
329 echo "Found GDKPIXBUFROOT using pkg-config"
330 elif [ -d /usr
/lib
/gdk-pixbuf-2.0
]; then
331 GDKPIXBUFROOT
="/usr/lib/gdk-pixbuf-2.0"
332 elif [ -d /usr
/local
/lib
/gdk-pixbuf-2.0
]; then
333 GDKPIXBUFROOT
="/usr/local/lib/gdk-pixbuf-2.0"
334 elif [ -d ${GTKLIB}/loaders
]; then #odd ball case
335 GDKPIXBUFROOT
=${GTKROOT}
336 GDKPIXBUFLIB
=${GTKLIB}
339 echo "!!! ERROR !!! - Unable to locate gdk-pixbuf-2.0 directory. Packager will exit"
344 echo "GDKPIXBUFROOT is ${GDKPIXBUFROOT}"
346 if [ -z ${GDKPIXBUFLIB} ]; then
347 versionDir
=`ls ${GDKPIXBUFROOT}/gdk-pixbuf-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
350 for name
in $versionDir ; do
354 if [ $num -eq 1 ]; then
355 GDKPIXBUFLIB
=${GDKPIXBUFROOT}/gdk-pixbuf-2.0
/$versionDir
356 echo "GDKPIXBUFLIB is ${GDKPIXBUFLIB}"
359 echo "!!! ERROR !!! - More than one gdk-pixbuf-2.0 version found in ${GDKPIXBUFROOT}/pango/ ( $versionDir ). Packager will exit"
367 echo "Copying all Pango modules ..."
368 cp -R $PANGOLIB/modules
/*.so
$Modules
370 echo "Copying all GDK Pixbuf loaders ..."
371 cp -R $GDKPIXBUFLIB/loaders
/*.so
$Loaders
373 pango-querymodules |
sed "s?$PANGOLIB/?@ROOTDIR@/?" > $Etc/pango.modules.
in
374 gdk-pixbuf-query-loaders |
sed "s?$GDKPIXBUFLIB/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.
in
376 # We sort of rely on clearlooks, so include a version
377 # this one is special - we will set GTK_PATH to $Libraries/clearlooks
379 if [ ! -e ${GTKLIB}/engines
/libclearlooks.so
]; then
381 echo "!!! ERROR !!! - not able to locate libclearlooks.so"
383 echo "Packager with exit"
387 echo "Copying clearlooks ..."
388 cp ${GTKLIB}/engines
/libclearlooks.so
$Libraries
389 mkdir
-p $Libraries/clearlooks
/engines
390 (cd $Libraries/clearlooks
/engines
&& ln -s ..
/..
/libclearlooks
* libclearlooks.so
)
393 if test x
$WITH_LADSPA != x
; then
394 if test x
$MIXBUS != x
; then
395 plugdir
=mixbus_ladspa
399 echo "Copying `ls $plugdir | wc -l` plugins ..."
400 if [ -d $plugdir ] ; then
401 cp -r $plugdir/* $Plugins
406 cp $BUILD_ROOT/libs
/surfaces
/*/libardour
*.so
* $Surfaces
407 # hack ... move libardour_cp back into Libraries
408 mv $Surfaces/libardourcp.so
* $Libraries
411 cp $BUILD_ROOT/libs
/panners
/*/lib
*.so
* $Panners
413 # VAMP plugins that we use
414 cp $BUILD_ROOT/libs
/vamp-plugins
/libardourvampplugins.so
* $Libraries
416 OURLIBDIR
=$BUILD_ROOT/libs
417 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/gtkmm
2/atk
:$OURLIBDIR/gtkmm
2/pango
:$OURLIBDIR/gtkmm
2/gdk
:$OURLIBDIR/gtkmm
2/gtk
:$OURLIBDIR/libgnomecanvasmm
:$OURLIBDIR/libsndfile
:$OURLIBDIR/evoral
:$OURLIBDIR/evoral
/src
/libsmf
:$OURLIBDIR/audiographer
:$OURLIBDIR/timecode
:$OURLIBDIR/taglib
419 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
425 filelist
=`find $APPLIB/ -type f`
426 filelist
="$APPBIN/$MAIN_EXECUTABLE $filelist"
428 for file in $filelist ; do
429 if ! file $file |
grep -qs ELF
; then
433 # speed this up a bit by not checking things multiple times.
434 for i
in "${depCheckedList[@]}"; do
435 if [ $i == $file ]; then
439 depCheckedList
[$checkIdx]=$file
440 checkIdx
=$
(($checkIdx + 1))
442 # do not include libjack
443 deps
=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
445 # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.'
447 for dep
in $deps ; do
448 if test "not" = ${dep}; then
450 echo "!!! ERROR !!! - Missing dependant library for $file."
452 (LD_LIBRARY_PATH
=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd
$file)
454 echo "!!! ERROR !!! - See Above"
458 # don't use anything mapped at a specific address
459 if echo $dep |
grep -qs '0x' ; then continue; fi
461 if echo $dep |
grep -qs "^/lib/" ; then continue; fi
463 if echo $dep |
grep -qs libjack
; then continue; fi
464 # don't include any X Window libraries
465 if echo $dep |
grep -qs libX
; then continue; fi
466 if echo $dep |
grep -qs libxcb
; then continue; fi
468 if echo $dep |
grep -qs 'libc\.' ; then continue; fi
469 # don't include libstdc++
470 if echo $dep |
grep -qs libstdc
++ ; then continue; fi
473 if ! test -f $Libraries/$base; then
474 parent
=$
(basename ${file})
475 if echo $dep |
grep -sq '^libs' ; then
476 echo "Copying dependant lib $BUILD_ROOT/$dep (required by ${parent})"
477 cp $BUILD_ROOT/$dep $Libraries
479 echo "Copying dependant lib $dep (required by ${parent})"
486 if test x
$missing = xfalse
; then
487 # everything has been found
494 if test x
$STRIP != x
; then
495 echo Stripping libraries
496 find $APPLIB/ -name "*.so*" |
xargs strip
497 find $APPLIB/ -name "*.so*" |
xargs chmod a
+rx
500 echo "Copying other stuff to $APPDIR ..."
502 # these are all generated by waf
503 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Etc
504 cp $BUILD_ROOT/gtk2_ardour
/mnemonic-us.bindings
$Etc
505 cp $BUILD_ROOT/gtk2_ardour
/ardour.menus
$Etc
506 cp $BUILD_ROOT/ardour_system.rc
$Etc/ardour_system.rc
507 # temporarily unavailable
508 #cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_light.rc $Etc
509 cp $BUILD_ROOT/gtk2_ardour
/ardour3_ui_dark.rc
$Etc
511 # these are copied straight from the source tree
513 cp ..
/..
/gtk2_ardour
/ardour3_ui_default.conf
$Etc/ardour3_ui.conf
514 cp ..
/..
/instant.xml
$Etc/instant.xml
515 cp -r ..
/..
/gtk2_ardour
/icons
$Etc
516 cp -r ..
/..
/gtk2_ardour
/pixmaps
$Etc
519 # put sooper sekrit ingredients here and they will be copied
522 if [ -d specialSauce
] ; then
523 cp -r specialSauce
$Etc
528 cp -R ..
/..
/gtk2_ardour
/splash.png
$Shared
529 # currently no templates
530 #cp ../../templates/*.template $Shared/templates/
532 # go through and recursively remove any .svn dirs in the bundle
533 for svndir
in `find $APPDIR -name .svn -type d`; do
538 if [ -e $BUILD_ROOT/tools
/sanity_check
/sanityCheck
]; then
539 cp $BUILD_ROOT/tools
/sanity_check
/sanityCheck
$APPDIR
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"
556 if [ -x $EXTERNAL_JACK != x
] ; then
557 cp $EXTERNAL_JACK $PRODUCT_PKG_DIR
561 echo "Building tarball ..."
563 rm -f $APPDIR.
tar.bz2
564 tar -cjf $APPDIR.
tar.bz2
$APPDIR