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