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