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