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