Don't compress linux bundle, compress installer (with xz)
[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
473 # these are dynamically loaded by NSS
474 deplibs="libfreeblpriv3.so libsoftokn3.so libnsspem.so"
475 cp -v $GTKSTACK_ROOT/lib/libsoftokn3.so $Libraries/
476 cp -v $GTKSTACK_ROOT/lib/libfreeblpriv3.so $Libraries/
477 cp -v $GTKSTACK_ROOT/lib/libnsspem.so $Libraries/
478 chrpath -r foo $Libraries/libsoftokn3.so
479 chrpath -r foo $Libraries/libfreeblpriv3.so
480 chrpath -r foo $Libraries/libnsspem.so
481
482 while [ true ] ; do
483         missing=false
484         filelist=`find $APPLIB/ -type f`
485         filelist="$APPBIN/${EXENAME}-${release_version} $filelist"
486
487         for file in $filelist  ; do
488                 if ! file $file | grep -qs ELF ; then
489                         continue
490                 fi
491
492                 # speed this up a bit by not checking things multiple times.
493                 for i in "${depCheckedList[@]}"; do
494                         if [ $i == $file ]; then
495                                 continue 2
496                         fi
497                 done
498                 depCheckedList[$checkIdx]=$file
499                 checkIdx=$(($checkIdx + 1))
500
501                 # ignore suil/qt wrappers - the plugin will pull in QT4.
502                 if echo $file | grep -qs 'libsuil_.*qt4' ; then continue; fi
503
504                 # do not include libjack, nor libwine
505                 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | grep -v libwine.so | awk '{print $3}'`
506
507                 echo -n "."
508                 for dep in $deps ; do
509                         if test "not" = ${dep}; then
510                                 echo ""
511                                 echo "!!! ERROR !!! - Missing dependant library for $file."
512                                 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
513                                 echo ""
514                                 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
515                                 echo ""
516                                 echo "!!! ERROR !!! - See Above"
517                                 exit 1
518                         fi
519
520                         # don't use anything mapped at a specific address
521                         if echo $dep | grep -qs '0x' ; then continue; fi
522                         # don't include /lib
523                         if echo $dep | grep -qs "^/lib/" ; then continue; fi
524                         # don't include jack
525                         if echo $dep | grep -qs libjack ; then continue; fi
526                         # don't include ALSA
527                         if echo $dep | grep -qs libasound ; then continue; fi
528                         # don't include any X Window libraries
529                         if echo $dep | grep -qs libX\. ; then continue; fi
530                         if echo $dep | grep -qs libxcb ; then continue; fi
531                         if echo $dep | grep -qs libICE\. ; then continue; fi
532                         if echo $dep | grep -qs libSM\. ; then continue; fi
533                         # don't include libc
534                         if echo $dep | grep -qs 'libc\.' ; then continue; fi
535                         # don't include libstdc++
536                         if echo $dep | grep -qs libstdc++ ; then continue; fi
537                         # don't include libdbus
538                         if echo $dep | grep -qs libdbus ; then continue; fi
539
540                         base=`basename $dep`
541                         if ! test -f $Libraries/$base; then
542                                 parent=$(basename ${file})
543                                 if echo $dep | grep -sq '^libs' ; then
544                                         echo "Copying dependant lib $BUILD_ROOT/$dep    (required by ${parent})"
545                                         cp $BUILD_ROOT/$dep $Libraries
546                                 else
547                                         echo "Copying dependant lib $dep    (required by ${parent})"
548                                         cp $dep $Libraries
549                                 fi
550                                 #
551                                 # reset RPATH so that the runtime linker never looks
552                                 # in places we don't want it to
553                                 #
554                                 chrpath -r foo $Libraries/`basename $dep`
555                                 if echo $dep | grep -sq '^/' ; then
556                                     # absolute path, candidate for stripping
557                                     deplibs="$deplibs $base"
558                                 fi
559                                 missing=true
560                         fi
561                 done
562         done
563         if test x$missing = xfalse ; then
564                 # everything has been found
565                 break
566         fi
567 done
568 echo
569
570 # strip libraries
571 if test x$STRIP = xall ; then
572     echo Stripping all libraries
573     # Must be writable so that we can strip
574     find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod u+w
575     # and strip ...
576     find $APPLIB/ -name "*.so*" -print0 | xargs -0 strip -s
577 elif test x$STRIP = xsome ; then
578     echo Stripping dependent libraries
579     for l in $deplibs ; do
580         if echo "$l" | grep -qE "$NOSTRIP"; then
581             continue
582         fi
583         chmod u+w $APPLIB/$l
584         strip -s $APPLIB/$l
585     done
586 fi
587 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod a+rx
588
589 echo "Copying other stuff to $APPDIR  ..."
590
591 # these are all generated by waf
592 cp $BUILD_ROOT/gtk2_ardour/ardour.keys  $Etc
593 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
594 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
595 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
596
597 # Copied directly from source tree
598
599 mkdir ${Shared}/icons
600 mkdir ${Shared}/resources
601 cp ../../system_config $Etc/system_config
602 cp ../../instant.xml $Shared/instant.xml
603 cp ../../gtk2_ardour/icons/*.png ${Shared}/icons
604 cp -r ../../gtk2_ardour/icons/cursor_* ${Shared}/icons/
605 cp ../../gtk2_ardour/ArdourMono.ttf $Shared
606 cp ../../gtk2_ardour/resources/${APPNAME}-* ${Shared}/resources/
607
608 # Themes: only install those named for this app
609 lower_case_appname=`echo $APPNAME | tr '[:upper:]' '[:lower:]'`
610 cp ../../gtk2_ardour/themes/*-${lower_case_appname}.colors $Themes
611
612 #
613 # put sooper sekrit ingredients here and they will be copied
614 #
615
616 if [ -d specialSauce ] ; then
617         cp -r specialSauce $Etc
618 fi
619
620 # install bundled LV2s to <app>/lib/LV2/
621 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
622
623 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
624 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
625         mkdir -p $APPLIB/LV2/lv2core.lv2
626         cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
627 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
628         mkdir -p $APPLIB/LV2/lv2core.lv2
629         cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
630 fi
631
632 # go through and recursively remove any .svn dirs in the bundle
633 for svndir in `find $APPDIR -name .svn -type d`; do
634         rm -rf $svndir
635 done
636
637
638 ################################################################################
639 ### Mixbus plugins, etc
640 if test x$WITH_HARRISON_LV2 != x ; then
641         echo "Adding Harrison LV2s"
642         mkdir -p $APPLIB/LV2
643
644         curl -s -S --fail -# \
645                 -z "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
646                 -o "${CACHEDIR}/harrison_lv2s.${HARCH}.zip" \
647                 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_lv2s.${HARCH}.zip"
648         unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/harrison_lv2s.${HARCH}.zip"
649 fi
650
651 if test -n "$MIXBUS"; then
652         echo "Adding Mixbus Channelstrip"
653
654         mkdir -p $APPLIB/ladspa/strip/
655         curl -s -S --fail -# \
656                 -z "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${HARCH}.so" \
657                 -o "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${HARCH}.so" \
658                 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/${HARRISONCHANNELSTRIP}.${HARCH}.so"
659
660         cp "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${HARCH}.so" \
661                 $APPLIB/ladspa/strip/${HARRISONCHANNELSTRIP}.so
662         chmod +x $APPLIB/ladspa/strip/${HARRISONCHANNELSTRIP}.so
663
664         echo "Adding Harrison Vamp Plugins"
665
666         if test "$GCC5ABI" = "true"; then
667                 VAMPARCH="${HARCH}gcc5"
668         else
669                 VAMPARCH="${HARCH}"
670         fi
671         curl -s -S --fail -# \
672                 -z "${CACHEDIR}/harrison_vamp.${VAMPARCH}.so" \
673                 -o "${CACHEDIR}/harrison_vamp.${VAMPARCH}.so" \
674                 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_vamp.${VAMPARCH}.so"
675
676         cp "${CACHEDIR}/harrison_vamp.${VAMPARCH}.so" \
677                 $APPLIB/harrison_vamp.so
678         chmod +x $APPLIB/harrison_vamp.so
679 fi
680
681 if test x$WITH_X42_LV2 != x ; then
682         mkdir -p $APPLIB/LV2
683
684         echo "Adding x42 Plugins"
685
686         for proj in x42-meters x42-midifilter x42-midimap x42-stereoroute x42-eq setBfree; do
687                 X42_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/${proj}.latest.txt)
688                 rsync -a -q --partial \
689                         rsync://x42-plugins.com/x42/linux/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip \
690                         "${CACHEDIR}/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip"
691                 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip"
692         done
693 fi
694 ################################################################################
695
696
697 if test x$WITH_HARVID != x ; then
698         cd $APPBIN
699         HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
700         XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
701
702         rsync -Pa \
703                 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
704                 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
705
706         rsync -Pa \
707                 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
708                 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
709
710         tar -x -z \
711                 --exclude=README --exclude=harvid.1 --strip-components=1 \
712                 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
713
714         tar -x -z \
715                 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
716                 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
717         mv xjadeo xjremote
718         cd -
719 fi
720
721 #
722 # Add the uninstaller
723 #
724 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
725 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
726
727 #
728 # Add the stage2.run script
729 #
730 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
731 chmod a+x stage2.run
732
733
734 #Sanity Check file
735 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
736         cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
737 else
738         echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
739         exit 1
740 fi
741
742 echo "Building tarball ..."
743
744 rm -f $APPDIR.tar
745 tar -cf $APPDIR.tar $APPDIR
746
747 echo "Calculating bundle size"
748 du -sb $APPDIR/  | awk '{print $1}' > $APPDIR.size
749
750 ( cd $APPDIR ; find . ) > file_list.txt
751
752 rm -rf $APPDIR/
753
754 echo "Done."
755