-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-doc-src
executable file
·81 lines (67 loc) · 1.92 KB
/
install-doc-src
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
#!/bin/bash
set -eu
install_corto_fail() {
echo "Installation failed :("
}
clone_repo() {
if [ ! -d "$1" ]; then
echo "Cloning $1..."
git clone -q "https://github.com/cortoproject/${1}.git"
else
(
cd "$1"
echo "Reset $1..."
git fetch -q origin
git reset -q --hard origin/master
git clean -q -xdf
)
fi
}
install_corto () {
UNAME=$(uname)
INSTALL_TMPDIR="$HOME/bake/src"
# Check supported OS
if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ]; then
>&2 echo "Sorry, this OS is not supported yet!"
exit 1
fi
if [ "$UNAME" = "Darwin" ]; then
if [ "i386" != "$(uname -p)" ] || [ "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ]; then
>&2 echo "corto: only 64-bit Intel processors are supported at this time!"
exit 1
fi
fi
if [ "$UNAME" = "Linux" ]; then
sudo apt-get -y install git build-essential libffi-dev libxml2-dev
elif [ "$UNAME" = "Darwin" ]; then
if ! pkgutil --pkg-info=com.apple.pkg.CLTools_Executables; then
echo "Looks like Xcode command-line tools are not installed. Run:"
echo " sudo xcode-select --install"
echo
echo "Then try installing corto again!"
exit -1
fi
fi
set -e
trap install_corto_fail EXIT
echo
echo "Installing corto, this should just take a minute..."
# Create 'src' directory in corto
mkdir -p "$INSTALL_TMPDIR"
cd "$INSTALL_TMPDIR"
echo "Cloning cortodoc packages"
clone_repo "driver-tool-doc"
clone_repo "driver-ext-md"
clone_repo "driver-gen-doc-html"
clone_repo "driver-gen-doc-doxygen"
# Build projects
echo "Build projects"
bake
echo
corto --logo
echo
echo "Cortodoc packages successfully installed!"
echo
trap - EXIT
}
install_corto