attempt to remove major version hard-coding from linux packaging tools
[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 echo "Copying all Pango modules ..."
316 cp -R $GTKSTACK_ROOT/lib/pango/1.8.0/modules/*.so $Modules
317 echo "Copying all GDK Pixbuf loaders ..."
318 cp -R $GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so $Loaders
319
320 # Generate a pango module file using the actual Pango that we're going to bundle
321
322 cat > pangorc <<EOF 
323 [Pango]
324 ModulesPath=$GTKSTACK_ROOT/lib/pango/1.8.0/modules
325 EOF
326 env PANGO_RC_FILE=pangorc $GTKSTACK_ROOT/bin/pango-querymodules | sed "s?$GTKSTACK_ROOT/lib/pango/1.8.0/?@ROOTDIR@/?" > $Etc/pango.modules.in
327 rm pangorc
328
329 # Ditto for gdk-pixbuf loaders
330 gdk-pixbuf-query-loaders | sed "s?$GTKSTACK_ROOT/lib/gdk-pixbuf-2.0/2.10.0/?@ROOTDIR@/?" > $Etc/gdk-pixbuf.loaders.in
331
332 # We rely on clearlooks, so include a version from our own build tree
333 # this one is special - we will set GTK_PATH to $Libraries/gtkengines
334
335 GTK_ENGINE_DIR=$Libraries/gtkengines/engines
336 mkdir -p $GTK_ENGINE_DIR
337
338 echo "Copying GTK engines ..."
339 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.so $Libraries
340 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.so . )
341
342 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Libraries
343 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so . )
344
345 # LADSPA
346 if test x$WITH_LADSPA != x ; then
347         if test x$MIXBUS != x ; then
348                 plugdir=mixbus_ladspa
349         else
350                 plugdir=ladspa
351         fi
352         echo "Copying `ls $plugdir | wc -l` plugins ..."
353         if [ -d $plugdir ] ; then
354                 cp -r $plugdir/* $Plugins
355         fi
356 fi
357
358 # Control Surfaces
359 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
360 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
361
362 # MidiMaps
363 # got to be careful with names here
364 for x in $BUILD_ROOT/../midi_maps/*.map ; do
365     cp "$x" $MidiMaps
366 done
367
368 # MIDNAM Patch Files
369 # got to be careful with names here
370 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
371     cp "$x" $PatchFiles
372 done
373
374 # MackieControl data
375 # got to be careful with names here
376 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
377     cp "$x" $MackieControl
378 done
379
380 # Templates
381 #for f in $BUILD_ROOT/../templates/* ; do 
382 #    if [ -d "$f" ] ; then
383 #       echo Template: $f ; cp -r "$f" $Templates ; 
384 #    fi
385 #done
386
387 # ExportFormats
388 # got to be careful with names here
389 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
390     cp "$x" $ExportFormats
391 done
392
393 # Panners
394 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
395
396 # Backends
397 for backend in jack alsa dummy wavesaudio ; do
398     cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
399 done
400
401 # VAMP plugins that we use
402 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
403
404 # Suil modules (new dir 'build-stack')
405 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
406     cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
407 fi
408
409 # Suil modules (old dir 'build-ardour-stack')
410 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
411     cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
412 fi
413
414 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
415 # (if build with wine: ardour-vst-scanner is a wrapper
416 #  script for ardour-vst-scanner.exe.so, if VST is disabled
417 #  neither binary nor script exists)
418 if test -d $BUILD_ROOT/libs/fst ; then
419     cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
420 fi
421
422 # vfork wrapper
423 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
424     cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
425 fi
426
427 # ALSA device reservation tool (if available)
428 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
429     cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
430 fi
431
432 OURLIBDIR=$BUILD_ROOT/libs
433 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
434
435 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
436
437 checkedIdx=0
438 deplibs=
439
440 while [ true ] ; do 
441         missing=false
442         filelist=`find $APPLIB/ -type f`
443         filelist="$APPBIN/$MAIN_EXECUTABLE $filelist"
444
445         for file in $filelist  ; do 
446                 if ! file $file | grep -qs ELF ; then
447                         continue
448                 fi
449
450                 # speed this up a bit by not checking things multiple times.
451                 for i in "${depCheckedList[@]}"; do
452                         if [ $i == $file ]; then
453                                 continue 2
454                         fi
455                 done
456                 depCheckedList[$checkIdx]=$file
457                 checkIdx=$(($checkIdx + 1))
458
459                 # ignore suil/qt wrappers - the plugin will pull in QT4.
460                 if echo $file | grep -qs 'libsuil_.*qt4' ; then continue; fi
461                 
462                 # do not include libjack
463                 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'`
464
465                 echo -n "."
466                 for dep in $deps ; do
467                         if test "not" = ${dep}; then 
468                                 echo ""
469                                 echo "!!! ERROR !!! - Missing dependant library for $file."
470                                 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
471                                 echo ""
472                                 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
473                                 echo ""
474                                 echo "!!! ERROR !!! - See Above"
475                                 exit 1
476                         fi
477
478                         # don't use anything mapped at a specific address
479                         if echo $dep | grep -qs '0x' ; then continue; fi
480                         # don't include /lib
481                         if echo $dep | grep -qs "^/lib/" ; then continue; fi
482                         # don't include jack
483                         if echo $dep | grep -qs libjack ; then continue; fi
484                         # don't include ALSA
485                         if echo $dep | grep -qs libasound ; then continue; fi
486                         # don't include any X Window libraries
487                         if echo $dep | grep -qs libX\. ; then continue; fi  
488                         if echo $dep | grep -qs libxcb ; then continue; fi  
489                         if echo $dep | grep -qs libICE\. ; then continue; fi  
490                         if echo $dep | grep -qs libSM\. ; then continue; fi  
491                         # don't include libc
492                         if echo $dep | grep -qs 'libc\.' ; then continue; fi
493                         # don't include libstdc++
494                         if echo $dep | grep -qs libstdc++ ; then continue; fi
495                         # don't include libdbus
496                         if echo $dep | grep -qs libdbus ; then continue; fi
497
498                         base=`basename $dep`
499                         if ! test -f $Libraries/$base; then
500                                 parent=$(basename ${file})
501                                 if echo $dep | grep -sq '^libs' ; then
502                                         echo "Copying dependant lib $BUILD_ROOT/$dep    (required by ${parent})"
503                                         cp $BUILD_ROOT/$dep $Libraries
504                                 else
505                                         echo "Copying dependant lib $dep    (required by ${parent})"
506                                         cp $dep $Libraries
507                                 fi
508                                 #
509                                 # reset RPATH so that the runtime linker never looks
510                                 # in places we don't want it to
511                                 #
512                                 chrpath -r foo $Libraries/`basename $dep`
513                                 if echo $dep | grep -sq '^/' ; then
514                                     # absolute path, candidate for stripping
515                                     deplibs="$deplibs $base"
516                                 fi
517                                 missing=true
518                         fi
519                 done
520         done
521         if test x$missing = xfalse ; then
522                 # everything has been found
523                 break
524         fi
525 done
526 echo
527
528 # strip libraries
529 if test x$STRIP = xall ; then
530     echo Stripping all libraries
531     # Must be writable so that we can strip
532     find $APPLIB/ -name "*.so*" | xargs chmod u+w
533     # and strip ...
534     find $APPLIB/ -name "*.so*" | xargs strip
535 elif test x$STRIP = xsome ; then
536     echo Stripping dependent libraries
537     for l in $deplibs ; do
538         chmod u+w $APPLIB/$l
539         strip $APPLIB/$l
540     done
541 fi
542 find $APPLIB/ -name "*.so*" | xargs chmod a+rx
543
544 echo "Copying other stuff to $APPDIR  ..."
545
546 # these are all generated by waf
547 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings  $Etc
548 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
549 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
550 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
551
552 # Copied directly from source tree
553
554 cp ../../system_config $Etc/system_config
555 cp ../../gtk2_ardour/dark.colors $Etc
556 cp ../../instant.xml $Shared/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 cp -r ../../gtk2_ardour/splash.png $Shared
562 cp -r ../../gtk2_ardour/small-splash.png $Shared
563 cp -r ../../gtk2_ardour/ArdourMono.ttf $Shared
564
565 #
566 # put sooper sekrit ingredients here and they will be copied
567 #
568
569 if [ -d specialSauce ] ; then
570         cp -r specialSauce $Etc
571 fi
572
573 # install bundled LV2s to <app>/lib/LV2/
574 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
575
576 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
577 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
578         cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 $APPLIB/LV2/
579 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
580         cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 $APPLIB/LV2/
581 fi
582
583 # go through and recursively remove any .svn dirs in the bundle
584 for svndir in `find $APPDIR -name .svn -type d`; do
585         rm -rf $svndir
586 done
587
588
589 ################################################################################
590 ### Mixbus plugins, etc
591 if test -n "$MIXBUS"; then
592
593         mkdir -p $APPLIB/LV2
594         METERS_VERSION=$(curl -s -S http://gareus.org/x42/linux/x42-meters.latest.txt)
595         rsync -a -q --partial \
596                 rsync://gareus.org/x42/linux/x42-meters-lv2-${WARCH}-${METERS_VERSION}.zip \
597                 "${SRCDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
598         unzip -d "$APPLIB/LV2/" "${SRCDIR}/x42-meters-lv2-linux-${WARCH}-${METERS_VERSION}.zip"
599
600         SETBFREE_VERSION=$(curl -s -S http://gareus.org/x42/linux/setBfree.latest.txt)
601         rsync -a -q --partial \
602                 rsync://gareus.org/x42/linux/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip \
603                 "${SRCDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
604         unzip -d "$APPLIB/LV2/" "${SRCDIR}/setBfree-lv2-linux-${WARCH}-${SETBFREE_VERSION}.zip"
605
606         MIDIFILTER_VERSION=$(curl -s -S http://gareus.org/x42/linux/x42-midifilter.latest.txt)
607         rsync -a -q --partial \
608                 rsync://gareus.org/x42/linux/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip \
609                 "${SRCDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
610         unzip -d "$APPLIB/LV2/" "${SRCDIR}/x42-midifilter-lv2-linux-${WARCH}-${MIDIFILTER_VERSION}.zip"
611
612 fi
613 ################################################################################
614
615
616 if test x$WITH_HARVID != x ; then
617         cd $APPBIN
618         HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
619         XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
620
621         rsync -Pa \
622                 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
623                 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
624
625         rsync -Pa \
626                 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
627                 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
628
629         tar -x -z \
630                 --exclude=README --exclude=harvid.1 --strip-components=1 \
631                 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
632
633         tar -x -z \
634                 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
635                 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
636         mv xjadeo xjremote
637         cd -
638 fi
639
640 #
641 # Add the uninstaller
642 #
643 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
644 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
645
646 #Sanity Check file
647 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
648         cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
649 else
650         echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
651         exit 1
652 fi
653
654 echo "Building tarball ..."
655
656 rm -f $APPDIR.tar.bz2
657 tar -cjf $APPDIR.tar.bz2 $APPDIR
658
659 echo "Calculating bundle size"
660 du -sb $APPDIR/  | awk '{print $1}' > $APPDIR.size
661
662 ( cd $APPDIR ; find . ) > file_list.txt
663
664 rm -rf $APPDIR/
665
666 echo "Done."
667