File: deploy.sh

package info (click to toggle)
sonic-visualiser 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,744 kB
  • sloc: cpp: 158,888; ansic: 11,920; sh: 1,785; makefile: 517; xml: 64; perl: 31
file content (116 lines) | stat: -rwxr-xr-x 3,070 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash

set -e

# Execute this from the top-level directory of the project (the one
# that contains the .app bundle).  Supply the name of the application
# as argument.
#
# This now performs *only* the app deployment step - copying in
# libraries and setting up paths etc. It does not create a
# package. Use deploy-and-package.sh for that.

usage() {
    echo
    echo "Usage: $0 <app> [<builddir>]"
    echo
    echo "  where <builddir> defaults to \"build\""
    echo 
    echo "For example,"
    echo
    echo "  \$ $0 MyApplication"
    echo "  to deploy app MyApplication built in the directory \"build\""
    echo
    echo "  \$ $0 MyApplication build-release"
    echo "  to deploy app MyApplication built in the directory \"build-release\""
    echo
    echo "The executable must be already present in <builddir>/<app>, and its"
    echo "version number will be extracted from <builddir>/version.h."
    echo 
    echo "In all cases the target will be an app bundle called <app>.app in"
    echo "the current directory."
    echo
    exit 2
}

app="$1"
if [ -z "$app" ]; then
    usage
fi

builddir="$2"
if [ -z "$builddir" ]; then
    builddir=build
elif [ -n "$3" ]; then
    usage
fi

if [ ! -f "$builddir/$app" ]; then
    echo "File $app not found in builddir $builddir"
    exit 2
fi

source="$app.app"

set -u

mkdir -p "$source/Contents/MacOS"
mkdir -p "$source/Contents/Resources"

cp -a "$builddir/$app" "$source/Contents/MacOS"

version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' $builddir/version.h`
stem=${version%%-*}
stem=${stem%%pre*}
case "$stem" in
    [0-9].[0-9]) bundleVersion="$stem".0 ;;
    [0-9].[0-9].[0-9]) bundleVersion="$stem" ;;
    *) echo "Error: Version stem $stem (of version $version) is neither two- nor three-part number" ;;
esac

echo
echo "Copying in icon."

cp "icons/sv-macicon.icns" "$source/Contents/Resources"


echo
echo "Copying in frameworks and plugins from Qt installation directory."

deploy/macos/copy-qt.sh "$app" || exit 2

echo
echo "Fixing up paths."

deploy/macos/paths.sh "$app"

echo
echo "Copying in qt.conf to set local-only plugin paths."
echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*"
echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
cp deploy/macos/qt.conf "$source"/Contents/Resources/qt.conf

echo
echo "Copying in plugin load checker."
cp $builddir/vamp-plugin-load-checker "$source"/Contents/MacOS/

echo
echo "Copying in plugin server."
cp $builddir/piper-vamp-simple-server "$source"/Contents/MacOS/

echo
echo "Copying in piper convert tool."
cp $builddir/piper-convert "$source"/Contents/MacOS/

echo
echo "Copying in lproj directories containing InfoPlist.strings translation files."
cp -r i18n/*.lproj "$source"/Contents/Resources/

echo
echo "Writing version $bundleVersion in to bundle."
echo "(This should be a three-part number: major.minor.point)"

perl -p -e "s/SV_VERSION/$bundleVersion/" deploy/macos/Info.plist \
    > "$source"/Contents/Info.plist

echo "Done: check $source/Contents/Info.plist for sanity please"