change packaging of GTK rc file for OS X and Linux.
[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 VFork=$Libraries/vfork
169
170 if [ x$PRINT_SYSDEPS != x ] ; then
171 #
172 # print system dependencies
173 #
174
175         for file in $APPBIN/* $Libraries/* $Modules/* $Plugins/*.so ; do 
176                 if ! file $file | grep -qs Mach-O ; then
177                         continue
178                 fi
179                 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)" 
180         done | sort | uniq
181         exit 0
182 fi
183
184 echo "Removing old $APPDIR tree ..."
185 rm -rf $APPDIR/
186
187 echo "Building new app directory structure ..."
188
189 # only bother to make the longest paths
190
191 mkdir -p $APPDIR
192 mkdir -p $APPBIN
193 mkdir -p $APPLIB
194 mkdir -p $Etc
195 mkdir -p $Plugins
196 mkdir -p $Modules
197 mkdir -p $Loaders
198 mkdir -p $Shared
199 mkdir -p $Locale
200 mkdir -p $Surfaces
201 mkdir -p $MidiMaps
202 mkdir -p $PatchFiles
203 mkdir -p $MackieControl
204 mkdir -p $ExportFormats
205 mkdir -p $Panners
206 mkdir -p $Backends
207 mkdir -p $Templates
208 mkdir -p $Shared/doc
209 mkdir -p $VFork
210
211 # maybe set variables
212 ENVIRONMENT=environment
213 rm -f $ENVIRONMENT
214 touch $ENVIRONMENT
215
216 if test x$MIXBUS != x ; then
217         echo export ARDOUR_MIXBUS=true >> $ENVIRONMENT
218         #
219         # current default for MIXBUS version is US keyboard layout without a keypad
220         #
221         echo export ARDOUR_KEYBOARD_LAYOUT=us-nokeypad >> $ENVIRONMENT
222         echo export ARDOUR_UI_CONF=ardour3_ui.conf >> $ENVIRONMENT
223 fi
224
225 #
226 # if we're not going to bundle JACK, make sure we can find
227 # jack in the places where it might be
228 #
229
230 echo export 'PATH=/usr/local/bin:/opt/bin:$PATH' >> $ENVIRONMENT
231
232 # create startup helper script
233
234 sed -e "/^%ENV%/r $ENVIRONMENT" -e '/^%ENV%/d' -e 's/%VER%/'"${release_version}"'/' < ardour.sh.in > $APPBIN/ardour3
235 rm $ENVIRONMENT && chmod 775 $APPBIN/ardour3
236 MAIN_EXECUTABLE=ardour-${release_version}
237
238 echo "Copying ardour executable ...."
239 cp $BUILD_ROOT/gtk2_ardour/$MAIN_EXECUTABLE $APPBIN
240 if test x$STRIP = xall ; then
241         strip $APPBIN/$MAIN_EXECUTABLE
242 fi
243
244 # copy locale files
245 # note that at present(feb 2011), the .mo files end up in the source tree which is
246 # not really as it should be.
247 if test x$WITH_NLS != x ; then
248         echo "NLS support ..."
249         echo "I hope you remembered to run scons msgupdate!"
250         LINGUAS=
251
252         for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do 
253             files=`find ../../$pkg -name "*.mo"`
254
255             #
256             # the package name is appended with a number so that
257             # it can be parallel installed during a regular install
258             # with older (and newer) versions. it is just the major
259             # number of the release (i.e. leading digits)
260             #
261
262             vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
263
264             if [ -z "$files" ]; then
265                 echo ""
266                 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
267                 echo ""
268             fi
269  
270             for file in $files 
271             do
272                 echo $file
273                 lang=`basename $file | sed 's/\.mo//'`
274                 mkdir -p $Locale/$lang/LC_MESSAGES
275                 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
276                 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
277                 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
278                     :
279                 else 
280                     LINGUAS="$LINGUAS $lang"
281                 fi
282             done
283         done
284
285         GTK_MESSAGES="atk10.mo gdk-pixbuf.mo gtk20-properties.mo gtk20.mo atk10.mo glib20.mo"
286         LOCALEROOT=$GTKSTACK_ROOT/share/locale
287
288         for l in $LINGUAS ; do
289                 echo "Copying GTK i18n files for $l..."
290                 for MO in $GTK_MESSAGES ; do 
291                         if [ -f $LOCALEROOT/$l/LC_MESSAGES/$MO ] ; then
292                                 cp $LOCALEROOT/$l/LC_MESSAGES/$MO $Locale/$l/LC_MESSAGES
293                         else
294                                 # try with just the language spec
295                                 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
296                                 if [ -f $LOCALEROOT/$just_lang/LC_MESSAGES/$MO ] ; then
297                                         cp $LOCALEROOT/$just_lang/LC_MESSAGES/$MO $Locale/$just_lang/LC_MESSAGES
298                                 fi
299                         fi
300                 done
301         done
302 else
303         echo "Skipping NLS support"
304 fi
305
306 #
307 # Copy stuff that may be dynamically loaded
308
309
310 cp -R $GTKSTACK_ROOT/etc/* $Etc
311 echo "Copying all Pango modules ..."
312 cp -R $GTKSTACK_ROOT/lib/pango/1.8.0/modules/*.so $Modules
313 echo "Copying all GDK Pixbuf loaders ..."
314 cp -R $GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so $Loaders
315
316 # Generate a pango module file using the actual Pango that we're going to bundle
317
318 cat > pangorc <<EOF 
319 [Pango]
320 ModulesPath=$GTKSTACK_ROOT/lib/pango/1.8.0/modules
321 EOF
322 env PANGO_RC_FILE=pangorc $GTKSTACK_ROOT/bin/pango-querymodules | sed "s?$GTKSTACK_ROOT/lib/pango/1.8.0/?@ROOTDIR@/?" > $Etc/pango.modules.in
323 rm pangorc
324
325 # Ditto for gdk-pixbuf loaders
326 gdk-pixbuf-query-loaders | sed "s?$GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
327
328 # We rely on clearlooks, so include a version from our own build tree
329 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
330
331 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
332 mkdir -p $GTK_ENGINE_DIR
333
334 echo "Copying GTK engines ..."
335 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
336 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
337
338 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
339 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
340
341 # LADSPA
342 if test x$WITH_LADSPA != x ; then
343         if test x$MIXBUS != x ; then
344                 plugdir=mixbus_ladspa
345         else
346                 plugdir=ladspa
347         fi
348         echo "Copying `ls $plugdir | wc -l` plugins ..."
349         if [ -d $plugdir ] ; then
350                 cp -r $plugdir/* $Plugins
351         fi
352 fi
353
354 # Control Surfaces
355 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
356 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
357
358 # MidiMaps
359 # got to be careful with names here
360 for x in $BUILD_ROOT/../midi_maps/*.map ; do
361     cp "$x" $MidiMaps
362 done
363
364 # MIDNAM Patch Files
365 # got to be careful with names here
366 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
367     cp "$x" $PatchFiles
368 done
369
370 # MackieControl data
371 # got to be careful with names here
372 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
373     cp "$x" $MackieControl
374 done
375
376 # Templates
377 #for f in $BUILD_ROOT/../templates/* ; do 
378 #    if [ -d "$f" ] ; then
379 #       echo Template: $f ; cp -r "$f" $Templates ; 
380 #    fi
381 #done
382
383 # ExportFormats
384 # got to be careful with names here
385 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
386     cp "$x" $ExportFormats
387 done
388
389 # Panners
390 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
391
392 # Backends
393 for backend in jack alsa dummy wavesaudio ; do
394     cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
395 done
396
397 # VAMP plugins that we use
398 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
399
400 # Suil modules (new dir 'build-stack')
401 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
402     cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
403 fi
404
405 # Suil modules (old dir 'build-ardour-stack')
406 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
407     cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
408 fi
409
410 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
411 # (if build with wine: ardour-vst-scanner is a wrapper
412 #  script for ardour-vst-scanner.exe.so, if VST is disabled
413 #  neither binary nor script exists)
414 if test -d $BUILD_ROOT/libs/fst ; then
415     cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
416 fi
417
418 # vfork wrapper
419 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
420     cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
421 fi
422
423 # ALSA device reservation tool (if available)
424 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
425     cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
426 fi
427
428 OURLIBDIR=$BUILD_ROOT/libs
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/canvas:$OURLIBDIR/libsndfile:$OURLIBDIR/evoral:$OURLIBDIR/evoral/src/libsmf:$OURLIBDIR/audiographer:$OURLIBDIR/timecode:$OURLIBDIR/taglib:$OURLIBDIR/libltc:$OURLIBDIR/qm-dsp:$OURLIBDIR/ardouralsautil
430
431 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
432
433 checkedIdx=0
434 deplibs=
435
436 while [ true ] ; do 
437         missing=false
438         filelist=`find $APPLIB/ -type f`
439         filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
440
441         for file in $filelist  ; do 
442                 if ! file $file | grep -qs ELF ; then
443                         continue
444                 fi
445
446                 # speed this up a bit by not checking things multiple times.
447                 for i in "${depCheckedList[@]}"; do
448                         if [ $i == $file ]; then
449                                 continue 2
450                         fi
451                 done
452                 depCheckedList[$checkIdx]=$file
453                 checkIdx=$(($checkIdx + 1))
454                 
455                 # do not include libjack
456                 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
457
458                 echo -n "."
459                 for dep in $deps ; do
460                         if test "not" = ${dep}; then 
461                                 echo ""
462                                 echo "!!! ERROR !!! - Missing dependant library for $file."
463                                 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
464                                 echo ""
465                                 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
466                                 echo ""
467                                 echo "!!! ERROR !!! - See Above"
468                                 exit 1
469                         fi
470
471                         # don't use anything mapped at a specific address
472                         if echo $dep | grep -qs '0x' ; then continue; fi
473                         # don't include /lib
474                         if echo $dep | grep -qs "^/lib/" ; then continue; fi
475                         # don't include jack
476                         if echo $dep | grep -qs libjack ; then continue; fi
477                         # don't include ALSA
478                         if echo $dep | grep -qs libasound ; then continue; fi
479                         # don't include any X Window libraries
480                         if echo $dep | grep -qs libX\. ; then continue; fi  
481                         if echo $dep | grep -qs libxcb ; then continue; fi  
482                         if echo $dep | grep -qs libICE\. ; then continue; fi  
483                         if echo $dep | grep -qs libSM\. ; then continue; fi  
484                         # don't include libc
485                         if echo $dep | grep -qs 'libc\.' ; then continue; fi
486                         # don't include libstdc++
487                         if echo $dep | grep -qs libstdc++ ; then continue; fi
488                         # don't include libdbus
489                         if echo $dep | grep -qs libdbus ; then continue; fi
490
491                         base=`basename $dep`
492                         if ! test -f $Libraries/$base; then
493                                 parent=$(basename ${file})
494                                 if echo $dep | grep -sq '^libs' ; then
495                                         echo "Copying dependant lib $BUILD_ROOT/$dep    (required by ${parent})"
496                                         cp $BUILD_ROOT/$dep $Libraries
497                                 else
498                                         echo "Copying dependant lib $dep    (required by ${parent})"
499                                         cp $dep $Libraries
500                                 fi
501                                 #
502                                 # reset RPATH so that the runtime linker never looks
503                                 # in places we don't want it to
504                                 #
505                                 chrpath -r foo $Libraries/`basename $dep`
506                                 if echo $dep | grep -sq '^/' ; then
507                                     # absolute path, candidate for stripping
508                                     deplibs="$deplibs $base"
509                                 fi
510                                 missing=true
511                         fi
512                 done
513         done
514         if test x$missing = xfalse ; then
515                 # everything has been found
516                 break
517         fi
518 done
519 echo
520
521 # strip libraries
522 if test x$STRIP = xall ; then
523     echo Stripping all libraries
524     # Must be writable so that we can strip
525     find $APPLIB/ -name "*.so*" | xargs chmod u+w
526     # and strip ...
527     find $APPLIB/ -name "*.so*" | xargs strip
528 elif test x$STRIP = xsome ; then
529     echo Stripping dependent libraries
530     for l in $deplibs ; do
531         chmod u+w $APPLIB/$l
532         strip $APPLIB/$l
533     done
534 fi
535 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
536
537 echo "Copying other stuff to $APPDIR  ..."
538
539 # these are all generated by waf
540 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings       $Etc
541 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings  $Etc
542 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
543 cp ../../system_config $Etc/system_config
544 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
545 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
546
547 # these are copied straight from the source tree
548
549 cp ../../instant.xml $Etc/instant.xml
550 cp ../../gtk2_ardour/step_editing.bindings $Etc
551 cp ../../gtk2_ardour/mixer.bindings $Etc
552 cp -r ../../gtk2_ardour/icons $Shared
553 cp -r ../../gtk2_ardour/pixmaps $Shared
554
555
556 #
557 # put sooper sekrit ingredients here and they will be copied
558 #
559
560 if [ -d specialSauce ] ; then
561         cp -r specialSauce $Etc
562 fi
563
564 # share stuff
565
566 cp -R ../../gtk2_ardour/splash.png $Shared
567 cp -R ../../gtk2_ardour/small-splash.png $Shared
568 cp -R ../../gtk2_ardour/ArdourMono.ttf $Shared
569
570 # install bundled LV2s to <app>/lib/LV2/
571 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
572
573 # go through and recursively remove any .svn dirs in the bundle
574 for svndir in `find $APPDIR -name .svn -type d`; do
575         rm -rf $svndir
576 done
577
578 if test x$WITH_HARVID != x ; then
579         cd $APPBIN
580         HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
581         XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
582
583         rsync -Pa \
584                 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
585                 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
586
587         rsync -Pa \
588                 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
589                 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
590
591         tar -x -z \
592                 --exclude=README --exclude=harvid.1 --strip-components=1 \
593                 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
594
595         tar -x -z \
596                 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
597                 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
598         mv xjadeo xjremote
599         cd -
600 fi
601
602 #
603 # Add the uninstaller
604 #
605 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
606 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
607
608 #Sanity Check file
609 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
610         cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
611 else
612         echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
613         exit 1
614 fi
615
616 echo "Building tarball ..."
617
618 rm -f $APPDIR.tar.bz2
619 tar -cjf $APPDIR.tar.bz2 $APPDIR
620
621 echo "Calculating bundle size"
622 du -sb $APPDIR/  | awk '{print $1}' > $APPDIR.size
623
624 rm -rf $APPDIR/
625
626 echo "Done."
627