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