9f3649004b2e2425c6a502e33f8d7c97c892d812
[ardour.git] / tools / linux_packaging / build
1 #!/bin/bash
2
3 #
4
5 . ./buildenv
6
7 # script for pulling together a Linux app bundle.
8 #
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
12 # installer.
13
14 MIXBUS=
15 WITH_LADSPA=0
16 STRIP=all
17 PRINT_SYSDEPS=
18 WITH_NLS=
19 EXTERNAL_JACK=
20 VENDOR=Ardour ;
21 BUILDTYPE=""
22
23 if [ $# -eq 0 ] ; then
24         echo ""  
25         echo "ERROR - Please specify build type"
26         echo "    --public"
27         echo "    --mixbus"
28         echo ""  
29         exit 1
30 fi
31
32 while [ $# -gt 0 ] ; do
33         echo "arg = $1"
34         case $1 in
35
36         #
37         # top level build targets
38         #
39
40         --mixbus)
41                 MIXBUS=1; 
42                 WITH_NLS=1 ; 
43                 WITH_LADSPA=; 
44                 STRIP=all
45                 APPNAME=Mixbus ;
46                 VENDOR=Harrison ;
47                 shift ;;
48         --public)
49                 WITH_NLS=1 ; 
50                 WITH_LADSPA=; 
51                 STRIP=all ; 
52                 APPNAME=Ardour ;
53                 shift ;;
54         --allinone)
55                 WITH_NLS= ; 
56                 WITH_LADSPA=1; 
57                 STRIP=all; 
58                 shift ;;
59         --test) WITH_LADSPA=; STRIP= ; shift ;;
60
61         #
62         # specific build flags
63         #
64
65         --nojack) INTERNAL_JACK= ; shift ;;
66         --noladspa) WITH_LADSPA= ; shift ;;
67         --strip) STRIP=$2 ; shift ; shift ;;
68         --sysdeps) PRINT_SYSDEPS=1; shift ;;
69         --nls) WITH_NLS=1 ; shift ;;
70
71         *)
72                 #catch all for unknown arguments
73                 echo ""
74                 echo "!!! ERROR !!! - Unknown argument $1"
75                 echo ""
76                 exit 1
77                 ;;
78         esac
79 done
80
81 if test x$STRIP != xall -a x$STRIP != xnone -a x$STRIP != xsome ; then
82     echo "Unknown strip option \"$STRIP\""
83     echo "Legal values are: all, none, some"
84     exit 1
85 fi
86
87 release_version=`grep -m 1 '^VERSION' ../../wscript | awk '{print $3}' | sed "s/'//g"`
88 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d"'" -f 2`
89 echo "Version is $release_version / $svn_version"
90 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
91 echo "Info string is $info_string"
92
93 # Figure out our CPU type
94 case `uname -m` in
95         i[3456789]86|x86|i86pc)
96                 echo "Architecture is x86"
97                 ARCH='x86'
98                 ARCH_BITS='32-bit'
99                 ;;
100         x86_64|amd64|AMD64)
101                 echo "Architecture is x86_64"
102                 ARCH='x86_64'
103                 ARCH_BITS='64-bit'
104                 ;;
105         *)
106                 echo ""
107                 echo "ERROR - Unknown architecture `uname -m`"
108                 echo ""
109                 exit 1
110                 ;;
111 esac
112
113 # Figure out the Build Type
114 if grep -q "DEBUG = True" ../../build/c4che/default.cache.py; then
115         DEBUG="T"
116 else
117         DEBUG="F"
118 fi
119
120 if [ x$DEBUG = xT ]; then
121     BUILDTYPE="dbg"
122     if [ x$STRIP = xall ] ; then
123         echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
124         STRIP=some
125     fi
126 fi
127
128 # the waf build tree to use when copying built/generated files
129
130 BUILD_ROOT=../../build
131
132 # setup directory structure
133
134 if [ -z "${BUILDTYPE}" ]; then
135         APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}
136         APP_VER_NAME=${APPNAME}-${release_version}_${svn_version}
137 else
138         APPDIR=${APPNAME}_${ARCH}-${release_version}_${svn_version}-${BUILDTYPE}
139         APP_VER_NAME=${APPNAME}-${release_version}_${svn_version}-${BUILDTYPE}
140 fi
141
142 APPBIN=$APPDIR/bin
143 APPLIB=$APPDIR/lib
144 Libraries=$APPLIB
145 Etc=$APPDIR/etc
146 Shared=$APPDIR/share
147 Plugins=$APPLIB/plugins
148 Surfaces=$APPLIB/surfaces
149 Panners=$APPLIB/panners
150 ExportFormats=$Shared/export
151 Locale=$Shared/locale
152 MidiMaps=$Shared/midi_maps
153 MackieControl=$Shared/mcp
154 Modules=$Libraries/modules
155 Loaders=$Libraries/loaders
156
157
158 if [ x$PRINT_SYSDEPS != x ] ; then
159 #
160 # print system dependencies
161 #
162
163         for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do 
164                 if ! file $file | grep -qs Mach-O ; then
165                         continue
166                 fi
167                 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)" 
168         done | sort | uniq
169         exit 0
170 fi
171
172 echo "Removing old $APPDIR tree ..."
173 rm -rf $APPDIR/
174
175 echo "Building new app directory structure ..."
176
177 # only bother to make the longest paths
178
179 mkdir -p $APPDIR
180 mkdir -p $APPBIN
181 mkdir -p $APPLIB
182 mkdir -p $Etc
183 mkdir -p $Plugins
184 mkdir -p $Modules
185 mkdir -p $Loaders
186 mkdir -p $Shared
187 mkdir -p $Locale
188 mkdir -p $Surfaces
189 mkdir -p $MidiMaps
190 mkdir -p $MackieControl
191 mkdir -p $ExportFormats
192 mkdir -p $Panners
193 mkdir -p $Shared/templates
194 mkdir -p $Shared/doc
195
196 # maybe set variables
197 ENVIRONMENT=environment
198 rm -f $ENVIRONMENT
199 touch $ENVIRONMENT
200
201 if test x$MIXBUS != x ; then
202         echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
203         #
204         # current default for MIXBUS version is US keyboard layout without a keypad
205         #
206         echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
207         echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
208         echo export ARDOUR3_UI_RC=ardour3_ui_dark.rc >> $ENVIRONMENT
209 fi
210
211 #
212 # if we're not going to bundle JACK, make sure we can find
213 # jack in the places where it might be
214 #
215
216 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
217
218 # create startup helper script
219
220 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour3
221 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour3
222 #MAIN_EXECUTABLE=ardour-$release_version
223 MAIN_EXECUTABLE=ardour-3.0
224
225 echo "Copying ardour executable ...."
226 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
227 if test x$STRIP = xall ; then
228         strip $APPBIN/$MAIN_EXECUTABLE
229 fi
230
231 # copy locale files
232 # note that at present(feb 2011), the .mo files end up in the source tree which is
233 # not really as it should be.
234 if test x$WITH_NLS != x ; then
235         echo "NLS support ..."
236         echo "I hope you remembered to run scons msgupdate!"
237         LINGUAS=
238
239         for dl in gtk2_ardour libs/ardour libs/gtkmm2ext ; do 
240             files=`find ../../$dl -name "*.mo"`
241
242             if [ -z "$files" ]; then
243                 echo ""
244                 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$dl"
245                 echo ""
246             fi
247  
248             for file in $files 
249             do
250                 echo $file
251                 lang=`basename $file | sed 's/\.mo//'`
252                 mkdir -p $Locale/$lang/LC_MESSAGES
253                 cp $file $Locale/$lang/LC_MESSAGES/`basename $dl`
254                 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
255                     :
256                 else 
257                     LINGUAS="$LINGUAS $lang"
258                 fi
259             done
260         done
261
262         GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
263         LOCALEROOT=/usr/share/locale
264
265         for l in $LINGUAS ; do
266                 echo "Copying GTK i18n files for $l..."
267                 for MO in $GTK_MESSAGES ; do 
268                         if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
269                                 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
270                         else
271                                 # try with just the language spec
272                                 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
273                                 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
274                                         cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
275                                 fi
276                         fi
277                 done
278         done
279 else
280         echo "Skipping NLS support"
281 fi
282
283 ### Find fontconfig ###
284 FCROOT=`pkg-config --libs-only-L fontconfig | sed -e "s/-L//" -e "s/[[:space:]]//g"`
285 if [ ! -z "$FCROOT" ]; then
286         echo "Found FCOOT using pkg-config"
287         FCETC=`dirname $FCROOT`/etc
288 elif [ -d /usr/lib/gtk-2.0 ]; then
289         FCETC="/etc"
290 elif [ -d /usr/local/lib/gtk-2.0 ]; then
291         FCETC="/usr/local/etc"
292 else
293         echo ""
294         echo "!!! ERROR !!! - Unable to locate fontconfig directory. Packager will exit"
295         echo ""
296         exit 1
297 fi
298
299 echo "Copying Fontconfig files to $Etc ..."
300 cp -r $FCETC/fonts $Etc
301
302 ### Find gtk ###
303 GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
304 if [ ! -z "$GTKROOT" ]; then
305         echo "Found GTKROOT using pkg-config"
306 elif [ -d /usr/lib/gtk-2.0 ]; then
307         GTKROOT="/usr/lib"
308 elif [ -d /usr/local/lib/gtk-2.0 ]; then
309         GTKROOT="/usr/local/lib"
310 else
311         echo ""
312         echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit"
313         echo ""
314         exit 1
315 fi
316
317 echo "GTKROOT is ${GTKROOT}"
318 versionDir=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
319
320 num=0
321 for name in $versionDir ; do
322     num=$(($num + 1))
323 done
324
325 if [ $num -eq 1 ]; then
326         GTKLIB=${GTKROOT}/gtk-2.0/$versionDir
327         echo "GTKLIB is ${GTKLIB}"
328 else
329         echo ""
330         echo "!!! ERROR !!! - More than one gtk-2.0 version found in ${GTKROOT}/gtk-2.0/  ( $versionDir ). Packager will exit"
331         echo ""
332         exit 1
333 fi
334
335
336 ### Find pango ###
337 PANGOROOT=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g"`
338 if [ ! -z "$PANGOROOT" ]; then
339         echo "Found PANGOROOT using pkg-config"
340 elif [ -d /usr/lib/pango ]; then
341         PANGOROOT="/usr/lib"
342 elif [ -d /usr/local/lib/pango ]; then
343         PANGOROOT="/usr/local/lib"
344 elif [ -d /usr/lib/x86_64-linux-gnu/pango ]; then
345         PANGOROOT="/usr/lib/x86_64-linux-gnu"
346 else
347         echo ""
348         echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit"
349         echo ""
350         exit 1
351 fi
352
353 echo "PANGOROOT is ${PANGOROOT}"
354 versionDir=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
355
356 num=0
357 for name in $versionDir ; do
358         num=$(($num + 1))
359 done
360
361 if [ $num -eq 1 ]; then
362         PANGOLIB=${PANGOROOT}/pango/$versionDir
363         echo "PANGOLIB is ${PANGOLIB}"
364 else
365         echo ""
366         echo "!!! ERROR !!! - More than one pango version found in ${PANGOROOT}/pango/  ( $versionDir ). Packager will exit"
367         echo ""
368         exit 1
369 fi
370
371
372 ### Find gdk-pixbuf ###
373 GDKPIXBUFROOT=`pkg-config --libs-only-L gdk-pixbuf-2.0 | sed -e "s/-L//" -e "s/[[:space:]]//g"`
374 if [ ! -z "$GDKPIXBUFROOT" ]; then
375         echo "Found GDKPIXBUFROOT using pkg-config"
376 elif [ -d /usr/lib/gdk-pixbuf-2.0 ]; then
377         GDKPIXBUFROOT="/usr/lib"
378 elif [ -d /usr/local/lib/gdk-pixbuf-2.0 ]; then
379         GDKPIXBUFROOT="/usr/local/lib"
380 elif [ -d ${GTKLIB}/loaders ]; then  #odd ball case
381         GDKPIXBUFROOT=${GTKROOT}
382         GDKPIXBUFLIB=${GTKLIB}
383 else
384         echo ""
385         echo "!!! ERROR !!! - Unable to locate gdk-pixbuf-2.0 directory. Packager will exit"
386         echo ""
387         exit 1
388 fi
389
390 echo "GDKPIXBUFROOT is ${GDKPIXBUFROOT}"
391
392 if [ -z ${GDKPIXBUFLIB} ]; then
393         versionDir=`ls ${GDKPIXBUFROOT}/gdk-pixbuf-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"`
394
395         num=0
396         for name in $versionDir ; do
397             num=$(($num + 1))
398         done
399
400         if [ $num -eq 1 ]; then
401                 GDKPIXBUFLIB=${GDKPIXBUFROOT}/gdk-pixbuf-2.0/$versionDir
402                 echo "GDKPIXBUFLIB is ${GDKPIXBUFLIB}"
403         else
404                 echo ""
405                 echo "!!! ERROR !!! - More than one gdk-pixbuf-2.0 version found in ${GDKPIXBUFROOT}/pango/  ( $versionDir ). Packager will exit"
406                 echo ""
407                 exit 1
408         fi
409 fi
410
411
412
413 echo "Copying all Pango modules ..."
414 cp -R $PANGOLIB/modules/*.so $Modules
415
416 echo "Copying all GDK Pixbuf loaders ..."
417 cp -R $GDKPIXBUFLIB/loaders/*.so $Loaders
418
419 pango-querymodules | sed "s?$PANGOLIB/?@ROOTDIR@/?" > $Etc/pango.modules.in
420 gdk-pixbuf-query-loaders | sed "s?$GDKPIXBUFLIB/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
421
422 # We sort of rely on clearlooks, so include a version
423 # this one is special - we will set GTK_PATH to $Libraries/clearlooks
424
425 if [ ! -e ${GTKLIB}/engines/libclearlooks.so ]; then
426     if [ ! -e $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so ] ; then 
427         echo ""
428         echo "!!! ERROR !!! - not able to locate libclearlooks.so"
429         echo ""
430         echo "Packager with exit"
431         exit 1
432     else 
433         clearlooks_so=$BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so
434     fi
435 else
436     clearlooks_so=${GTKLIB}/engines/libclearlooks.so
437 fi
438
439 echo "Copying clearlooks ..."
440 cp $clearlooks_so $Libraries
441 mkdir -p $Libraries/clearlooks/engines
442 (cd $Libraries/clearlooks/engines && ln -s ../../libclearlooks* libclearlooks.so )
443
444 # LADSPA
445 if test x$WITH_LADSPA != x ; then
446         if test x$MIXBUS != x ; then
447                 plugdir=mixbus_ladspa
448         else
449                 plugdir=ladspa
450         fi
451         echo "Copying `ls $plugdir | wc -l` plugins ..."
452         if [ -d $plugdir ] ; then
453                 cp -r $plugdir/* $Plugins
454         fi
455 fi
456
457 # Control Surfaces
458 cp $BUILD_ROOT/libs/surfaces/*/libardour*.so* $Surfaces
459 # hack ... move libardour_cp back into Libraries
460 mv $Surfaces/libardourcp.so* $Libraries
461
462 # MidiMaps
463 # got to be careful with names here
464 for x in $BUILD_ROOT/../midi_maps/*.map ; do
465     cp "$x" $MidiMaps
466     echo Copied MIDI map $x 
467 done
468
469 # MackieControl data
470 # got to be careful with names here
471 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
472     cp "$x" $MackieControl
473     echo Copied Mackie Control file $x 
474 done
475
476 # ExportFormats
477 # got to be careful with names here
478 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
479     cp "$x" $ExportFormats
480 done
481
482 # Panners
483 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
484
485 # VAMP plugins that we use
486 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
487
488 OURLIBDIR=$BUILD_ROOT/libs
489 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
490
491 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
492
493 checkedIdx=0
494 deplibs=
495
496 while [ true ] ; do 
497         missing=false
498         filelist=`find $APPLIB/ -type f`
499         filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
500
501         for file in $filelist  ; do 
502                 if ! file $file | grep -qs ELF ; then
503                         continue
504                 fi
505
506                 # speed this up a bit by not checking things multiple times.
507                 for i in "${depCheckedList[@]}"; do
508                         if [ $i == $file ]; then
509                                 continue 2
510                         fi
511                 done
512                 depCheckedList[$checkIdx]=$file
513                 checkIdx=$(($checkIdx + 1))
514                 
515                 # do not include libjack
516                 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
517
518                 # LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | egrep "(/opt/|/local/|libs/|/usr/lib|/gtk)" | grep -v 'libjack\.'
519                 echo -n "."
520                 for dep in $deps ; do
521                         if test "not" = ${dep}; then 
522                                 echo ""
523                                 echo "!!! ERROR !!! - Missing dependant library for $file."
524                                 echo ""
525                                 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
526                                 echo ""
527                                 echo "!!! ERROR !!! - See Above"
528                                 exit 1
529                         fi
530
531                         # don't use anything mapped at a specific address
532                         if echo $dep | grep -qs '0x' ; then continue; fi
533                         # don't include /lib
534                         if echo $dep | grep -qs "^/lib/" ; then continue; fi
535                         # don't include jack
536                         if echo $dep | grep -qs libjack ; then continue; fi
537                         # don't include any X Window libraries
538                         if echo $dep | grep -qs libX ; then continue; fi  
539                         if echo $dep | grep -qs libxcb ; then continue; fi  
540                         # don't include libc
541                         if echo $dep | grep -qs 'libc\.' ; then continue; fi
542                         # don't include libstdc++
543                         if echo $dep | grep -qs libstdc++ ; then continue; fi
544
545                         base=`basename $dep`
546                         if ! test -f $Libraries/$base; then
547                                 parent=$(basename ${file})
548                                 if echo $dep | grep -sq '^libs' ; then
549                                         echo "Copying dependant lib $BUILD_ROOT/$dep    (required by ${parent})"
550                                         cp $BUILD_ROOT/$dep $Libraries
551                                 else
552                                         echo "Copying dependant lib $dep    (required by ${parent})"
553                                         cp $dep $Libraries
554                                 fi
555                                 if echo $dep | grep -sq '^/' ; then
556                                     # absolute path, candidate for stripping
557                                     deplibs="$deplibs $base"
558                                 fi
559                                 missing=true
560                         fi
561                 done
562         done
563         if test x$missing = xfalse ; then
564                 # everything has been found
565                 break
566         fi
567 done
568 echo
569
570 # strip libraries
571 if test x$STRIP = xall ; then
572     echo Stripping all libraries
573     # Must be writable so that we can strip
574     find $APPLIB/ -name "*.so*" | xargs chmod u+w
575     # and strip ...
576     find $APPLIB/ -name "*.so*" | xargs strip
577 elif test x$STRIP = xsome ; then
578     echo Stripping dependent libraries
579     for l in $deplibs ; do
580         chmod u+w $APPLIB/$l
581         strip $APPLIB/$l
582     done
583 fi
584 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
585
586 echo "Copying other stuff to $APPDIR  ..."
587
588 # these are all generated by waf
589 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings       $Etc
590 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings  $Etc
591 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
592 cp $BUILD_ROOT/ardour_system.rc $Etc/ardour_system.rc
593 cp $BUILD_ROOT/gtk2_ardour/ardour3*.rc $Etc
594
595 # these are copied straight from the source tree
596
597 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui_default.conf
598 cp ../../gtk2_ardour/ardour3_ui_default.conf $Etc/ardour3_ui.conf
599 cp ../../instant.xml $Etc/instant.xml
600 cp ../../gtk2_ardour/step_editing.bindings $Etc
601 cp ../../gtk2_ardour/mixer.bindings $Etc
602 cp -r ../../gtk2_ardour/icons $Shared
603 cp -r ../../gtk2_ardour/pixmaps $Shared
604
605
606 #
607 # put sooper sekrit ingredients here and they will be copied
608 #
609
610 if [ -d specialSauce ] ; then
611         cp -r specialSauce $Etc
612 fi
613
614 # share stuff
615
616 cp -R ../../gtk2_ardour/splash.png $Shared
617 # currently no templates
618 #cp ../../templates/*.template $Shared/templates/
619
620 # go through and recursively remove any .svn dirs in the bundle
621 for svndir in `find $APPDIR -name .svn -type d`; do
622         rm -rf $svndir
623 done
624
625 #
626 # Add the uninstaller
627 #
628 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
629 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
630
631 #Sanity Check file
632 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
633         cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
634 else
635         echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
636         exit 1
637 fi
638
639 echo "Building tarball ..."
640
641 rm -f $APPDIR.tar.bz2
642 tar -cjf $APPDIR.tar.bz2 $APPDIR
643
644 echo "Calculating bundle size"
645 du -sb $APPDIR/  | awk '{print $1}' > $APPDIR.size
646
647 rm -rf $APPDIR/
648
649 echo "Done."
650