Debian Codegraph @

configure

raw
1 #!/bin/sh
2 # Copyright (C) 2016 The Qt Company Ltd.
3 # Copyright (C) 2016 Intel Corporation.
4 # SPDX-License-Identifier: BSD-3-Clause
5
6 #-------------------------------------------------------------------------------
7 # script initialization
8 #-------------------------------------------------------------------------------
9
10 # the directory of this script is the "source tree"
11 relpath=`dirname "$0"`
12 relpath=`(cd "$relpath"; pwd)`
13 # the current directory is the "build tree" or "object tree"
14 outpath=`pwd`
15 outpathPrefix=$outpath
16
17 # do this early so we don't store it in config.status
18 CFG_TOPLEVEL=
19
20 SAVED_IFS=$IFS
21 IFS='
22 '
23
24 checkTopLevelBuild()
25 {
26 relpathMangled=$relpath
27 if [ x"$1" = x"-top-level" ]; then
28 CFG_TOPLEVEL=yes
29 relpathMangled=`dirname "$relpath"`
30 outpathPrefix="$outpathPrefix/.."
31 else
32 if [ -f ../.qmake.super ]; then
33 echo >&2 "ERROR: You cannot configure qtbase separately within a top-level build."
34 exit 1
35 fi
36 fi
37 }
38
39 OPT_CMDLINE= # expanded version for the script
40 determineOptFilePath()
41 {
42 > "${outpathPrefix}/config.redo.in"
43 set -f # suppress globbing in for loop
44 for i in "$@"; do
45 if [ x"$i" = x"-top-level" ]; then
46 continue
47 fi
48 case $i in
49 -redo|--redo)
50 optfile=${outpathPrefix}/config.opt
51 if ! test -f "$optfile"; then
52 echo >&2 "No config.opt present - cannot redo configuration."
53 exit 1
54 fi
55 ;;
56 *)
57 # If redo-ing, write the rest of parameters into the config.redo.in file
58 echo \"$i\" >> "${outpathPrefix}/config.redo.in"
59 ;;
60 esac
61 done
62 }
63
64 #-------------------------------------------------------------------------------
65 # initialize variables
66 #-------------------------------------------------------------------------------
67
68 OPT_HELP=
69
70 #-------------------------------------------------------------------------------
71 # parse command line arguments
72 #-------------------------------------------------------------------------------
73 parseCommandline()
74 {
75 # parse the arguments, setting things to "yes" or "no"
76 while [ "$#" -gt 0 ]; do
77 CURRENT_OPT="$1"
78 case "$1" in
79 #Autoconf style options
80 --*)
81 VAR=`echo $1 | sed 's,^--\(.*\),\1,'`
82 VAL=yes
83 ;;
84 #General options, including Qt style yes options
85 -*)
86 VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
87 VAL="yes"
88 ;;
89 # most options don't need processing in the configure script, skip them. qmake will do the real validation
90 *)
91 shift
92 continue
93 ;;
94 esac
95
96 shift
97
98 case "$VAR" in
99 h|help)
100 if [ "$VAL" = "yes" ]; then
101 OPT_HELP="$VAL"
102 fi
103 ;;
104 *)
105 ;;
106 esac
107 done
108 }
109
110 #-------------------------------------------------------------------------------
111 # help - interactive parts of the script _after_ this section please
112 #-------------------------------------------------------------------------------
113 handleHelp()
114 {
115 if [ "$OPT_HELP" = "yes" ]; then
116 cat $relpath/config_help.txt
117 if [ -n "$CFG_TOPLEVEL" ]; then
118 IFS='
119 '
120 for i in $relpathMangled/qt*/config_help.txt; do
121 if [ x"$i" != x"$relpath/config_help.txt" ]; then
122 echo
123 cat "$i"
124 fi
125 done
126 fi
127 exit 0
128 fi
129 }
130
131 checkTopLevelBuild "$@"
132 parseCommandline "$@"
133 handleHelp
134 determineOptFilePath "$@"
135
136 optfilepath=${outpathPrefix}/config.opt
137 opttmpfilepath=${outpathPrefix}/config.opt.in
138
139 redofilepath=${outpathPrefix}/config.redo.last
140 redotmpfilepath=${outpathPrefix}/config.redo.in
141
142 fresh_requested_arg=
143 if [ -z "$optfile" ]; then # only write optfile if not currently redoing
144 > "$opttmpfilepath"
145 > "$redotmpfilepath"
146
147 for arg in "$@"; do echo \"$arg\" >> "$opttmpfilepath"; done
148
149 cmake -DIN_FILE="${opttmpfilepath}" -DOUT_FILE="${optfilepath}" -DIGNORE_ARGS=-top-level -P "${relpath}/cmake/QtWriteArgsFile.cmake"
150 else
151 # Rewriting config.opt into config.opt.in anyway. Allows for direct manipulation of config.opt
152 > "$opttmpfilepath"
153 for arg in `cat $optfile`; do echo \"$arg\" >> "$opttmpfilepath"; done
154
155 cmake -DIN_FILE="${opttmpfilepath}" -DREDO_FILE="${redotmpfilepath}" -DOUT_FILE="${redofilepath}" -DIGNORE_ARGS=-top-level -P "${relpath}/cmake/QtWriteArgsFile.cmake"
156 optfilepath=${redofilepath}
157 fresh_requested_arg=-DFRESH_REQUESTED=TRUE
158 fi
159
160 top_level_arg=
161 if [ -n "$CFG_TOPLEVEL" ]; then
162 top_level_arg=-DTOP_LEVEL=TRUE
163 cd ..
164 fi
165
166 exec cmake "-DOPTFILE=${optfilepath}" ${top_level_arg} ${fresh_requested_arg} -P "${relpath}/cmake/QtProcessConfigureArgs.cmake"
167
168 IFS=$SAVED_IFS