-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·88 lines (72 loc) · 1.97 KB
/
build.sh
File metadata and controls
executable file
·88 lines (72 loc) · 1.97 KB
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
#!/bin/bash
set -eu
die () {
echo "$*" >&2
exit 1
}
echo "Building Packaging.Linux..."
# Directories
THISDIR="$( cd "$(dirname "$0")" || exit 1 ; pwd -P )"
ROOT="$( cd "$THISDIR"/../../.. || exit 1 ; pwd -P )"
SRC="$ROOT/src"
OUT="$ROOT/out"
INSTALLER_SRC="$SRC/linux/Packaging.Linux"
INSTALLER_OUT="$OUT/linux/Packaging.Linux"
# Parse script arguments
for i in "$@"
do
case "$i" in
--configuration=*)
CONFIGURATION="${i#*=}"
shift # past argument=value
;;
--version=*)
VERSION="${i#*=}"
shift # past argument=value
;;
--install-from-source=*)
INSTALL_FROM_SOURCE="${i#*=}"
shift # past argument=value
;;
--install-prefix=*)
INSTALL_PREFIX="${i#*=}"
shift # past argument=value
;;
*)
# unknown option
;;
esac
done
# Ensure install prefix exists
if [ ! -d "$INSTALL_PREFIX" ]; then
mkdir -p "$INSTALL_PREFIX"
fi
# Perform pre-execution checks
CONFIGURATION="${CONFIGURATION:=Debug}"
if [ -z "$VERSION" ]; then
die "--version was not set"
fi
OUTDIR="$INSTALLER_OUT/$CONFIGURATION"
PAYLOAD="$OUTDIR/payload"
SYMBOLS="$OUTDIR/payload.sym"
# Lay out payload
"$INSTALLER_SRC/layout.sh" --configuration="$CONFIGURATION" || exit 1
if [ "$INSTALL_FROM_SOURCE" = true ]; then
echo "Installing to $INSTALL_PREFIX"
# Install directories
INSTALL_TO="$INSTALL_PREFIX/share/gcm-core/"
LINK_TO="$INSTALL_PREFIX/bin/"
mkdir -p "$INSTALL_TO" "$LINK_TO"
# Copy all binaries and shared libraries to target installation location
cp -R "$PAYLOAD"/* "$INSTALL_TO" || exit 1
# Create symlink
if [ ! -f "$LINK_TO/git-credential-manager" ]; then
ln -s -r "$INSTALL_TO/git-credential-manager" \
"$LINK_TO/git-credential-manager" || exit 1
fi
echo "Install complete."
else
# Pack
"$INSTALLER_SRC/pack.sh" --configuration="$CONFIGURATION" --payload="$PAYLOAD" --symbols="$SYMBOLS" --version="$VERSION" || exit 1
fi
echo "Build of Packaging.Linux complete."