-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·92 lines (77 loc) · 2.1 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
#!/bin/bash
QMAKE=`which qmake`
BUILDDIR=build
show_usage() {
cat <<EOT
Usage: $0 [OPTION]...
This script creates necessary configuration files to build/install.
Main options:
--prefix=[path] Base path for build/install. Default: /usr/local
--no-builddir Disable building in subdirectory
--release Build in release mode
--help This help text.
EOT
}
qmake_check() {
if [ -x "$1" ]; then
EXPECTED_QT_VERSION=5
if [ -f /etc/os-release ]; then
source /etc/os-release
if [ "$ID" == "debian" -a "$VERSION_ID" == "10" ]; then
EXPECTED_QT_VERSION=4
fi
fi
if echo `$1 -v 2>&1` | grep "Qt version $EXPECTED_QT_VERSION\." >/dev/null 2>&1; then
return 0
else
echo "Warning: $1 not for Qt $EXPECTED_QT_VERSION"
fi
fi
return 1
}
relpath=`dirname $0`
relpath=`(cd "$relpath"; /bin/pwd)`
curpath=`/bin/pwd`
substpath=${curpath#${relpath}}
qmake_check "$QMAKE" || exit 1
declare -a SAVED_ARGS=("$@")
declare -a ARGS
while [ $# -gt 0 ]; do
optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
case "$1" in
--prefix=*)
PREFIX=$optarg
shift
;;
--no-builddir)
NOBUILDDIR=y
shift
;;
--release)
CONFIG_ADD="$CONFIG release"
CONFIG_SUB="debug"
shift
;;
--help) show_usage; exit 1;;
--*) shift;;
*) ARGS+=("$1"); shift;;
# *) show_usage; exit 1;;
esac
done
if [ "$curpath" == "$relpath" -a "$NOBUILDDIR" != "y" ]; then
echo "Building in the '""$BUILDDIR""' subdirectory"
test -d $BUILDDIR || mkdir $BUILDDIR || exit 1
cd $BUILDDIR
exec "../$0" "${SAVED_ARGS[@]}"
fi
if [ "$substpath" == "$curpath" -o \( "${substpath:0:1}" != "" -a "${substpath:0:1}" != "/" \) ]; then
echo "Can't build in a directory which is not a subdirectory of the source directory"
exit 1
fi
if [ -z "$CONFIG_ADD" ]; then
CONFIG_ADD="$CONFIG debug"
CONFIG_SUB="release"
fi
PREFIX=${PREFIX:-/usr/local}
"$QMAKE" -o .qmake.cache.makefile "CONFIG += $CONFIG_ADD" "CONFIG -= $CONFIG_SUB" "PREFIX = $PREFIX" "$relpath"/genconfig.pro "${ARGS[@]}"; rm -f .qmake.cache.makefile
"$QMAKE" -o Makefile "CONFIG += $CONFIG_ADD" "CONFIG -= $CONFIG_SUB" "$relpath"/xconfig.pro "${ARGS[@]}"