Only show user-presets in favorite sidebar
[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/plugins/releases/public}
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 lower_case_appname=`echo $APPNAME | tr '[:upper:]' '[:lower:]'`
123
124 echo "Version is $release_version"
125 if [ "x$commit" != "x" ] ; then
126     info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
127 else
128     info_string="$release_version built on `hostname` by `whoami` on `date`"
129 fi
130 echo "Info string is $info_string"
131
132 # Figure out our CPU type
133 case `uname -m` in
134         i[3456789]86|x86|i86pc)
135                 echo "Architecture is x86"
136                 ARCH='x86'
137                 WARCH='i386'
138                 HARCH='linux32'
139                 ARCH_BITS='32-bit'
140                 MULTIARCH='i386-linux-gnu'
141                 ;;
142         x86_64|amd64|AMD64)
143                 echo "Architecture is x86_64"
144                 ARCH='x86_64'
145                 WARCH='x86_64'
146                 HARCH='linux64'
147                 ARCH_BITS='64-bit'
148                 MULTIARCH='x86_64-linux-gnu'
149                 ;;
150         *)
151                 echo ""
152                 echo "ERROR - Unknown architecture `uname -m`"
153                 echo ""
154                 exit 1
155                 ;;
156 esac
157
158 if [ x$DEBUG = xT ]; then
159     BUILDTYPE="dbg"
160     if [ x$STRIP = xall ] ; then
161         echo "A debug build with --strip all makes no sense - STRIP reset to \"some\""
162         STRIP=some
163     fi
164 fi
165
166 # setup directory structure
167
168 if [ -z "${BUILDTYPE}" ]; then
169         APPDIR=${APPNAME}_${ARCH}-${release_version}
170         APP_VER_NAME=${APPNAME}-${release_version}
171 else
172         APPDIR=${APPNAME}_${ARCH}-${release_version}-${BUILDTYPE}
173         APP_VER_NAME=${APPNAME}-${release_version}-${BUILDTYPE}
174 fi
175
176 APPBIN=$APPDIR/bin
177 APPLIB=$APPDIR/lib
178 Libraries=$APPLIB
179 Etc=$APPDIR/etc
180 Shared=$APPDIR/share
181
182 Plugins=$APPLIB/plugins
183 Surfaces=$APPLIB/surfaces
184 Panners=$APPLIB/panners
185 Backends=$APPLIB/backends
186
187 Themes=$Shared/themes
188 Templates=$Shared/templates
189 PluginMetadata=$Shared/plugin_metadata
190 ExportFormats=$Shared/export
191 Locale=$Shared/locale
192 MidiMaps=$Shared/midi_maps
193 PatchFiles=$Shared/patchfiles
194 LuaScripts=$Shared/scripts
195 MackieControl=$Shared/mcp
196 OSC=$Shared/osc
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 $OSC
232 mkdir -p $ExportFormats
233 mkdir -p $Panners
234 mkdir -p $Backends
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 # Control Surfaces
364 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.so* $Surfaces
365 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp.so* $Libraries
366
367 # MidiMaps
368 # got to be careful with names here
369 for x in $BUILD_ROOT/../midi_maps/*.map ; do
370     cp "$x" $MidiMaps
371 done
372
373 # MIDNAM Patch Files
374 # got to be careful with names here
375 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
376     cp "$x" $PatchFiles
377 done
378
379 # Lua Scripts Files
380 # got to be careful with names here
381 for x in $BUILD_ROOT/../scripts/*.lua ; do
382                 BN=$(basename $x)
383           if test "${BN:0:1}" = "_"; then
384                         continue;
385                 fi
386     cp "$x" $LuaScripts
387 done
388
389 # MackieControl data
390 # got to be careful with names here
391 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
392     cp "$x" $MackieControl
393 done
394
395 # OSC data
396 # got to be careful with names here
397 for x in $BUILD_ROOT/../osc/*.preset ; do
398     cp "$x" $OSC
399 done
400
401 #Session templates
402 cp -av $BUILD_ROOT/../templates $Templates
403
404 # PluginMetadata
405 cp -av $BUILD_ROOT/../plugin_metadata $PluginMetadata
406
407 # ExportFormats
408 # got to be careful with names here
409 for x in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
410     cp "$x" $ExportFormats
411 done
412
413 # Panners
414 cp $BUILD_ROOT/libs/panners/*/lib*.so* $Panners
415
416 # Backends
417 for backend in jack alsa dummy wavesaudio ; do
418     cp $BUILD_ROOT/libs/backends/$backend/lib*.so* $Backends
419 done
420
421 # VAMP plugins that we use
422 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.so* $Libraries
423
424 # Suil modules (new dir 'build-stack')
425 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
426     cp $GTKSTACK_ROOT/lib/suil-0/lib* $Libraries
427 fi
428
429 # Suil modules (old dir 'build-ardour-stack')
430 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
431     cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Libraries
432 fi
433
434 # VST scanner app (both LXVST as well as WIN-VST, 2in1)
435 # (if build with wine: ardour-vst-scanner is a wrapper
436 #  script for ardour-vst-scanner.exe.so, if VST is disabled
437 #  neither binary nor script exists)
438 if test -d $BUILD_ROOT/libs/fst ; then
439     cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $APPLIB || true
440     if test x$STRIP = xall ; then
441         strip -s $APPLIB/ardour-vst-scanner*
442     fi
443 fi
444
445 # vfork wrapper
446 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
447     cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $APPLIB
448     if test x$STRIP = xall ; then
449         strip -s $APPLIB/ardour-exec-wrapper
450     fi
451 fi
452
453 # ALSA device reservation tool (if available)
454 if test -f $BUILD_ROOT/libs/ardouralsautil/ardour-request-device; then
455     cp $BUILD_ROOT/libs/ardouralsautil/ardour-request-device $APPLIB/ || true
456     if test x$STRIP = xall ; then
457         strip -s $APPLIB/ardour-request-device
458     fi
459 fi
460
461 # session-utils
462 HAVE_SESSION_UTILS=false
463 for file in $BUILD_ROOT/session_utils/${lower_case_appname}${major_version}-*; do
464         BN=$(basename $file)
465         cp -v $file $APPLIB/
466         if test x$STRIP = xall ; then
467                 strip -s $APPLIB/${BN}
468         fi
469         ln -s ../lib/ardour-util.sh $APPBIN/${BN}
470         HAVE_SESSION_UTILS=true
471 done
472
473 if test "$HAVE_SESSION_UTILS" = true ; then
474         cat >> $APPLIB/ardour-util.sh << EOF
475 #!/bin/sh
476
477 BIN_DIR=\$(dirname \$(readlink -f \$0))
478 INSTALL_DIR=\$(dirname \$BIN_DIR)
479
480 export LD_LIBRARY_PATH=\$INSTALL_DIR/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}
481
482 export ARDOUR_DATA_PATH=\$INSTALL_DIR/share
483 export ARDOUR_CONFIG_PATH=\$INSTALL_DIR/etc
484 export ARDOUR_DLL_PATH=\$INSTALL_DIR/lib
485 export VAMP_PATH=\$INSTALL_DIR/lib\${VAMP_PATH:+:\$VAMP_PATH}
486
487 SELF=\$(basename \$0)
488 exec "\$INSTALL_DIR/lib/\$SELF" "\$@"
489 EOF
490         chmod +x $APPLIB/ardour-util.sh
491 fi
492
493 OURLIBDIR=$BUILD_ROOT/libs
494 OURLIBS=$OURLIBDIR/surfaces/control_protocol:$OURLIBDIR/ardour:$OURLIBDIR/midi++2:$OURLIBDIR/pbd:$OURLIBDIR/gtkmm2ext:$OURLIBDIR/glibmm2:$OURLIBDIR/canvas:$OURLIBDIR/widgets:$OURLIBDIR/waveview:$OURLIBDIR/evoral:$OURLIBDIR/evoral/src/libsmf:$OURLIBDIR/audiographer:$OURLIBDIR/temporal:$OURLIBDIR/libltc:$OURLIBDIR/qm-dsp:$OURLIBDIR/ardouralsautil:$OURLIBDIR/ptformat:$BUILD_ROOT/gtk2_ardour
495
496 echo $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
497
498 checkedIdx=0
499
500 # these are dynamically loaded by NSS
501 deplibs="libfreeblpriv3.so libsoftokn3.so libnsspem.so"
502 cp -v $GTKSTACK_ROOT/lib/libsoftokn3.so $Libraries/
503 cp -v $GTKSTACK_ROOT/lib/libfreeblpriv3.so $Libraries/
504 cp -v $GTKSTACK_ROOT/lib/libnsspem.so $Libraries/
505 chrpath -r foo $Libraries/libsoftokn3.so
506 chrpath -r foo $Libraries/libfreeblpriv3.so
507 chrpath -r foo $Libraries/libnsspem.so
508
509 while [ true ] ; do
510         missing=false
511         filelist=`find $APPLIB/ -type f`
512         filelist="$APPBIN/${EXENAME}-${release_version} $filelist"
513
514         for file in $filelist  ; do
515                 if ! file $file | grep -qs ELF ; then
516                         continue
517                 fi
518
519                 # speed this up a bit by not checking things multiple times.
520                 for i in "${depCheckedList[@]}"; do
521                         if [ $i == $file ]; then
522                                 continue 2
523                         fi
524                 done
525                 depCheckedList[$checkIdx]=$file
526                 checkIdx=$(($checkIdx + 1))
527
528                 # ignore suil/qt wrappers - the plugin will pull in QT4.
529                 if echo $file | grep -qs 'libsuil_.*qt[45]' ; then continue; fi
530
531                 # do not include libjack, nor libwine
532                 deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | grep -v libwine.so | awk '{print $3}'`
533
534                 echo -n "."
535                 for dep in $deps ; do
536                         if test "not" = ${dep}; then
537                                 echo ""
538                                 echo "!!! ERROR !!! - Missing dependant library for $file."
539                                 echo "Searched: " $OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
540                                 echo ""
541                                 (LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file)
542                                 echo ""
543                                 echo "!!! ERROR !!! - See Above"
544                                 exit 1
545                         fi
546
547                         # don't use anything mapped at a specific address
548                         if echo $dep | grep -qs '0x' ; then continue; fi
549                         # don't include /lib
550                         if echo $dep | grep -qs "^/lib/" ; then continue; fi
551                         # don't include jack
552                         if echo $dep | grep -qs libjack ; then continue; fi
553                         # don't include ALSA
554                         if echo $dep | grep -qs libasound ; then continue; fi
555                         # don't include any X Window libraries
556                         if echo $dep | grep -qs libX\. ; then continue; fi
557                         if echo $dep | grep -qs libxcb ; then continue; fi
558                         if echo $dep | grep -qs libICE\. ; then continue; fi
559                         if echo $dep | grep -qs libSM\. ; then continue; fi
560                         # don't include libc
561                         if echo $dep | grep -qs 'libc\.' ; then continue; fi
562                         # don't include libstdc++
563                         if echo $dep | grep -qs libstdc++ ; then continue; fi
564                         # don't include libdbus (alsa request device)
565                         if echo $dep | grep -qs libdbus ; then continue; fi
566                         # nor libudev (hidapi)
567                         if echo $dep | grep -qs libudev ; then continue; fi
568
569                         base=`basename $dep`
570                         if ! test -f $Libraries/$base; then
571                                 parent=$(basename ${file})
572                                 if echo $dep | grep -sq '^libs' ; then
573                                         echo "Copying dependant lib $BUILD_ROOT/$dep    (required by ${parent})"
574                                         cp $BUILD_ROOT/$dep $Libraries
575                                 else
576                                         echo "Copying dependant lib $dep    (required by ${parent})"
577                                         cp $dep $Libraries
578                                 fi
579                                 #
580                                 # reset RPATH so that the runtime linker never looks
581                                 # in places we don't want it to
582                                 #
583                                 chrpath -r foo $Libraries/`basename $dep`
584                                 if echo $dep | grep -sq '^/' ; then
585                                     # absolute path, candidate for stripping
586                                     deplibs="$deplibs $base"
587                                 fi
588                                 missing=true
589                         fi
590                 done
591         done
592         if test x$missing = xfalse ; then
593                 # everything has been found
594                 break
595         fi
596 done
597 echo
598
599 # strip libraries
600 if test x$STRIP = xall ; then
601     echo Stripping all libraries
602     # Must be writable so that we can strip
603     find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod u+w
604     # and strip ...
605     find $APPLIB/ -name "*.so*" -print0 | xargs -0 strip -s
606 elif test x$STRIP = xsome ; then
607     echo Stripping dependent libraries
608     for l in $deplibs ; do
609         if echo "$l" | grep -qE "$NOSTRIP"; then
610             continue
611         fi
612         chmod u+w $APPLIB/$l
613         strip -s $APPLIB/$l
614     done
615 fi
616 find $APPLIB/ -name "*.so*" -print0 | xargs -0 chmod a+rx
617
618 echo "Copying other stuff to $APPDIR  ..."
619
620 # these are all generated by waf
621 cp $BUILD_ROOT/gtk2_ardour/ardour.keys  $Etc
622 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Etc
623 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Etc
624 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Etc
625
626 # Copied directly from source tree
627
628 mkdir ${Shared}/icons
629 mkdir ${Shared}/resources
630 cp ../../system_config $Etc/system_config
631 cp ../../gtk2_ardour/icons/*.png ${Shared}/icons
632 cp -r ../../gtk2_ardour/icons/cursor_* ${Shared}/icons/
633 cp ../../gtk2_ardour/ArdourMono.ttf $Shared
634 cp ../../gtk2_ardour/resources/${APPNAME}-* ${Shared}/resources/
635
636 # Themes: only install those named for this app
637 cp ../../gtk2_ardour/themes/*-${lower_case_appname}.colors $Themes
638
639 #
640 # put sooper sekrit ingredients here and they will be copied
641 #
642
643 if [ -d specialSauce ] ; then
644         cp -r specialSauce $Etc
645 fi
646
647 # install bundled LV2s to <app>/lib/LV2/
648 cp -R $BUILD_ROOT/libs/LV2 $APPLIB/
649
650 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
651 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
652         mkdir -p $APPLIB/LV2/lv2core.lv2
653         cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
654 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
655         mkdir -p $APPLIB/LV2/lv2core.lv2
656         cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2/*.ttl $APPLIB/LV2/lv2core.lv2/
657 fi
658
659 # go through and recursively remove any .svn dirs in the bundle
660 for svndir in `find $APPDIR -name .svn -type d`; do
661         rm -rf $svndir
662 done
663
664
665 ################################################################################
666 ### Mixbus plugins, etc
667 if test x$WITH_HARRISON_LV2 != x ; then
668         echo "Adding Harrison LV2s"
669         mkdir -p $APPLIB/LV2
670
671         curl -s -S --fail -# \
672                 -z "${CACHEDIR}/${HARRISONLV2}.${HARCH}.zip" \
673                 -o "${CACHEDIR}/${HARRISONLV2}.${HARCH}.zip" \
674                 "${HARRISONDSPURL}/${HARRISONLV2}.${HARCH}.zip"
675         unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/${HARRISONLV2}.${HARCH}.zip"
676 fi
677
678 if test -n "$MIXBUS"; then
679         echo "Adding Mixbus Channelstrip"
680
681         mkdir -p $APPLIB/ladspa/strip/
682         curl -s -S --fail -# \
683                 -z "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${HARCH}.so" \
684                 -o "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${HARCH}.so" \
685                 "${HARRISONDSPURL}/${HARRISONCHANNELSTRIP}.${HARCH}.so"
686
687         cp "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${HARCH}.so" \
688                 $APPLIB/ladspa/strip/${HARRISONCHANNELSTRIP}.so
689         chmod +x $APPLIB/ladspa/strip/${HARRISONCHANNELSTRIP}.so
690
691         echo "Adding Harrison Vamp Plugins"
692
693         if test "$GCC5ABI" = "true"; then
694                 VAMPARCH="${HARCH}gcc5"
695         else
696                 VAMPARCH="${HARCH}"
697         fi
698         curl -s -S --fail -# \
699                 -z "${CACHEDIR}/harrison_vamp.${VAMPARCH}.so" \
700                 -o "${CACHEDIR}/harrison_vamp.${VAMPARCH}.so" \
701                 "${HARRISONDSPURL}/harrison_vamp.${VAMPARCH}.so"
702
703         cp "${CACHEDIR}/harrison_vamp.${VAMPARCH}.so" \
704                 $APPLIB/harrison_vamp.so
705         chmod +x $APPLIB/harrison_vamp.so
706 fi
707
708 if true ; then
709         mkdir -p $APPLIB/LV2
710
711         echo "Adding General MIDI Synth LV2"
712
713         for proj in x42-gmsynth ; do
714                 X42_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/${proj}.latest.txt)
715                 rsync -a -q --partial \
716                         rsync://x42-plugins.com/x42/linux/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip \
717                         "${CACHEDIR}/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip"
718                 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip"
719         done
720 fi
721
722
723 if test x$WITH_X42_LV2 != x ; then
724         mkdir -p $APPLIB/LV2
725
726         echo "Adding x42 Plugins"
727
728         for proj in x42-meters x42-midifilter x42-midimap x42-stereoroute x42-eq setBfree x42-avldrums x42-whirl x42-limiter; do
729                 X42_VERSION=$(curl -s -S http://x42-plugins.com/x42/linux/${proj}.latest.txt)
730                 rsync -a -q --partial \
731                         rsync://x42-plugins.com/x42/linux/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip \
732                         "${CACHEDIR}/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip"
733                 unzip -q -d "$APPLIB/LV2/" "${CACHEDIR}/${proj}-lv2-linux-${WARCH}-${X42_VERSION}.zip"
734         done
735 fi
736
737 ################################################################################
738
739 if test x$WITH_HARVID != x ; then
740         cd $APPBIN
741         HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
742         XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
743
744         rsync -Pa \
745                 rsync://ardour.org/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \
746                 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
747
748         rsync -Pa \
749                 rsync://ardour.org/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \
750                 "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz"
751
752         tar -x -z \
753                 --exclude=README --exclude=harvid.1 --strip-components=1 \
754                 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
755
756         tar -x -z \
757                 --exclude=README --exclude=xjadeo.1 --strip-components=1 \
758                 -f "$CACHEDIR/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz" || exit 1
759         mv xjadeo xjremote
760         cd -
761 fi
762
763 ################################################################################
764
765 if test x$DEMO_SESSION_URL != x ; then
766         mkdir -p $Shared/sessions
767         DEMO_SESSIONS=$(curl -s -S --fail $DEMO_SESSION_URL/index.txt)
768         for demo in $DEMO_SESSIONS; do
769                 curl -s -S --fail -# -o $Shared/sessions/$demo $DEMO_SESSION_URL/$demo
770         done
771 fi
772
773 ################################################################################
774
775 #
776 # Add the uninstaller
777 #
778 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
779 chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh
780
781 #
782 # Add the stage2.run script
783 #
784 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
785 chmod a+x stage2.run
786
787
788 #Sanity Check file
789 if [ -e $BUILD_ROOT/tools/sanity_check/sanityCheck ]; then
790         cp $BUILD_ROOT/tools/sanity_check/sanityCheck $APPBIN
791 else
792         echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete"
793         exit 1
794 fi
795
796 echo "Building tarball ..."
797
798 rm -f $APPDIR.tar
799 tar -cf $APPDIR.tar $APPDIR
800
801 echo "Calculating bundle size"
802 du -sb $APPDIR/  | awk '{print $1}' > $APPDIR.size
803
804 ( cd $APPDIR ; find . ) > file_list.txt
805
806 rm -rf $APPDIR/
807
808 echo "Done."
809