forked from nemomobile/contactsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·169 lines (148 loc) · 4.29 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/sh
#
# Configures to build the project
#
#-------------------------------------------------------------------------------
# script initialization
#-------------------------------------------------------------------------------
# Making releases:
# set the new version number:
# odd minor -> development series
# even minor -> stable series
# increment micro for each release within a series
# set nano_version to 0
# update debian/changelog, use dch
# make the release, tag it
# set nano_version to 1
MAJOR_VERSION=1
MINOR_VERSION=1
MICRO_VERSION=1
NANO_VERSION=
if [ -z $NANO_VERSION ] || [ $NANO_VERSION -eq "0" ]; then
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION"
else
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION.$NANO_VERSION"
fi
# Qt Version
QMAKE=`which qmake 2>/dev/null`
if [ -z "$QMAKE" ] ; then
QMAKE=`which qmake-qt4 2>/dev/null`
fi
if [ -z "$QMAKE" ] ; then
echo
echo "You need qmake in your PATH to build contactsd"
echo "Cannot proceed."
exit 1
fi
export QMAKE
QT_VERSION=`$QMAKE -query QT_VERSION`
if [ -z "$QT_VERSION" ] ; then
echo
echo "Cannot proceed without QT_VERSION determined."
exit 1
fi
relpath=`dirname $0`
relpath=`(cd "$relpath"; /bin/pwd)`
outpath=`/bin/pwd`
PREFIX=/usr
LOCALSTATEDIR=/var
TOP_SOURCEDIR=$relpath
TOP_BUILDDIR=$outpath
while [ "$#" -gt 0 ]; do
case "$1" in
-h|--help)
echo "Usage: ./configure [OPTION]..."
echo
echo "Configuration:"
echo " -h, --help display this help and exit"
echo
echo "Installation directories:"
echo " --prefix PREFIX install everything relative to PREFIX"
echo " [/usr]"
echo
echo "Fine tuning of the installation directories:"
echo " --bindir DIR user executables [PREFIX/bin]"
echo " --libdir DIR object code libraries [PREFIX/lib]"
echo " --includedir DIR C header files [PREFIX/include]"
echo " --localstatedir DIR modifiable single-machine data [/var]"
echo
exit
;;
--prefix)
shift
PREFIX=$1
;;
--bindir)
shift
BINDIR=$1
;;
--libdir)
shift
LIBDIR=$1
;;
--includedir)
shift
INCLUDEDIR=$1
;;
--localstatedir)
shift
LOCALSTATEDIR=$1
;;
--enable-coverage)
ENABLE_COVERAGE=coverage ;;
--disable-coverage)
ENABLE_COVERAGE=nocoverage ;;
*)
echo >&2 "configure: error: unrecognized option: '$1'"
echo >&2 "Try './configure --help' for more information."
exit
;;
esac
shift
done
[ -z $BINDIR ] && BINDIR=$PREFIX/bin
[ -z $LIBDIR ] && LIBDIR=$PREFIX/lib
[ -z $INCLUDEDIR ] && INCLUDEDIR=$PREFIX/include
#coverage options
if [ -z "$ENABLE_COVERAGE" ]
then
echo "Coverage not enabled"
ENABLE_COVERAGE=nocoverage
fi
# save configuration into .qmake.cache
CACHEFILE="$outpath/.qmake.cache"
[ -f "$CACHEFILE" ] && rm -f "$CACHEFILE"
cat >> "$CACHEFILE" << EOF
CONFIGURED = \$\$quote(yes)
VERSION = \$\$quote($VERSION)
PREFIX = \$\$quote($PREFIX)
BINDIR = \$\$quote($BINDIR)
LIBDIR = \$\$quote($LIBDIR)
INCLUDEDIR = \$\$quote($INCLUDEDIR)
LOCALSTATEDIR = \$\$quote($LOCALSTATEDIR)
TOP_SOURCEDIR = \$\$quote($TOP_SOURCEDIR)
TOP_BUILDDIR = \$\$quote($TOP_BUILDDIR)
CONFIG += \$\$quote($ENABLE_COVERAGE)
EOF
infiles="contactsd-1.0.pc tests/mktests.sh"
for infile in $infiles; do
echo "Generating $infile"
# pre-process .in files
mkdir -p `dirname $infile`
cat $TOP_SOURCEDIR/$infile.in |
sed -e "s,@VERSION@,${VERSION},g" \
-e "s,@PREFIX@,${PREFIX},g" \
-e "s,@BINDIR@,${BINDIR},g" \
-e "s,@LIBDIR@,${LIBDIR},g" \
-e "s,@INCLUDEDIR@,${INCLUDEDIR},g" \
-e "s,@LOCALSTATEDIR@,${LOCALSTATEDIR},g" \
-e "s,@TOP_SOURCEDIR@,${TOP_SOURCEDIR},g" \
-e "s,@TOP_BUILDDIR@,${TOP_BUILDDIR},g" \
> $TOP_BUILDDIR/$infile
done
echo
echo "contactsd is now configured for building. Now run 'qmake' and then 'make'."
echo "Once everything is built, you must run 'make install'."
echo "contactsd will be installed into $PREFIX"
echo
echo "To reconfigure, run 'make confclean' and 'configure'."