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