Lines 226-264
Link Here
|
226 |
# Davide Pesavento <davidepesa@gmail.com> |
226 |
# Davide Pesavento <davidepesa@gmail.com> |
227 |
# @DESCRIPTION: |
227 |
# @DESCRIPTION: |
228 |
# Runs qmake on the specified .pro file (defaults to |
228 |
# Runs qmake on the specified .pro file (defaults to |
229 |
# ${PN}.pro if eqmake4 was called with no argument). |
229 |
# ${PN}.pro if eqmake4 was called without arguments). |
230 |
# Additional parameters are passed unmodified to qmake. |
230 |
# Additional parameters are appended unmodified to |
|
|
231 |
# qmake command line. |
231 |
eqmake4() { |
232 |
eqmake4() { |
232 |
local LOGFILE="${T}/qmake-$$.out" |
233 |
local logfile="${T}"/eqmake4-$$.log |
233 |
local projprofile="${1}" |
234 |
local projectfile="${1:-${PN}.pro}" |
234 |
[[ -z ${projprofile} ]] && projprofile="${PN}.pro" |
235 |
local outputfile="$(dirname "${projectfile}")"/Makefile |
235 |
shift 1 |
236 |
shift |
236 |
|
237 |
|
237 |
ebegin "Processing qmake ${projprofile}" |
238 |
if [[ ! -f ${projectfile} ]]; then |
238 |
|
239 |
echo |
239 |
# file exists? |
240 |
eerror "Project file '${projectfile}' does not exists!" |
240 |
if [[ ! -f ${projprofile} ]]; then |
241 |
eerror "eqmake4 cannot handle non-existing project files." |
241 |
echo |
242 |
eerror |
242 |
eerror "Project .pro file \"${projprofile}\" does not exists" |
243 |
eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" |
243 |
eerror "qmake cannot handle non-existing .pro files" |
|
|
244 |
echo |
245 |
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
246 |
echo |
244 |
echo |
247 |
die "Project file not found in ${PN} sources" |
245 |
die "Project file not found in ${CATEGORY}/${PN} sources." |
248 |
fi |
246 |
fi |
249 |
|
247 |
|
250 |
echo >> ${LOGFILE} |
248 |
# examine arguments to detect if a different |
251 |
echo "****** qmake ${projprofile} ******" >> ${LOGFILE} |
249 |
# output file was specified by the -o option |
252 |
echo >> ${LOGFILE} |
250 |
local arg= i= |
253 |
|
251 |
for ((i=$#; i > 0; i--)); do |
254 |
# as a workaround for broken qmake, put everything into file |
252 |
eval arg=\$$i |
|
|
253 |
if [[ "${arg}" = "-o" ]]; then |
254 |
eval outputfile=\$$(expr ${i} + 1) |
255 |
break |
256 |
fi |
257 |
done |
258 |
|
259 |
ebegin "Running qmake on ${projectfile}" |
260 |
|
261 |
echo >> "${logfile}" |
262 |
echo "****** qmake ${projectfile} ******" >> "${logfile}" |
263 |
echo >> "${logfile}" |
264 |
|
265 |
# make sure CONFIG variable is correctly set for both release and debug builds |
266 |
local CONFIG_ADD="release" |
267 |
local CONFIG_REMOVE="debug" |
255 |
if has debug ${IUSE} && use debug; then |
268 |
if has debug ${IUSE} && use debug; then |
256 |
echo -e "\nCONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile} |
269 |
CONFIG_ADD="debug" |
257 |
else |
270 |
CONFIG_REMOVE="release" |
258 |
echo -e "\nCONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile} |
|
|
259 |
fi |
271 |
fi |
|
|
272 |
local awkscript='BEGIN { |
273 |
fixed=0; |
274 |
} |
275 |
/^[[:blank:]]*CONFIG[[:blank:]]*[\+\*]?=/ { |
276 |
for (i=1; i <= NF; i++) { |
277 |
if ($i ~ rem || $i ~ /debug_and_release/) |
278 |
{ $i=add; fixed=1; } |
279 |
} |
280 |
} |
281 |
/^[[:blank:]]*CONFIG[[:blank:]]*-=/ { |
282 |
for (i=1; i <= NF; i++) { |
283 |
if ($i ~ add) { $i=rem; fixed=1; } |
284 |
} |
285 |
} |
286 |
{ |
287 |
print >> file; |
288 |
} |
289 |
END { |
290 |
printf "CONFIG -= debug_and_release %s\n", rem >> file; |
291 |
printf "CONFIG += %s\n", add >> file; |
292 |
print fixed; |
293 |
}' |
294 |
local file= |
295 |
while read file; do |
296 |
local retval=$({ |
297 |
rm -f "${file}" |
298 |
awk -- "${awkscript}" file="${file}" add=${CONFIG_ADD} rem=${CONFIG_REMOVE} \ |
299 |
|| die "awk failed to process '${file}'." |
300 |
} < "${file}") |
301 |
if [[ ${retval} -eq 1 ]]; then |
302 |
einfo " Fixed CONFIG in ${file}" |
303 |
elif [[ ${retval} -ne 0 ]]; then |
304 |
ewarn " An error occurred while processing ${file}: awk script returned ${retval}" |
305 |
fi |
306 |
done < <(find "$(dirname "${projectfile}")" -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null) |
260 |
|
307 |
|
261 |
/usr/bin/qmake ${projprofile} \ |
308 |
/usr/bin/qmake -makefile -nocache \ |
262 |
QTDIR=/usr/$(get_libdir) \ |
309 |
QTDIR=/usr/$(get_libdir) \ |
263 |
QMAKE=/usr/bin/qmake \ |
310 |
QMAKE=/usr/bin/qmake \ |
264 |
QMAKE_CC=$(tc-getCC) \ |
311 |
QMAKE_CC=$(tc-getCC) \ |
Lines 271-292
Link Here
|
271 |
QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
318 |
QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
272 |
QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
319 |
QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
273 |
QMAKE_RPATH= \ |
320 |
QMAKE_RPATH= \ |
274 |
"${@}" >> ${LOGFILE} 2>&1 |
321 |
"${projectfile}" \ |
|
|
322 |
"${@}" >> "${logfile}" 2>&1 |
275 |
|
323 |
|
276 |
local result=$? |
324 |
eend $? |
277 |
eend ${result} |
|
|
278 |
|
325 |
|
279 |
# was qmake successful? |
326 |
# was qmake successful? |
280 |
if [[ ${result} -ne 0 ]]; then |
327 |
if [[ $? -ne 0 ]]; then |
281 |
echo |
|
|
282 |
eerror "Running qmake on \"${projprofile}\" has failed" |
283 |
echo |
328 |
echo |
284 |
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
329 |
eerror "Running qmake on '${projectfile}' has failed!" |
|
|
330 |
eerror |
331 |
eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" |
332 |
eerror "A complete log of qmake output is located at '${logfile}'." |
285 |
echo |
333 |
echo |
286 |
die "qmake failed on ${projprofile}" |
334 |
die "qmake failed on '${projectfile}'." |
287 |
fi |
335 |
fi |
288 |
|
336 |
|
289 |
return ${result} |
337 |
# remove stripping from generated Makefile (bug #221745) |
|
|
338 |
sed -i -e '/strip /d' "${outputfile}" || ewarn "sed failed to remove stripping from ${outputfile}" |
339 |
|
340 |
return 0 |
290 |
} |
341 |
} |
291 |
|
342 |
|
292 |
EXPORT_FUNCTIONS pkg_setup |
343 |
EXPORT_FUNCTIONS pkg_setup |