/[gentoo-x86]/eclass/qt4.eclass
Gentoo

Diff of /eclass/qt4.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.52 Revision 1.53
1# Copyright 2005-2009 Gentoo Foundation 1-e # Copyright 2005-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.52 2009/03/14 23:30:05 yngwin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.53 2009/05/09 12:45:40 hwoarang Exp $
4 4
5# @ECLASS: qt4.eclass 5# @ECLASS: qt4.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Ben de Groot <yngwin@gentoo.org>, 7# Ben de Groot <yngwin@gentoo.org>,
8# Markos Chandras <hwoarang@gentoo.org>, 8# Markos Chandras <hwoarang@gentoo.org>,
216#} 216#}
217 217
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. For recursive build systems, i.e. those based on
224# the subdirs template, you should run eqmake4 on the top-level project
225# file only, unless you have strong reasons to do things differently.
226# During the building, qmake will be automatically re-invoked with the
227# right arguments on every directory specified inside the top-level
228# project file by the SUBDIRS variable.
224eqmake4() { 229eqmake4() {
225 local LOGFILE="${T}/qmake-$$.out" 230 local projectfile="${1:-${PN}.pro}"
226 local projprofile="${1}"
227 [[ -z ${projprofile} ]] && projprofile="${PN}.pro"
228 shift 1 231 shift
229 232
230 ebegin "Processing qmake ${projprofile}"
231
232 # file exists?
233 if [[ ! -f ${projprofile} ]]; then 233 if [[ ! -f ${projectfile} ]]; then
234 echo 234 echo
235 eerror "Project .pro file \"${projprofile}\" does not exists" 235 eerror "Project file '${projectfile#${WORKDIR}/}' does not exists!"
236 eerror "qmake cannot handle non-existing .pro files" 236 eerror "eqmake4 cannot handle non-existing project files."
237 eerror
238 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/"
237 echo 239 echo
238 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
239 echo
240 die "Project file not found in ${PN} sources" 240 die "Project file not found in ${CATEGORY}/${PN} sources."
241 fi 241 fi
242 242
243 echo >> ${LOGFILE} 243 ebegin "Running qmake on ${projectfile}"
244 echo "****** qmake ${projprofile} ******" >> ${LOGFILE}
245 echo >> ${LOGFILE}
246 244
247 # as a workaround for broken qmake, put everything into file 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} 251 fi
252 local awkscript='BEGIN {
253 printf "### eqmake4 was here ###\n" > file;
254 fixed=0;
255 }
256 /^[[:blank:]]*CONFIG[[:blank:]]*[\+\*]?=/ {
257 for (i=1; i <= NF; i++) {
258 if ($i ~ rem || $i ~ /debug_and_release/)
259 { $i=add; fixed=1; }
260 }
261 }
262 /^[[:blank:]]*CONFIG[[:blank:]]*-=/ {
263 for (i=1; i <= NF; i++) {
264 if ($i ~ add) { $i=rem; fixed=1; }
265 }
266 }
267 {
268 print >> file;
269 }
270 END {
271 printf "CONFIG -= debug_and_release %s\n", rem >> file;
272 printf "CONFIG += %s\n", add >> file;
273 print fixed;
274 }'
275 local file=
276 while read file; do
277 grep -q '^### eqmake4 was here ###$' "${file}" && continue
278 local retval=$({
279 rm -f "${file}" || echo "FAILED"
280 awk -v file="${file}" -- "${awkscript}" add=${CONFIG_ADD} rem=${CONFIG_REMOVE} || echo "FAILED"
281 } < "${file}")
282 if [[ ${retval} == 1 ]]; then
283 einfo " Fixed CONFIG in ${file}"
284 elif [[ ${retval} != 0 ]]; then
285 eerror " An error occurred while processing ${file}"
286 die "eqmake4 failed to process '${file}'."
252 fi 287 fi
288 done < <(find "$(dirname "${projectfile}")" -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null)
253 289
254 /usr/bin/qmake ${projprofile} \ 290 /usr/bin/qmake -makefile -nocache \
255 QTDIR=/usr/$(get_libdir) \ 291 QTDIR=/usr/$(get_libdir) \
256 QMAKE=/usr/bin/qmake \ 292 QMAKE=/usr/bin/qmake \
257 QMAKE_CC=$(tc-getCC) \ 293 QMAKE_CC=$(tc-getCC) \
258 QMAKE_CXX=$(tc-getCXX) \ 294 QMAKE_CXX=$(tc-getCXX) \
259 QMAKE_LINK=$(tc-getCXX) \ 295 QMAKE_LINK=$(tc-getCXX) \
263 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ 299 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
264 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ 300 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
265 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ 301 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
266 QMAKE_RPATH= \ 302 QMAKE_RPATH= \
267 QMAKE_STRIP= \ 303 QMAKE_STRIP= \
268 "${@}" >> ${LOGFILE} 2>&1 304 "${projectfile}" "${@}"
269 305
270 local result=$? 306 eend $?
271 eend ${result}
272 307
273 # was qmake successful? 308 # was qmake successful?
274 if [[ ${result} -ne 0 ]]; then 309 if [[ $? -ne 0 ]]; then
275 echo 310 echo
276 eerror "Running qmake on \"${projprofile}\" has failed" 311 eerror "Running qmake on '${projectfile#${WORKDIR}/}' has failed!"
312 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/"
277 echo 313 echo
278 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
279 echo
280 die "qmake failed on ${projprofile}" 314 die "qmake failed on '${projectfile}'."
281 fi 315 fi
282 316
283 return ${result} 317 return 0
284} 318}
285 319
286case ${EAPI:-0} in 320case ${EAPI:-0} in
287 2) 321 2)
288 EXPORT_FUNCTIONS pkg_setup src_prepare 322 EXPORT_FUNCTIONS pkg_setup src_prepare

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20