forked from Justasic/RTCW-SP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·111 lines (102 loc) · 3.5 KB
/
configure
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
#!/bin/sh
# This is a simple script written to try and satisfy the dependency for cmake.
# it is also used as a place holder for traditional build systems based on
# autoconf which have a ./configure file in the directory.
# This script is licensed under the GNU GPL (see COPYING.txt for details)
BUILDTYPE="RELEASE"
# Ran once a cmake configure is complete.
finished() {
echo ""
echo "======================"
echo "Configuring complete!"
echo "Now type \"cd build/\" and then type make or gmake"
echo "depending on your platform. This will start the"
echo "build process, once complete, run sudo make install"
echo "and this will install to /opt/"
echo "======================"
}
if command -v cmake >/dev/null 2>&1; then
mkdir -p build/
cd build/
while true; do
read -p "Which build type do you want to build for [Release/Debug/Demo]? " yn
case $yn in
*[Rr][Ee][Ll][Ee][Aa][Ss][Ee]* ) BUILDTYPE="RELEASE"; break;;
*[Dd][Ee][Mm][Oo]* ) BUILDTYPE="DEMO"; break;;
*[Dd][Ee][Bb][Uu][Gg]* ) BUILDTYPE="DEBUG"; break;;
* ) echo "Auto-selected $BUILDTYPE release";;
esac
done
echo "Building for $BUILDTYPE..."
cmake -DCMAKE_BUILD_TYPE:STRING=$BUILDTYPE -DCMAKE_INSTALL_PREFIX:STRING="/opt/wolfsp" .. && finished
exit 0
else
# Complicated mess to try and satisfy the cmake dependency, once we have cmake, the world will be a better place
echo >&2 "CMake version 1.8 or better is required to compile!"
# check and see if we need sudo
if command -v sudo >/dev/null 2>&1; then
SUDO='sudo'
else
SUDO=''
fi
# Now do the awful detection of package managers!
if command -v yum >/dev/null 2>&1; then
while true; do
read -p "Yum detected on this system, would you like me to install cmake via yum [y/n]? " yn
case $yn in
[Yy]* ) $SUDO yum install cmake; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
else
if command -v apt-get >/dev/null 2>&1; then
while true; do
read -p "apt-get detected on this system, would you like me to install cmake via apt-get [y/n]? " yn
case $yn in
[Yy]* ) $SUDO apt-get install cmake; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
else
if command -v pacman >/dev/null 2>&1; then
while true; do
read -p "pacman detected on this system, would you like me to install cmake via pacman [y/n]? " yn
case $yn in
[Yy]* ) $SUDO pacman -S cmake; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
else
if command -v pkg_add >/dev/null 2>&1; then
while true; do
read -p "pkg_add detected on this system, would you like me to install cmake via pkg [y/n]? " yn
case $yn in
[Yy]* ) $SUDO pkg_add -r cmake; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
else
echo "Could not find a suitable package manager!"
echo "Please install or compile cmake and make sure it can be found via \$PATH"
exit 1
fi
fi
fi
fi
fi
# Stupid fucking bash doesnt have a god damn goto statement and people seem to have their
# head in their ass about it, thanks asshats, now I have to make more shitty code for a simple
# script because you didn't like people making shitty code. Thanks.
if command -v cmake >/dev/null 2>&1; then
mkdir -p build/
cd build/
cmake .. && finished
else
echo "There seems to be an issue with the system and how CMake is installed!"
echo "Please make sure CMake is installed and can be found via \$PATH then"
echo "re-run ./configure"
fi