-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure
executable file
·79 lines (66 loc) · 2.86 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
#!/bin/bash
die() {
echo -e "$@"
exit 1
}
MAKE=${MAKE-make}
CMAKE=${CMAKE-cmake}
PACKAGE=divine-mc
test -e configure.vars && source ./configure.vars
test -d _darcs && DARCS=true
$DARCS || test -f manifest || die \
"Sorry, the file \"manifest\" appears to be missing from the distribution;\n\
please make sure you are running this script in the source directory."
cat manifest 2> /dev/null | while read; do
test -e "$REPLY" || die \
"Sorry, but file \"$REPLY\" appears to be missing from the distribution;\nplease make sure your tarball is complete.";
done
do_cmake_inst() {
CMAKE_VER=2.6.4;
CMAKE_DIR="cmake-$CMAKE_VER";
CMAKE_TAR="$CMAKE_DIR.tar.gz";
CMAKE_URL="http://www.cmake.org/files/v2.6/$CMAKE_TAR";
if ! test -e "$CMAKE_TAR"; then
if type -p curl >& /dev/null; then
curl $CMAKE_URL -o cmake-$CMAKE_VER.tar.gz || die "Error downloading cmake, plase install manually.";
elif type -p wget >& /dev/null; then
wget $CMAKE_URL || die "Error downloading cmake, please install manually.";
else
die "Could not find curl nor wget to download cmake: plase install either of them or install cmake manually."
fi
fi
test -e "$CMAKE_TAR" || die "Cmake tarball unexpectedly missing."
tar xvzf "$CMAKE_TAR" || die "Error unpacking cmake tarball."
(cd "$CMAKE_DIR" ; ./bootstrap) || die "Error bootstrapping cmake."
(cd "$CMAKE_DIR" ; $MAKE) || die "Error building cmake."
echo "CMAKE=\""'`pwd`'"/$CMAKE_DIR/bin/cmake\"" > configure.vars;
source ./configure.vars
echo "Done downloading and compiling cmake, proceeding with configuration."
}
cmake_inst() {
echo -ne \
"Sorry, but CMake is required to build $PACKAGE, please install it from\n\
your distribution packages or from http://www.cmake.org. If you do not have\n\
root permissions and therefore do not want to install cmake system-wide,\n\
i can try to download and compile cmake for you.\n\n\
Download and install cmake? [y/n]"
read answer;
if test "$answer" = "y" || test "$answer" = "Y"; then
do_cmake_inst;
else
die "Not proceeding, please re-run configure after installing cmake".
fi
}
$CMAKE --version >& /dev/null || cmake_inst
$CMAKE --version >& /dev/null || die "$CMAKE unexpectedly failed."
test -e _build && die "The directory \"_build\" already exists, please remove it before reconfiguring."
mkdir _build || die "Failed to create _build, permission problem?"
(cd _build; $CMAKE .. "$@") || die "Configuration failed."
echo
echo -e "Configuration complete. You may use \"ccmake _build\" or \n\
supply options of form -DOPTION=value to this script, if you need to \n\
adjust any of the configuration options. Your build will use the \n\
following values:"
echo
$CMAKE -L -N _build | grep -v OUTPUT_PATH:PATH | grep -v CMAKE_BUILD_TYPE | \
grep -v CMAKE_BACKWARDS_COMPAT