-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-release-src
executable file
·132 lines (115 loc) · 3.72 KB
/
install-release-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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/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"
# Install bake
echo "Cloning bake repositories"
clone_repo "bake"
echo "Installing bake"
make -C bake/build-$UNAME
bake/bake setup
# Corto repository is now downloaded. Download remaining essential packages
echo "Cloning essential corto packages"
clone_repo "bake-corto"
clone_repo "corto"
clone_repo "corto-tool"
clone_repo "corto-util-argparse"
clone_repo "parson"
clone_repo "driver-tool-create"
clone_repo "driver-tool-default"
clone_repo "driver-tool-test"
clone_repo "driver-tool-sh"
clone_repo "corto-util-cdiff"
clone_repo "corto-g"
clone_repo "driver-tool-pp"
clone_repo "c-binding"
clone_repo "driver-fmt-json"
clone_repo "driver-ext-json"
clone_repo "driver-fmt-xml"
clone_repo "driver-ext-xml"
clone_repo "antlr4-cpp"
clone_repo "corto-script-parser"
clone_repo "corto-script-ast"
clone_repo "corto-script-declare"
clone_repo "driver-ext-corto"
clone_repo "corto-test"
clone_repo "corto-tags"
clone_repo "corto-units"
clone_repo "corto-range"
# Build projects
echo "Build projects"
bake bake-corto --build-to-home
bake --cfg release
export $(bake env)
echo
corto --logo
echo
echo "Corto $(corto --minor) successfully installed!"
echo
echo "You have installed a release version. This means that corto has been"
echo "built with optimizations to run as fast as possible, awesome! The downside"
echo "is that it is harder to debug, as certain features to spot errors"
echo "early on are disabled. We recommend to use a debug version when you"
echo "develop corto apps. To install a dev version from source, do:"
echo " $ curl https://corto.io/install-dev-src | sh"
echo
echo "Get started by creating your first project! First, make sure your bake"
echo "environment is exported to your terminal:"
echo " $ export \$(bake env)"
echo
echo "To now create a new project, run this command:"
echo " $ corto create my_app"
echo
echo "To run your project, you can run this command:"
echo " $ bake run my_app"
echo
trap - EXIT
}
install_corto