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