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