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