Lines 218-257
Link Here
|
218 |
# @FUNCTION: eqmake4 |
218 |
# @FUNCTION: eqmake4 |
219 |
# @USAGE: [.pro file] [additional parameters to qmake] |
219 |
# @USAGE: [.pro file] [additional parameters to qmake] |
220 |
# @DESCRIPTION: |
220 |
# @DESCRIPTION: |
221 |
# Runs qmake on the specified .pro file (defaults to |
221 |
# Runs qmake on the specified .pro file (defaults to ${PN}.pro if called |
222 |
# ${PN}.pro if eqmake4 was called with no argument). |
222 |
# without arguments). Additional parameters are appended unmodified to |
223 |
# Additional parameters are passed unmodified to qmake. |
223 |
# qmake command line. |
224 |
eqmake4() { |
224 |
eqmake4() { |
225 |
local LOGFILE="${T}/qmake-$$.out" |
225 |
local logfile="${T}/eqmake4-$$.log" |
226 |
local projprofile="${1}" |
226 |
local projectfile="${1:-${PN}.pro}" |
227 |
[[ -z ${projprofile} ]] && projprofile="${PN}.pro" |
227 |
shift |
228 |
shift 1 |
228 |
|
229 |
|
229 |
if [[ ! -f ${projectfile} ]]; then |
230 |
ebegin "Processing qmake ${projprofile}" |
230 |
echo |
231 |
|
231 |
eerror "Project file '${projectfile}' does not exists!" |
232 |
# file exists? |
232 |
eerror "eqmake4 cannot handle non-existing project files." |
233 |
if [[ ! -f ${projprofile} ]]; then |
233 |
eerror |
234 |
echo |
234 |
eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" |
235 |
eerror "Project .pro file \"${projprofile}\" does not exists" |
|
|
236 |
eerror "qmake cannot handle non-existing .pro files" |
237 |
echo |
235 |
echo |
238 |
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
236 |
die "Project file not found in ${CATEGORY}/${PN} sources." |
239 |
echo |
|
|
240 |
die "Project file not found in ${PN} sources" |
241 |
fi |
237 |
fi |
242 |
|
238 |
|
243 |
echo >> ${LOGFILE} |
239 |
ebegin "Running qmake on ${projectfile}" |
244 |
echo "****** qmake ${projprofile} ******" >> ${LOGFILE} |
|
|
245 |
echo >> ${LOGFILE} |
246 |
|
240 |
|
247 |
# as a workaround for broken qmake, put everything into file |
241 |
echo >> "${logfile}" |
|
|
242 |
echo "****** qmake ${projectfile} ******" >> "${logfile}" |
243 |
echo >> "${logfile}" |
244 |
|
245 |
# make sure CONFIG variable is correctly set for both release and debug builds |
246 |
local CONFIG_ADD="release" |
247 |
local CONFIG_REMOVE="debug" |
248 |
if has debug ${IUSE} && use debug; then |
248 |
if has debug ${IUSE} && use debug; then |
249 |
echo -e "\nCONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile} |
249 |
CONFIG_ADD="debug" |
250 |
else |
250 |
CONFIG_REMOVE="release" |
251 |
echo -e "\nCONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile} |
|
|
252 |
fi |
251 |
fi |
|
|
252 |
local awkscript='BEGIN { |
253 |
fixed=0; |
254 |
} |
255 |
/^[[:blank:]]*CONFIG[[:blank:]]*[\+\*]?=/ { |
256 |
for (i=1; i <= NF; i++) { |
257 |
if ($i ~ rem || $i ~ /debug_and_release/) |
258 |
{ $i=add; fixed=1; } |
259 |
} |
260 |
} |
261 |
/^[[:blank:]]*CONFIG[[:blank:]]*-=/ { |
262 |
for (i=1; i <= NF; i++) { |
263 |
if ($i ~ add) { $i=rem; fixed=1; } |
264 |
} |
265 |
} |
266 |
{ |
267 |
print >> file; |
268 |
} |
269 |
END { |
270 |
printf "CONFIG -= debug_and_release %s\n", rem >> file; |
271 |
printf "CONFIG += %s\n", add >> file; |
272 |
print fixed; |
273 |
}' |
274 |
local file= |
275 |
while read file; do |
276 |
local retval=$({ |
277 |
rm -f "${file}" |
278 |
awk -- "${awkscript}" file="${file}" add=${CONFIG_ADD} rem=${CONFIG_REMOVE} \ |
279 |
|| die "awk failed to process '${file}'." |
280 |
} < "${file}") |
281 |
if [[ ${retval} -eq 1 ]]; then |
282 |
einfo " Fixed CONFIG in ${file}" |
283 |
elif [[ ${retval} -ne 0 ]]; then |
284 |
ewarn " An error occurred while processing ${file}: awk script returned ${retval}" |
285 |
fi |
286 |
done < <(find "$(dirname "${projectfile}")" -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null) |
253 |
|
287 |
|
254 |
/usr/bin/qmake ${projprofile} \ |
288 |
/usr/bin/qmake -makefile -nocache \ |
255 |
QTDIR=/usr/$(get_libdir) \ |
289 |
QTDIR=/usr/$(get_libdir) \ |
256 |
QMAKE=/usr/bin/qmake \ |
290 |
QMAKE=/usr/bin/qmake \ |
257 |
QMAKE_CC=$(tc-getCC) \ |
291 |
QMAKE_CC=$(tc-getCC) \ |
Lines 265-286
Link Here
|
265 |
QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
299 |
QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
266 |
QMAKE_RPATH= \ |
300 |
QMAKE_RPATH= \ |
267 |
QMAKE_STRIP= \ |
301 |
QMAKE_STRIP= \ |
268 |
"${@}" >> ${LOGFILE} 2>&1 |
302 |
"${projectfile}" \ |
|
|
303 |
"${@}" >> "${logfile}" 2>&1 |
269 |
|
304 |
|
270 |
local result=$? |
305 |
eend $? |
271 |
eend ${result} |
|
|
272 |
|
306 |
|
273 |
# was qmake successful? |
307 |
# was qmake successful? |
274 |
if [[ ${result} -ne 0 ]]; then |
308 |
if [[ $? -ne 0 ]]; then |
275 |
echo |
|
|
276 |
eerror "Running qmake on \"${projprofile}\" has failed" |
277 |
echo |
309 |
echo |
278 |
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
310 |
eerror "Running qmake on '${projectfile}' has failed!" |
|
|
311 |
eerror |
312 |
eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" |
313 |
eerror "A complete log of qmake output is located at '${logfile}'." |
279 |
echo |
314 |
echo |
280 |
die "qmake failed on ${projprofile}" |
315 |
die "qmake failed on '${projectfile}'." |
281 |
fi |
316 |
fi |
282 |
|
317 |
|
283 |
return ${result} |
318 |
return 0 |
284 |
} |
319 |
} |
285 |
|
320 |
|
286 |
case ${EAPI:-0} in |
321 |
case ${EAPI:-0} in |