-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_sfml
executable file
·60 lines (48 loc) · 1.23 KB
/
install_sfml
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
#/bin/bash
# This script installs SFML. It detects whether the user is
# running Linux or macOS.
# _log prints its first argument to the standard output, if the
# global variable verbose is set to true. If it is false, it does
# nothing.
_log() {
if [ $verbose = true ]; then
printf "$1"
fi
}
### Actual beginning.
set -e
verbose=false
if [[ "$1" = "-v" || "$1" = "--verbose" ]]; then
verbose=true
fi
if [ -d "sfml" ]; then
printf "install_sfml: sfml directory already exists\n"
exit 1
else
printf "install_sfml: creating sfml directory..."
mkdir sfml
printf "ok\n"
fi
download_url="null"
case "$(uname -s)" in
Linux*)
download_url="https://www.sfml-dev.org/files/SFML-2.5.1-linux-gcc-64-bit.tar.gz"
_log "install_sfml: detected Linux host\n"
;;
Darwin*)
download_url="https://www.sfml-dev.org/files/SFML-2.5.1-macOS-clang.tar.gz"
_log "install_sfml: detected macOS host\n"
;;
*)
printf "install_sfml: error: unknown operating system\n"
exit 1
;;
esac
_log "install_sfml: downloading SFML..."
curl -Ss "$download_url" > sfml.tar.gz
_log "ok\n"
_log "install_sfml: extracting SFML..."
tar -xzf sfml.tar.gz --strip-components 1 -C sfml
_log "ok\n"
rm sfml.tar.gz
printf "install_sfml: done\n"