Debian Codegraph @

configure

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #############################################################################
3 ##
4 ## Copyright (C) 2016 The Qt Company Ltd.
5 ## Copyright (C) 2016 Intel Corporation.
6 ## Contact: https://www.qt.io/licensing/
7 ##
8 ## This file is the build configuration utility of the Qt Toolkit.
9 ##
10 ## $QT_BEGIN_LICENSE:GPL-EXCEPT$
11 ## Commercial License Usage
12 ## Licensees holding valid commercial Qt licenses may use this file in
13 ## accordance with the commercial license agreement provided with the
14 ## Software or, alternatively, in accordance with the terms contained in
15 ## a written agreement between you and The Qt Company. For licensing terms
16 ## and conditions see https://www.qt.io/terms-conditions. For further
17 ## information use the contact form at https://www.qt.io/contact-us.
18 ##
19 ## GNU General Public License Usage
20 ## Alternatively, this file may be used under the terms of the GNU
21 ## General Public License version 3 as published by the Free Software
22 ## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
23 ## included in the packaging of this file. Please review the following
24 ## information to ensure the GNU General Public License requirements will
25 ## be met: https://www.gnu.org/licenses/gpl-3.0.html.
26 ##
27 ## $QT_END_LICENSE$
28 ##
29 #############################################################################
30
31 #-------------------------------------------------------------------------------
32 # script initialization
33 #-------------------------------------------------------------------------------
34
35 # the name of this script
36 relconf=`basenamescip-shell system . . basename. $0`
37 # the directory of this script is the "source tree"
38 relpath=`dirnamescip-shell system . . dirname. $0`
39 relpath=`(cd "$relpath"; /bin/pwdscip-shell filesystem . . `/bin/pwd`.)`
40 # the current directory is the "build tree" or "object tree"
41 outpath=`/bin/pwdscip-shell filesystem . . `/bin/pwd`.`
42
43 WHICH="which"
44
45 PERL=`$WHICH perl 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
46
47 # find out which awk we want to use, prefer gawk, then nawk, then regular awk
48 AWK=
49 for e in gawk nawk awk; do
50 if "$WHICH" $e >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && ( $e -f /dev/nullscip-shell filesystem . . `/dev/null`. /dev/nullscip-shell filesystem . . `/dev/null`. ) >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
51 AWK=$e
52 break
53 fi
54 done
55
56 # find a make command
57 if [scip-shell system . . `[`. -z "$MAKE" ]; then
58 MAKE=
59 for mk in gmake make; do
60 if "$WHICH" $mk >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
61 MAKE=`"$WHICH" $mk`
62 break
63 fi
64 done
65 if [scip-shell system . . `[`. -z "$MAKE" ]; then
66 echoscip-shell system . . echo. >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
67 echoscip-shell system . . echo. >&2 "Cannot proceed."
68 exit 1
69 fi
70 # export MAKE, we need it later in the config.tests
71 export MAKE
72 fi
73
74 # make sure qmake is not confused by these. recursion via Makefiles would
75 # be still affected, so just unsetting them here is not an option.
76 if [scip-shell system . . `[`. -n "$QMAKESPEC" ] || [scip-shell system . . `[`. -n "$XQMAKESPEC" ] || \
77 [ -n "$QMAKEPATH" ] || [scip-shell system . . `[`. -n "$QMAKEFEATURES" ]; then
78 echoscip-shell system . . echo. >&2 "Please make sure to unset the QMAKESPEC, XQMAKESPEC, QMAKEPATH,"
79 echoscip-shell system . . echo. >&2 "and QMAKEFEATURES environment variables prior to building Qt."
80 exit 1
81 fi
82
83 # do this early so we don't store it in config.status
84 CFG_TOPLEVEL=
85 relpathMangled=$relpath
86 outpathPrefix=
87 if [scip-shell system . . `[`. x"$1" = x"-top-level" ]; then
88 CFG_TOPLEVEL=yes
89 relpathMangled=`dirnamescip-shell system . . dirname. "$relpath"`
90 outpathPrefix=../
91 shift
92 else
93 if [scip-shell system . . `[`. -f ../.qmake.super ]; then
94 echoscip-shell system . . echo. >&2 "ERROR: You cannot configure qtbase separately within a top-level build."
95 exit 1
96 fi
97 fi
98
99 OPT_CMDLINE= # expanded version for the script
100 QMAKE_CMDLINE= # verbatim version for qmake call
101 set -f # suppress globbing in for loop
102 SAVED_IFS=$IFS
103 IFS='
104 '
105 for i in "$@"; do
106 case $i in
107 -redo|--redo)
108 optfile=${outpathPrefix}config.opt
109 if testscip-shell system . . test. -n "$CFG_TOPLEVEL" && ! testscip-shell system . . test. -f $optfile; then
110 optfile=config.opt
111 fi
112 if ! testscip-shell system . . test. -f $optfile; then
113 echoscip-shell system . . echo. >&2 "No config.opt present - cannot redo configuration."
114 exit 1
115 fi
116 for a in `catscip-shell system . . cat. $optfile`; do
117 OPT_CMDLINE="$OPT_CMDLINE
118 $a"
119 done
120 ;;
121 *)
122 OPT_CMDLINE="$OPT_CMDLINE
123 $i"
124 ;;
125 esac
126 QMAKE_CMDLINE="$QMAKE_CMDLINE
127 $i"
128 done
129 set --
130 for i in $OPT_CMDLINE; do
131 set -- "$@" "$i"
132 done
133 set +f
134 IFS=$SAVED_IFS
135
136 #-------------------------------------------------------------------------------
137 # utility functions
138 #-------------------------------------------------------------------------------
139
140 # Helper function for getQMakeConf. It parses include statements in
141 # qmake.conf and prints out the expanded file
142 expandQMakeConfscip-shell shell shell-project 0.0.0 expandQMakeConf().()
143 {
144 while read line; do case "$line" in
145 include*)
146 inc_file=`echoscip-shell system . . echo. "$line" | sedscip-shell system . . sed. -n -e '/^include.*(.*)/s/include.*(\(.*\)).*$/\1/pscip-shell filesystem . . `/^include.*(.*)/s/include.*(\(.*\)).*$/\1/p`.'`
147 current_dir=`dirnamescip-shell system . . dirname. "$1"`
148 conf_file="$current_dir/$inc_file"
149 if [scip-shell system . . `[`. ! -f "$conf_file" ]; then
150 echoscip-shell system . . echo. "WARNING: Unable to find file $conf_file" >&2
151 continue
152 fi
153 expandQMakeConfscip-shell shell shell-project 0.0.0 expandQMakeConf(). "$conf_file"
154 ;;
155 *)
156 echoscip-shell system . . echo. "$line"
157 ;;
158 esac; done < "$1"
159 }
160
161 extractQMakeVariablesscip-shell shell shell-project 0.0.0 extractQMakeVariables().()
162 {
163 LC_ALL=C $AWK '
164 BEGIN {
165 values["LITERAL_WHITESPACE"] = " "
166 values["LITERAL_DOLLAR"] = "$"
167 }
168 /^[_A-Z0-9.]+[ \t]*\+?=/ {
169 valStart = index($0, "=") + 1
170
171 append = 0
172 if (substr($0, valStart - 2, 1) == "+") {
173 append = 1
174 }
175
176 variable = substr($0, 0, valStart - 2 - append)
177 value = substr($0, valStart)
178 gsub("[ \t]+", "", variable)
179 gsub("^[ \t]+", "", value)
180 gsub("[ \t]+$", "", value)
181
182 ovalue = ""
183 while (match(value, /\$\$(\{[_A-Z0-9.]+\}|[_A-Z0-9.]+)/)) {
184 ovalue = ovalue substr(value, 1, RSTART - 1)
185 var = substr(value, RSTART + 2, RLENGTH - 2)
186 value = substr(value, RSTART + RLENGTH)
187 if (var ~ /^\{/) {
188 var = substr(var, 2, length(var) - 2)
189 }
190 ovalue = ovalue values[var]
191 }
192 value = ovalue value
193
194 ovalue = ""
195 while (match(value, /\$\$system\(("[^"]*"|[^)]*)\)/)) {
196 ovalue = ovalue substr(value, 1, RSTART - 1)
197 cmd = substr(value, RSTART + 9, RLENGTH - 10)
198 gsub(/^"|"$/, "", cmd)
199 value = substr(value, RSTART + RLENGTH)
200 while ((cmd | getline line) > 0) {
201 ovalue = ovalue line
202 }
203 close(cmd)
204 }
205 value = ovalue value
206
207 combinedValue = values[variable]
208 if (append == 1 && length(combinedValue) > 0) {
209 combinedValue = combinedValue " " value
210 } else {
211 combinedValue = value
212 }
213 values[variable] = combinedValue
214 }
215 END {
216 for (var in values) {
217 print var "=" values[var]
218 }
219 }
220 '
221 }
222
223 getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable().()
224 {
225 echoscip-shell system . . echo. "$2" | $AWK "/^($1)=/ { print substr(\$0, index(\$0, \"=\") + 1) }"
226 }
227
228 macSDKifyscip-shell shell shell-project 0.0.0 macSDKify().()
229 {
230 # Normally we take care of sysrootifying in sdk.prf, but configure extracts some
231 # values before qmake is even built, so we have to duplicate the logic here.
232
233 sdk=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). "QMAKE_MAC_SDK" "$1")
234 if [scip-shell system . . `[`. -z "$sdk" ]; then echoscip-shell system . . echo. "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi
235 sysroot=$(/usr/bin/xcrunscip-shell filesystem . . `/usr/bin/xcrun`. --sdk $sdk --show-sdk-path 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
236 if [scip-shell system . . `[`. -z "$sysroot" ]; then echoscip-shell system . . echo. "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
237
238 case "$sdk" in
239 macosx*)
240 version_min_flag="-mmacosx-version-min=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). QMAKE_MACOSX_DEPLOYMENT_TARGET "$1")"
241 ;;
242 iphoneos*)
243 version_min_flag="-miphoneos-version-min=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
244 ;;
245 iphonesimulator*)
246 version_min_flag="-mios-simulator-version-min=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
247 ;;
248 appletvos*)
249 version_min_flag="-mappletvos-version-min=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). QMAKE_TVOS_DEPLOYMENT_TARGET "$1")"
250 ;;
251 appletvsimulator*)
252 version_min_flag="-mtvos-simulator-version-min=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). QMAKE_TVOS_DEPLOYMENT_TARGET "$1")"
253 ;;
254 watchos*)
255 version_min_flag="-mwatchos-version-min=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
256 ;;
257 watchsimulator*)
258 version_min_flag="-mwatchos-simulator-version-min=$(getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
259 ;;
260 *)
261 ;;
262 esac
263
264 echoscip-shell system . . echo. "$1" | while read line; do
265 case "$line" in
266 QMAKE_CC=*|QMAKE_CXX=*|QMAKE_FIX_RPATH=*|QMAKE_AR=*|QMAKE_RANLIB=*|QMAKE_LINK=*|QMAKE_LINK_SHLIB=*)
267 # Prefix tool with toolchain path
268 var=$(echoscip-shell system . . echo. "$line" | cutscip-shell system . . cut. -d '=' -f 1)
269 val=$(echoscip-shell system . . echo. "$line" | cutscip-shell system . . cut. -d '=' -f 2-)
270 sdk_val=$(/usr/bin/xcrunscip-shell filesystem . . `/usr/bin/xcrun`. -sdk $sdk -find $(echoscip-shell system . . echo. $val | cutscip-shell system . . cut. -d ' ' -f 1))
271 val=$(echoscip-shell system . . echo. $sdk_val $(echoscip-shell system . . echo. $val | cutscip-shell system . . cut. -s -d ' ' -f 2-))
272 echoscip-shell system . . echo. "$var=$val"
273 ;;
274 QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*|QMAKE_LFLAGS=*)
275 echoscip-shell system . . echo. "$line -isysroot $sysroot $version_min_flag"
276 ;;
277 *)
278 echoscip-shell system . . echo. "$line"
279 ;;
280 esac
281 done
282 }
283
284 # relies on $QMAKESPEC being set correctly. parses include statements in
285 # qmake.conf and prints out the expanded file
286 getQMakeConfscip-shell shell shell-project 0.0.0 getQMakeConf().()
287 {
288 if [scip-shell system . . `[`. -z "$specvals" ]; then
289 specvals=`expandQMakeConfscip-shell shell shell-project 0.0.0 expandQMakeConf(). "$QMAKESPEC/qmake.conf" | extractQMakeVariablesscip-shell shell shell-project 0.0.0 extractQMakeVariables().`
290 if [scip-shell system . . `[`. "$BUILD_ON_MAC" = "yes" ]; then specvals=$(macSDKifyscip-shell shell shell-project 0.0.0 macSDKify(). "$specvals"); fi
291 fi
292 getSingleQMakeVariablescip-shell shell shell-project 0.0.0 getSingleQMakeVariable(). "$1" "$specvals"
293 }
294
295 #-------------------------------------------------------------------------------
296 # operating system detection
297 #-------------------------------------------------------------------------------
298
299 # need that throughout the script
300 UNAME_MACHINE=`(unamescip-shell system . . uname. -m) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` || UNAME_MACHINE=unknown
301 UNAME_RELEASE=`(unamescip-shell system . . uname. -r) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` || UNAME_RELEASE=unknown
302 UNAME_SYSTEM=`(unamescip-shell system . . uname. -s) 2>/dev/nullscip-shell filesystem . . `/dev/null`.` || UNAME_SYSTEM=unknown
303
304 BUILD_ON_MAC=no
305 if [scip-shell system . . `[`. -d /System/Library/Frameworks/Cocoa.frameworkscip-shell filesystem . . `/System/Library/Frameworks/Cocoa.framework`. ]; then
306 BUILD_ON_MAC=yes
307 fi
308 if [scip-shell system . . `[`. "$OSTYPE" = "msys" ]; then
309 relpath=`(cd "$relpath"; pwdscip-shell system . . pwd. -W)`
310 outpath=`pwdscip-shell system . . pwd. -W`
311 fi
312
313 #-------------------------------------------------------------------------------
314 # Verify Xcode installation on Mac OS
315 #-------------------------------------------------------------------------------
316
317 if [scip-shell system . . `[`. "$BUILD_ON_MAC" = "yes" ]; then
318 if ! /usr/bin/xcode-selectscip-shell filesystem . . `/usr/bin/xcode-select`. --print-path >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
319 echoscip-shell system . . echo. >&2
320 echoscip-shell system . . echo. " No Xcode selected. Please install Xcode via the App Store, " >&2
321 echoscip-shell system . . echo. " or the command line developer tools via xcode-select --install, " >&2
322 echoscip-shell system . . echo. " and use xcode-select --switch to choose the right installation. " >&2
323 echoscip-shell system . . echo. " See the xcode-select man page for more information." >&2
324 echoscip-shell system . . echo. >&2
325 exit 2
326 fi
327
328 # In the else case we are probably using a Command Line Tools installation
329 if /usr/bin/xcrunscip-shell filesystem . . `/usr/bin/xcrun`. -find xcodebuild >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
330 if ! /usr/bin/xcrunscip-shell filesystem . . `/usr/bin/xcrun`. xcodebuild -license check 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
331 echoscip-shell system . . echo. >&2
332 echoscip-shell system . . echo. " Xcode setup not complete. You need to confirm the license" >&2
333 echoscip-shell system . . echo. " agreement by running 'sudo xcrun xcodebuild -license accept'." >&2
334 echoscip-shell system . . echo. >&2
335 exit 2
336 fi
337 fi
338 fi
339
340 #-----------------------------------------------------------------------------
341 # Qt version detection
342 #-----------------------------------------------------------------------------
343 QT_VERSION=
344 QT_MAJOR_VERSION=
345 QT_MINOR_VERSION=0
346 QT_PATCH_VERSION=0
347 eval `sedscip-shell system . . sed. -n -e 's/^MODULE_VERSION = \(\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*\)$/QT_VERSION=\1\
348 QT_MAJOR_VERSION=\2\
349 QT_MINOR_VERSION=\3\
350 QT_PATCH_VERSION=\4/p' < "$relpath"/.qmake.conf`
351 if [scip-shell system . . `[`. -z "$QT_MAJOR_VERSION" ]; then
352 echoscip-shell system . . echo. "Cannot process version from .qmake.conf"
353 echoscip-shell system . . echo. "Cannot proceed."
354 exit 1
355 fi
356
357 #-------------------------------------------------------------------------------
358 # initialize variables
359 #-------------------------------------------------------------------------------
360
361 # QTDIR may be set and point to an old or system-wide Qt installation
362 unset QTDIR
363
364 # initalize internal variables
365 CFG_RELEASE_TOOLS=no
366 PLATFORM=
367 OPT_SHADOW=maybe
368 OPT_VERBOSE=no
369 OPT_HELP=
370 CFG_SILENT=no
371 CFG_DEV=no
372
373 #-------------------------------------------------------------------------------
374 # parse command line arguments
375 #-------------------------------------------------------------------------------
376
377 # parse the arguments, setting things to "yes" or "no"
378 while [scip-shell system . . `[`. "$#" -gt 0 ]; do
379 CURRENT_OPT="$1"
380 case "$1" in
381 #Autoconf style options
382 --enable-*)
383 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^--enable-\(.*\),\1,'`
384 VAL=yes
385 ;;
386 --disable-*)
387 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^--disable-\(.*\),\1,'`
388 VAL=no
389 ;;
390 --*=*)
391 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^--\(.*\)=.*,\1,'`
392 VAL=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^--.*=\(.*\),\1,'`
393 ;;
394 --no-*)
395 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^--no-\(.*\),\1,'`
396 VAL=no
397 ;;
398 --*)
399 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^--\(.*\),\1,'`
400 VAL=yes
401 ;;
402 #Qt plugin options
403 -no-*-*|-plugin-*-*|-qt-*-*)
404 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-[^-]*-\(.*\),\1,'`
405 VAL=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-\([^-]*\).*,\1,'`
406 ;;
407 #Qt style no options
408 -no-*)
409 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-no-\(.*\),\1,'`
410 VAL=no
411 ;;
412 #Qt style options that pass an argument
413 -prefix| \
414 -docdir| \
415 -headerdir| \
416 -plugindir| \
417 -importdir| \
418 -qmldir| \
419 -archdatadir| \
420 -datadir| \
421 -libdir| \
422 -bindir| \
423 -libexecdir| \
424 -translationdir| \
425 -sysconfdir| \
426 -examplesdir| \
427 -testsdir| \
428 -hostdatadir| \
429 -hostbindir| \
430 -hostlibdir| \
431 -extprefix| \
432 -sysroot| \
433 -external-hostbindir| \
434 -make| \
435 -nomake| \
436 -skip| \
437 -platform| \
438 -xplatform| \
439 -device| \
440 -device-option| \
441 -sdk| \
442 -android-sdk| \
443 -android-ndk| \
444 -android-ndk-platform| \
445 -android-ndk-host| \
446 -android-arch)
447 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-\(.*\),\1,'`
448 shift
449 VAL="$1"
450 ;;
451 #Qt style complex options in one command
452 -enable-*|-disable-*)
453 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-\([^-]*\)-.*,\1,'`
454 VAL=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-[^-]*-\(.*\),\1,'`
455 ;;
456 #Qt Builtin/System style options
457 -no-*|-system-*|-qt-*)
458 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-[^-]*-\(.*\),\1,'`
459 VAL=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-\([^-]*\)-.*,\1,'`
460 ;;
461 #Options that cannot be generalized
462 -hostprefix)
463 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-\(.*\),\1,'`
464 # this option may or may not be followed by an argument
465 if [scip-shell system . . `[`. -z "$2" ] || echoscip-shell system . . echo. "$2" | grepscip-shell system . . grep. '^-' >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
466 VAL=$outpath
467 else
468 shift;
469 VAL=$1
470 fi
471 ;;
472 #General options, including Qt style yes options
473 -*)
474 VAR=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^-\(.*\),\1,'`
475 VAL="yes"
476 ;;
477 # Special case for macOS universal builds
478 QMAKE_APPLE_DEVICE_ARCHS=*)
479 QMAKE_APPLE_DEVICE_ARCHS=`echoscip-shell system . . echo. $1 | sedscip-shell system . . sed. 's,^QMAKE_APPLE_DEVICE_ARCHS=\(.*\),\1,'`
480 ;;
481 # most options don't need processing in the configure script, skip them. qmake will do the real validation
482 *)
483 shift
484 continue
485 ;;
486 esac
487
488 shift
489
490 UNKNOWN_OPT=no
491 case "$VAR" in
492 external-hostbindir)
493 CFG_HOST_QT_TOOLS_PATH="$VAL"
494 ;;
495 platform)
496 PLATFORM="$VAL"
497 ;;
498 optimized-qmake|optimized-tools)
499 if [scip-shell system . . `[`. "$VAL" = "yes" ] || [scip-shell system . . `[`. "$VAL" = "no" ]; then
500 CFG_RELEASE_TOOLS="$VAL"
501 fi
502 ;;
503 developer-build)
504 CFG_DEV="yes"
505 ;;
506 h|help)
507 if [scip-shell system . . `[`. "$VAL" = "yes" ]; then
508 OPT_HELP="$VAL"
509 else
510 UNKNOWN_OPT=yes
511 fi
512 ;;
513 v|verbose)
514 if [scip-shell system . . `[`. "$VAL" = "yes" ]; then
515 OPT_VERBOSE=yes
516 elif [scip-shell system . . `[`. "$VAL" = "no" ]; then
517 OPT_VERBOSE=no
518 else
519 UNKNOWN_OPT=yes
520 fi
521 ;;
522 silent)
523 # need to keep this here, to ensure qmake is built silently
524 CFG_SILENT="$VAL"
525 ;;
526 *)
527 ;;
528 esac
529 if [scip-shell system . . `[`. "$UNKNOWN_OPT" = "yes" ]; then
530 echoscip-shell system . . echo. "${CURRENT_OPT}: invalid command-line switch"
531 ERROR=yes
532 fi
533 done
534 [scip-shell system . . `[`. "x$ERROR" = "xyes" ] && exit 1
535
536 #-------------------------------------------------------------------------------
537 # help - interactive parts of the script _after_ this section please
538 #-------------------------------------------------------------------------------
539
540 if [scip-shell system . . `[`. "$OPT_HELP" = "yes" ]; then
541 catscip-shell system . . cat. $relpath/config_help.txt
542 if [scip-shell system . . `[`. -n "$CFG_TOPLEVEL" ]; then
543 IFS='
544 '
545 for i in $relpathMangled/qt*/config_help.txt; do
546 if [scip-shell system . . `[`. x"$i" != x"$relpath/config_help.txt" ]; then
547 echoscip-shell system . . echo.
548 catscip-shell system . . cat. "$i"
549 fi
550 done
551 fi
552 exit 0
553 fi
554
555 #-------------------------------------------------------------------------------
556 # platform detection
557 #-------------------------------------------------------------------------------
558
559 PLATFORM_NOTES=
560 if [scip-shell system . . `[`. -z "$PLATFORM" ]; then
561 case "$UNAME_SYSTEM:$UNAME_RELEASE" in
562 Darwin:*)
563 PLATFORM=macx-clang
564 ;;
565 AIX:*)
566 #PLATFORM=aix-g++
567 PLATFORM=aix-g++-64
568 PLATFORM_NOTES="AIX: aix-g++ aix-g++-64"
569 ;;
570 GNU:*)
571 PLATFORM=hurd-g++
572 ;;
573 FreeBSD:*)
574 if [scip-shell system . . `[`. "$(unamescip-shell system . . uname. -r | cutscip-shell system . . cut. -d. -f1)" -ge 10 ]; then
575 PLATFORM=freebsd-clang
576 PLATFORM_NOTES="FreeBSD: freebsd-g++"
577 else
578 PLATFORM=freebsd-g++
579 PLATFORM_NOTES="FreeBSD: freebsd-clang"
580 fi
581 ;;
582 OpenBSD:*)
583 PLATFORM=openbsd-g++
584 ;;
585 NetBSD:*)
586 PLATFORM=netbsd-g++
587 ;;
588 HP-UX:*)
589 case "$UNAME_MACHINE" in
590 ia64)
591 PLATFORM=hpuxi-g++-64
592 ;;
593 esac
594 ;;
595 Linux:*)
596 PLATFORM=linux-g++
597 PLATFORM_NOTES="Linux: linux-clang linux-icc"
598 ;;
599 SunOS:5*)
600 #PLATFORM=solaris-g++-64
601 PLATFORM=solaris-cc
602 #PLATFORM=solaris-cc64
603 PLATFORM_NOTES="Solaris: solaris-g++-64 solaris-cc-64"
604 ;;
605 CYGWIN*:*)
606 PLATFORM=cygwin-g++
607 ;;
608 LynxOS*:*)
609 PLATFORM=lynxos-g++
610 ;;
611 QNX:*)
612 PLATFORM=unsupported/qnx-g++
613 ;;
614 *)
615 echoscip-shell system . . echo. >&2
616 echoscip-shell system . . echo. " The build script does not currently recognize all" >&2
617 echoscip-shell system . . echo. " platforms supported by Qt." >&2
618 echoscip-shell system . . echo. " Rerun this script with a -platform option listed to" >&2
619 echoscip-shell system . . echo. " set the system/compiler combination you use." >&2
620 echoscip-shell system . . echo. >&2
621 exit 2
622 esac
623 fi
624 echoscip-shell system . . echo. "$PLATFORM_NOTES" > "${outpathPrefix}.config.notes"
625
626 #-------------------------------------------------------------------------------
627 # command line and environment validation
628 #-------------------------------------------------------------------------------
629
630 if [scip-shell system . . `[`. -d "$PLATFORM" ]; then
631 QMAKESPEC="$PLATFORM"
632 else
633 QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
634 fi
635
636 if [scip-shell system . . `[`. "$BUILD_ON_MAC" = "yes" ]; then
637 if [scip-shell system . . `[`. `basenamescip-shell system . . basename. $QMAKESPEC` = "macx-xcode" ]; then
638 echoscip-shell system . . echo. >&2
639 echoscip-shell system . . echo. " Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
640 echoscip-shell system . . echo. " Please build Qt/Mac with 'macx-clang' or 'macx-g++', then use" >&2
641 echoscip-shell system . . echo. " the 'macx-xcode' spec for your application, and it will link to" >&2
642 echoscip-shell system . . echo. " the Qt/Mac build using the settings of the original mkspec." >&2
643 echoscip-shell system . . echo. >&2
644 exit 2
645 fi
646 fi
647
648 # check specified platforms are supported
649 if [scip-shell system . . `[`. '!' -d "$QMAKESPEC" ]; then
650 echoscip-shell system . . echo.
651 echoscip-shell system . . echo. " The specified system/compiler is not supported:"
652 echoscip-shell system . . echo.
653 echoscip-shell system . . echo. " $QMAKESPEC"
654 echoscip-shell system . . echo.
655 echoscip-shell system . . echo. " Please see the README file for a complete list."
656 echoscip-shell system . . echo.
657 exit 2
658 fi
659
660 #-------------------------------------------------------------------------------
661 # build tree initialization
662 #-------------------------------------------------------------------------------
663
664 # is this a shadow build?
665 if [scip-shell system . . `[`. "$OPT_SHADOW" = "maybe" ]; then
666 OPT_SHADOW=no
667 if [scip-shell system . . `[`. "$relpath" != "$outpath" ] && [scip-shell system . . `[`. '!' -f "$outpath/configure" ]; then
668 if [scip-shell system . . `[`. -h "$outpath" ]; then
669 [scip-shell system . . `[`. "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
670 else
671 OPT_SHADOW=yes
672 fi
673 fi
674 fi
675 if [scip-shell system . . `[`. "$OPT_SHADOW" = "yes" ]; then
676 if [scip-shell system . . `[`. -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
677 echoscip-shell system . . echo. >&2 "You cannot make a shadow build from a source tree containing a previous build."
678 echoscip-shell system . . echo. >&2 "Cannot proceed."
679 exit 1
680 fi
681 [scip-shell system . . `[`. "$OPT_VERBOSE" = "yes" ] && echoscip-shell system . . echo. "Performing shadow build..."
682 fi
683
684 if [scip-shell system . . `[`. "$OPT_SHADOW" = "yes" ]; then
685 echoscip-shell system . . echo. "Preparing build tree..."
686
687 [scip-shell system . . `[`. -d "$outpath/bin" ] || mkdirscip-shell system . . mkdir. -p "$outpath/bin"
688
689 mkdirscip-shell system . . mkdir. -p "$outpath/mkspecs"
690 fi
691
692 # -----------------------------------------------------------------------------
693 # build qmake
694 # -----------------------------------------------------------------------------
695
696 # symlink includes
697 if [scip-shell system . . `[`. -e "$relpath/.git" ]; then
698 if [scip-shell system . . `[`. -z "$PERL" ]; then
699 echoscip-shell system . . echo.
700 echoscip-shell system . . echo. "You need perl in your PATH to make a build from GIT."
701 echoscip-shell system . . echo. "Cannot proceed."
702 exit 1
703 fi
704
705 "$relpath/bin/syncqt.pl" -version $QT_VERSION -minimal -module QtCore "$relpath" || exit 1
706 fi
707
708 # $1: input variable name (awk regexp)
709 # $2: optional output variable name
710 # $3: optional value transformation (sed command)
711 # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter
712 # is where the resulting variable is written to
713 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable().()
714 {
715 getQMakeConfscip-shell shell shell-project 0.0.0 getQMakeConf(). "$1" | echoscip-shell system . . echo. ${2-$1} = `if [scip-shell system . . `[`. -n "$3" ]; then sedscip-shell system . . sed. "$3"; else catscip-shell system . . cat.; fi` >> "$mkfile"
716 }
717
718 # build qmake
719 echoscip-shell system . . echo. "Creating qmake..."
720 mkdirscip-shell system . . mkdir. -p "$outpath/qmake" || exit
721
722 in_mkfile=$relpath/qmake/Makefile.unix
723 mkfile=$outpath/qmake/Makefile
724 if [scip-shell system . . `[`. -f "$mkfile" ]; then
725 [scip-shell system . . `[`. "$CFG_DEV" = "yes" ] && "$WHICH" chflags >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && chflags nouchg "$mkfile"
726 rmscip-shell system . . rm. -f "$mkfile"
727 fi
728
729 echoscip-shell system . . echo. "########################################################################" > "$mkfile"
730 echoscip-shell system . . echo. "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
731 echoscip-shell system . . echo. "########################################################################" >> "$mkfile"
732 EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX11) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)"
733 EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)"
734
735 [scip-shell system . . `[`. "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM=
736 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_CC CC "$CC_TRANSFORM"
737 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_CXX CXX "$CC_TRANSFORM"
738 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_CXXFLAGS
739 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_CXXFLAGS_CXX11
740 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_CXXFLAGS_SPLIT_SECTIONS
741 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_LFLAGS
742 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_LFLAGS_GCSECTIONS
743
744 if [scip-shell system . . `[`. "$CFG_DEBUG" = "no" ] || [scip-shell system . . `[`. "$CFG_RELEASE_TOOLS" = "yes" ]; then
745 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_CXXFLAGS_RELEASE
746 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_RELEASE)"
747 else
748 setBootstrapVariablescip-shell shell shell-project 0.0.0 setBootstrapVariable(). QMAKE_CXXFLAGS_DEBUG
749 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(QMAKE_CXXFLAGS_DEBUG)"
750 fi
751
752 adjrelpath=`echoscip-shell system . . echo. "$relpath" | sedscip-shell system . . sed. 's/ /\\\\\\\\ /g'`
753 adjoutpath=`echoscip-shell system . . echo. "$outpath" | sedscip-shell system . . sed. 's/ /\\\\\\\\ /g'`
754 adjqmakespec=`echoscip-shell system . . echo. "$QMAKESPEC" | sedscip-shell system . . sed. 's/ /\\\\\\\\ /g'`
755
756 echoscip-shell system . . echo. "BUILD_PATH = .." >> "$mkfile"
757 echoscip-shell system . . echo. "SOURCE_PATH = $adjrelpath" >> "$mkfile"
758 if [scip-shell system . . `[`. -e "$relpath/.git" ]; then
759 echoscip-shell system . . echo. 'INC_PATH = $(BUILD_PATH)/include' >> "$mkfile"
760 else
761 echoscip-shell system . . echo. 'INC_PATH = $(SOURCE_PATH)/include' >> "$mkfile"
762 fi
763 echoscip-shell system . . echo. "QMAKESPEC = $adjqmakespec" >> "$mkfile"
764 echoscip-shell system . . echo. "QT_VERSION = $QT_VERSION" >> "$mkfile"
765 echoscip-shell system . . echo. "QT_MAJOR_VERSION = $QT_MAJOR_VERSION" >> "$mkfile"
766 echoscip-shell system . . echo. "QT_MINOR_VERSION = $QT_MINOR_VERSION" >> "$mkfile"
767 echoscip-shell system . . echo. "QT_PATCH_VERSION = $QT_PATCH_VERSION" >> "$mkfile"
768 echoscip-shell system . . echo. "CONFIG_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile"
769 echoscip-shell system . . echo. "CONFIG_LFLAGS = $EXTRA_LFLAGS" >> "$mkfile"
770 echoscip-shell system . . echo. "RM_F = rm -f" >> "$mkfile"
771 echoscip-shell system . . echo. "RM_RF = rm -rf" >> "$mkfile"
772
773 case `basenamescip-shell system . . basename. "$PLATFORM"` in
774 win32-*g++*)
775 catscip-shell system . . cat. "$in_mkfile.win32" >> "$mkfile"
776 ;;
777 *)
778 catscip-shell system . . cat. "$in_mkfile.unix" >> "$mkfile"
779 if [scip-shell system . . `[`. "$BUILD_ON_MAC" = "yes" ]; then
780 catscip-shell system . . cat. "$in_mkfile.macos" >> "$mkfile"
781 fi
782 ;;
783 esac
784 echoscip-shell system . . echo. >>"$mkfile"
785
786 if [scip-shell system . . `[`. "$BUILD_ON_MAC" = "yes" ]; then
787 echoscip-shell system . . echo. "EXTRA_CXXFLAGS += -MMD" >> "$mkfile"
788 for arch in $QMAKE_APPLE_DEVICE_ARCHS; do
789 echoscip-shell system . . echo. "EXTRA_CXXFLAGS += -arch $arch" >> "$mkfile"
790 echoscip-shell system . . echo. "EXTRA_LFLAGS += -arch $arch" >> "$mkfile"
791 done
792 catscip-shell system . . cat. "$in_mkfile" >> "$mkfile"
793 echoscip-shell system . . echo. "-include \$(notdir \$(DEPEND_SRC:%.cpp=%.d))" >> "$mkfile"
794 else
795 catscip-shell system . . cat. "$in_mkfile" >> "$mkfile"
796 if "$WHICH" makedepend >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && grepscip-shell system . . grep. 'depend:' "$mkfile" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
797 (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
798 sedscip-shell system . . sed. 's,^.*/\([^/]*.o\):,\1:,g' "$mkfile" >"$mkfile.tmp"
799 sedscip-shell system . . sed. "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
800 rmscip-shell system . . rm. "$mkfile.tmp"
801 fi
802 fi
803
804 if [scip-shell system . . `[`. "$OPT_VERBOSE" = yes ]; then
805 # Show the output of make
806 (cd "$outpath/qmake"; "$MAKE") || exit 2
807 else
808 # Hide the output of make
809 # Use bash to print dots, if we have it, and stdout is a tty.
810 if testscip-shell system . . test. -t 1 && $WHICH bash > /dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
811 bashscip-shell system . . bash. -c 'set -o pipefail
812 cd "$0/qmake"; "$1" | while read line; do
813 builtin echo -n .
814 done' "$outpath" "$MAKE" || exit 2
815 else
816 (cd "$outpath/qmake"; "$MAKE" -s) || exit 2
817 fi
818 echoscip-shell system . . echo. "Done."
819 fi
820
821 #-------------------------------------------------------------------------------
822 # create a qt.conf for the Qt build tree itself
823 #-------------------------------------------------------------------------------
824
825 # Note that this file is just sufficient to boot configure, by which it is
826 # replaced in-place with a version which is suitable for building all of Qt.
827 QTCONFFILE="$outpath/bin/qt.conf"
828 catscip-shell system . . cat. > "$QTCONFFILE" <<EOF
829 [EffectivePaths]
830 Prefix=..
831 [Paths]
832 TargetSpec=dummy
833 HostSpec=$PLATFORM
834 EOF
835 if [scip-shell system . . `[`. x"$relpath" != x"$outpath" ]; then
836 catscip-shell system . . cat. >> "$QTCONFFILE" <<EOF
837 [EffectiveSourcePaths]
838 Prefix=$relpath
839 EOF
840 fi
841
842 #-------------------------------------------------------------------------------
843 # configure and build top-level makefile
844 #-------------------------------------------------------------------------------
845
846 # recreate command line for qmake
847 set -f
848 SAVED_IFS=$IFS
849 IFS='
850 '
851 for i in $QMAKE_CMDLINE; do
852 set -- "$@" "$i"
853 done
854 set +f
855 IFS=$SAVED_IFS
856
857 if [scip-shell system . . `[`. -n "$CFG_TOPLEVEL" ]; then
858 cd ..
859 fi
860
861 if [scip-shell system . . `[`. -n "$CFG_HOST_QT_TOOLS_PATH" ]; then
862 "$CFG_HOST_QT_TOOLS_PATH/qmake" -qtconf "$QTCONFFILE" "$relpathMangled" -- "$@"
863 else
864 "$outpath/bin/qmake" "$relpathMangled" -- "$@"
865 fi