Debian Codegraph @

configure

raw symbols ◀ ▶ SCIP
2 Debian patches touch this file
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 # Copyright 2007-2008 David Johnson
3 # Configuration script for use with qt/qmake projects. This configure
4 # script is free software; the author gives unlimited permission to
5 # copy, distribute and modify it. Portions of this script adapted
6 # from the Qt configuration script.
7
8 PACKAGE=qbrew
9 PROFILE=qbrew.pro
10 PREFIX=/usr/localscip-shell filesystem . . `/usr/local`.
11 QTMINVER=4.3.0
12 LOGFILE=config.log
13 BUILDDIR=.config
14
15 ### Messages ########################################################
16
17 usagescip-shell shell shell-project 0.0.0 usage().() {
18 catscip-shell system . . cat. <<EOT
19 Usage: $0 [OPTION]...
20
21 This script creates the necessary configuration files for building
22
23 Main options:
24 --prefix=[path] Base path for build/install. Default: /usr/local
25 --bindir=[path] Directory for binaries. Default: PREFIX/bin
26 --datadir=[path] Directory for data. Default: PREFIX/share
27 --docdir=[path] Directory for docs. Default: PREFIX/share/doc
28 --qtdir=[path] Directory where Qt is installed
29 --spec=[spec] Spec to use for QMAKESPEC
30 --debug Enable debug output
31 --help This help text
32
33 EOT
34 }
35
36 qt_infoscip-shell shell shell-project 0.0.0 qt_info().() {
37 catscip-shell system . . cat. <<EOF
38 Be sure you have a properly configured Qt build environment. This application
39 requires a Qt library version of $QTMINVER or greater. Some systems split Qt
40 into separate runtime and development packages. If this is your case, make sure
41 you have both. The 'qmake' command should be in your path, and you may need to
42 use either the QTDIR environment variable or the --qtdir configure option. It
43 may be necessary to use the --spec option if qmake cannot determine your build
44 system. If your qmake has been installed under a different name, then it may be
45 necessary to use the QMAKE variable.
46 EOF
47 }
48
49 ### Tests ###########################################################
50
51 make_testscip-shell shell shell-project 0.0.0 make_test().() {
52 if [scip-shell system . . `[`. -z "$MAKE" ] ; then
53 for mk in gmake make; do
54 if whichscip-shell system . . which. $mk >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
55 MAKE=`whichscip-shell system . . which. $mk`
56 break
57 fi
58 done
59 if [scip-shell system . . `[`. -z "$MAKE" ] ; then
60 echoscip-shell system . . echo. "ERROR: cannot find 'make' or 'gmake'. Exiting"
61 echoscip-shell system . . echo. "ERROR: cannot find 'make' or 'gmake'. Exiting" >> $LOGFILE
62 exit 1
63 fi
64 fi
65 }
66
67 qmake_testscip-shell shell shell-project 0.0.0 qmake_test().() {
68 echoscip-shell system . . echo. -n "Checking for qmake..."
69
70 # check QTDIR
71 if [scip-shell system . . `[`. -z "$QMAKE" ] ; then
72 result=$QTDIR/bin/qmake
73 if [scip-shell system . . `[`. -x "$result" ] ; then
74 QMAKE=$result
75 fi
•76 result=$QTDIR/bin/lrelease
77 if [scip-shell system . . `[`. -x "$result" ] ; then
78 LRELEASE=$result
79 fi
80 fi
81
82 # check PATH
83 if [scip-shell system . . `[`. -z "$QMAKE" ] ; then
84 result=`whichscip-shell system . . which. qmake 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
85 if [scip-shell system . . `[`. -x "$result" ] ; then
86 QMAKE=$result
87 fi
•88 result=`whichscip-shell system . . which. lrelease 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
89 if [scip-shell system . . `[`. -x "$result" ] ; then
90 LRELEASE=$result
91 fi
92 fi
93
94 # check common rename
95 if [scip-shell system . . `[`. -z "$QMAKE" ] ; then
96 result=`whichscip-shell system . . which. qmake-q4 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
97 if [scip-shell system . . `[`. -x "$result" ] ; then
98 QMAKE=$result
99 fi
•100 result=`whichscip-shell system . . which. lrelease-q4 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
101 if [scip-shell system . . `[`. -x "$result" ] ; then
102 LRELEASE=$result
103 fi
104 fi
105
106 # check pkg-config
107 if [scip-shell system . . `[`. -z "$QMAKE" ] ; then
108 result=`pkg-config QtCore --variable=exec_prefix 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
109 if [scip-shell system . . `[`. ! -z "$result" ] ; then
110 result=$result/bin/qmake
111 if [scip-shell system . . `[`. -x "$result" ] ; then
112 QMAKE=$result
113 fi
•114 result=$result/bin/lrelease
115 if [scip-shell system . . `[`. -x "$result" ] ; then
116 LRELEASE=$result
117 fi
118 fi
119 fi
120
121 if [scip-shell system . . `[`. -z "$QMAKE" ] ; then
122 echoscip-shell system . . echo. "no!"
123 echoscip-shell system . . echo. "ERROR: unable to find the 'qmake' tool"
124 echoscip-shell system . . echo. "ERROR: unable to find the 'qmake' tool" >> $LOGFILE
125 qt_infoscip-shell shell shell-project 0.0.0 qt_info().
126 exit 1;
127 fi
128
129 echoscip-shell system . . echo. "yes"
130 echoscip-shell system . . echo. "found qmake at $QMAKE" >> $LOGFILE
•131 echoscip-shell system . . echo. "found lrelease at $LRELEASE" >> $LOGFILE
132 }
133
134 qtversion_testscip-shell shell shell-project 0.0.0 qtversion_test().() {
135 echoscip-shell system . . echo. -n "Checking Qt version..."
136
137 result=`$QMAKE -query QT_VERSION`
138 if [scip-shell system . . `[`. "$result" '<' "$QTMINVER" ] ; then
139 echoscip-shell system . . echo. "no!"
140 echoscip-shell system . . echo. "ERROR: incorrect Qt version found: $result"
141 echoscip-shell system . . echo. "ERROR: incorrect Qt version found: $result" >> $LOGFILE
142 qt_infoscip-shell shell shell-project 0.0.0 qt_info().
143 exit 1;
144 fi
145 echoscip-shell system . . echo. "$result"
146 echoscip-shell system . . echo. "found Qt version $result" >> $LOGFILE
147 }
148
149 build_testscip-shell shell shell-project 0.0.0 build_test().() {
150 echoscip-shell system . . echo. -n "Checking if a simple Qt program builds..."
151 cwd=`pwdscip-shell system . . pwd.`
152 rmscip-shell system . . rm. -rf $BUILDDIR
153 mkdirscip-shell system . . mkdir. -p $BUILDDIR
154 cd $BUILDDIR
155
156 # write it
157 catscip-shell system . . cat. >config.pro <<EOT
158 TARGET = config
159 CONFIG += qt $BUILDMODE
160 CONFIG -= app_bundle
161 QT -= gui
162 HEADERS += config.h
163 SOURCES += config.cpp
164 EOT
165
166 catscip-shell system . . cat. >config.h <<EOT
167 #include <QtCore>
168 class Config : public QCoreApplication {
169 public:
170 Config(int &argc, char **argv);
171 };
172 EOT
173
174 catscip-shell system . . cat. >config.cpp <<EOT
175 #include "config.h"
176 Config::Config(int &argc, char **argv)
177 : QCoreApplication(argc,argv) {setApplicationName("config");}
178 int main(int argc, char **argv)
179 {
180 Config app(argc,argv);
181 return 0;
182 }
183 EOT
184
185 # build it
186 $QMAKE config.pro > /dev/nullscip-shell filesystem . . `/dev/null`.
187 $MAKE >>$LOGFILE 2>&1
188 result=$?
189
190 cd $cwd
191 rmscip-shell system . . rm. -rf $BUILDDIR
192
193 if [scip-shell system . . `[`. "$result" != "0" ] ; then
194 echoscip-shell system . . echo. "no!"
195 echoscip-shell system . . echo. "ERROR: could not build a simple Qt program. See config.log"
196 echoscip-shell system . . echo. "ERROR: could not build a simple Qt program" >> $LOGFILE
197 qt_infoscip-shell shell shell-project 0.0.0 qt_info().
198 exit 1;
199 fi
200 echoscip-shell system . . echo. "yes"
201 echoscip-shell system . . echo. "built simple Qt program" >> $LOGFILE
202 }
203
204 ### Parse options ###################################################
205
206 parse_optionsscip-shell shell shell-project 0.0.0 parse_options().() {
207 while [scip-shell system . . `[`. $# -gt 0 ] ; do
208 case "$1" in
209 --prefix=*)
210 PREFIX="${1#--prefix=}"
211 shift
212 ;;
213
214 --bindir=*)
215 BINDIR="${1#--bindir=}"
216 shift
217 ;;
218
219 --datadir=*)
220 DATADIR="${1#--datadir=}"
221 shift
222 ;;
223
224 --docdir=*)
225 DOCDIR="${1#--docdir=}"
226 shift
227 ;;
228
229 --qtdir=*)
230 QTDIR="${1#--qtdir=}"
231 shift
232 ;;
233
234 --spec=*)
235 QMAKESPEC="${1#--spec=}"
236 shift
237 ;;
238
239 --debug=*)
240 ENABLE_DEBUG="${1#--debug=}"
241 shift
242 ;;
243
244 --debug)
245 ENABLE_DEBUG="yes"
246 shift
247 ;;
248
249 --help) usagescip-shell shell shell-project 0.0.0 usage().; exit ;;
250 *) usagescip-shell shell shell-project 0.0.0 usage().; exit 1 ;;
251 esac
252 done
253 }
254
255 ### Main ############################################################
256
257 echoscip-shell system . . echo. "Configuring $PACKAGE package..."
258
259 ### initialize
260
261 SOURCEPATH=`dirnamescip-shell system . . dirname. $0`
262 SOURCEPATH=`(cd $SOURCEPATH; /bin/pwdscip-shell filesystem . . `/bin/pwd`.)`
263 BUILDDIR=$SOURCEPATH/$BUILDDIR
264 LOGFILE=$SOURCEPATH/$LOGFILE
265
266 if [scip-shell system . . `[`. -e $LOGFILE ] ; then rmscip-shell system . . rm. $LOGFILE ; fi
267 echoscip-shell system . . echo. "configure command: $0 $@" > $LOGFILE
268 echoscip-shell system . . echo. `datescip-shell system . . date.` >>$LOGFILE
269
270 ### parse command options
271
272 parse_optionsscip-shell shell shell-project 0.0.0 parse_options(). $@
273
274 QMAKE=${QMAKE:-}
•275 LRELEASE=${LRELEASE:-}
276 PREFIX=${PREFIX:-/usr/local}
277 BINDIR=${BINDIR:-$PREFIX/bin}
278 DATADIR=${DATADIR:-$PREFIX/share/$PACKAGE}
279 DOCDIR=${DOCDIR:-$PREFIX/share/doc/$PACKAGE}
280
281 if [scip-shell system . . `[`. "$ENABLE_DEBUG" = "yes" ] ; then
282 BUILDMODE="debug"
283 else
284 BUILDMODE="release"
285 fi
286
287 echoscip-shell system . . echo. >> $LOGFILE
288 echoscip-shell system . . echo. PREFIX=$PREFIX >> $LOGFILE
289 echoscip-shell system . . echo. BINDIR=$BINDIR >> $LOGFILE
290 echoscip-shell system . . echo. DATADIR=$DATADIR >> $LOGFILE
291 echoscip-shell system . . echo. DOCDIR=$DOCDIR >> $LOGFILE
292 echoscip-shell system . . echo. QTDIR=$QTDIR >> $LOGFILE
293 echoscip-shell system . . echo. QMAKESPEC=$QMAKESPEC >> $LOGFILE
294 echoscip-shell system . . echo. ENABLE_DEBUG=$ENABLE_DEBUG >> $LOGFILE
295 echoscip-shell system . . echo. BUILDMODE=$BUILDMODE >> $LOGFILE
296 echoscip-shell system . . echo. >> $LOGFILE
297
298 ### tests
299
300 make_testscip-shell shell shell-project 0.0.0 make_test().
301 qmake_testscip-shell shell shell-project 0.0.0 qmake_test().
302 qtversion_testscip-shell shell shell-project 0.0.0 qtversion_test().
303 build_testscip-shell shell shell-project 0.0.0 build_test().
304
305 ### export variables
306
307 export BINDIR
308 export DATADIR
309 export DOCDIR
310 if [scip-shell system . . `[`. ! -z $QTDIR ] ; then
311 export QTDIR
312 fi
313 if [scip-shell system . . `[`. ! -z $QMAKESPEC ] ; then
314 export QMAKESPEC
315 fi
316
•317 ### create translation
318
319 echoscip-shell system . . echo. "Creating translations"
320
321 $LRELEASE $PROFILE > /dev/nullscip-shell filesystem . . `/dev/null`. 2>> $LOGFILE
322
323 ### create Makefile
324
325 echoscip-shell system . . echo. "Creating Makefile"
326
•327 $QMAKE "QMAKE_CXXFLAGS=\"$CXXFLAGS\"" "QMAKE_LFLAGS=\"$LDFLAGS\"" \
328 -o $SOURCEPATH/Makefile "CONFIG+=$BUILDMODE configure" \
329 $PROFILE > /dev/nullscip-shell filesystem . . `/dev/null`. 2>> $LOGFILE
330
331 if [scip-shell system . . `[`. $? != "0" ] ; then
332 echoscip-shell system . . echo. "ERROR: could not create Makefile. See config.log"
333 echoscip-shell system . . echo. "ERROR: could not create Makefile." >> $LOGFILE
334 echoscip-shell system . . echo. "Command: $QMAKE -o $SOURCEPATH/Makefile \"CONFIG+=$BUILDMODE\" $PROFILE" >> $LOGFILE
335 exit 1
336 fi
337
338 ### finished
339
340 echoscip-shell system . . echo.
341 echoscip-shell system . . echo. "$PACKAGE configured successfully"
342 echoscip-shell system . . echo. "Relax, don't worry, have a homebrew!"
•343 echoscip-shell system . . echo.