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

Diff of /eclass/qt4-build.eclass

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

Revision 1.117 Revision 1.121
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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/qt4-build.eclass,v 1.117 2012/02/09 22:07:34 hwoarang Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.121 2012/03/01 15:06:00 pesa Exp $
4 4
5# @ECLASS: qt4-build.eclass 5# @ECLASS: qt4-build.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Qt herd <qt@gentoo.org> 7# Qt herd <qt@gentoo.org>
8# @BLURB: Eclass for Qt4 split ebuilds. 8# @BLURB: Eclass for Qt4 split ebuilds.
44 !>x11-libs/qt-gui-${PV}-r9999 44 !>x11-libs/qt-gui-${PV}-r9999
45 !<x11-libs/qt-multimedia-${PV} 45 !<x11-libs/qt-multimedia-${PV}
46 !>x11-libs/qt-multimedia-${PV}-r9999 46 !>x11-libs/qt-multimedia-${PV}-r9999
47 !<x11-libs/qt-opengl-${PV} 47 !<x11-libs/qt-opengl-${PV}
48 !>x11-libs/qt-opengl-${PV}-r9999 48 !>x11-libs/qt-opengl-${PV}-r9999
49 !<x11-libs/qt-openvg-${PV}
50 !>x11-libs/qt-openvg-${PV}-r9999
49 !<x11-libs/qt-phonon-${PV} 51 !<x11-libs/qt-phonon-${PV}
50 !>x11-libs/qt-phonon-${PV}-r9999 52 !>x11-libs/qt-phonon-${PV}-r9999
51 !<x11-libs/qt-qt3support-${PV} 53 !<x11-libs/qt-qt3support-${PV}
52 !>x11-libs/qt-qt3support-${PV}-r9999 54 !>x11-libs/qt-qt3support-${PV}-r9999
53 !<x11-libs/qt-script-${PV} 55 !<x11-libs/qt-script-${PV}
194 skip_qmake_build 196 skip_qmake_build
195 skip_project_generation 197 skip_project_generation
196 symlink_binaries_to_buildtree 198 symlink_binaries_to_buildtree
197 fi 199 fi
198 200
199 if [[ ${CHOST} == *86*-apple-darwin* ]] ; then 201 if [[ ${CHOST} == *86*-apple-darwin* ]]; then
200 # qmake bus errors with -O2 but -O3 works 202 # qmake bus errors with -O2 but -O3 works
201 replace-flags -O2 -O3 203 replace-flags -O2 -O3
202 fi 204 fi
203 205
204 # Bug 178652 206 # Bug 178652
215 ewarn "disabled." 217 ewarn "disabled."
216 append-flags -std=c++0x 218 append-flags -std=c++0x
217 fi 219 fi
218 220
219 # Unsupported old gcc versions - hardened needs this :( 221 # Unsupported old gcc versions - hardened needs this :(
220 if [[ $(gcc-major-version) -lt 4 ]] ; then 222 if [[ $(gcc-major-version) -lt 4 ]]; then
221 ewarn "Appending -fno-stack-protector to CXXFLAGS" 223 ewarn "Appending -fno-stack-protector to CXXFLAGS"
222 append-cxxflags -fno-stack-protector 224 append-cxxflags -fno-stack-protector
223 # Bug 253127 225 # Bug 253127
224 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ 226 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
225 -i mkspecs/common/g++.conf || die 227 -i mkspecs/common/g++.conf || die
280 -e "s:-Xarch_ppc64::g" \ 282 -e "s:-Xarch_ppc64::g" \
281 -i configure mkspecs/common/mac-g++.conf \ 283 -i configure mkspecs/common/mac-g++.conf \
282 || die "sed -arch/-Xarch failed" 284 || die "sed -arch/-Xarch failed"
283 285
284 # On Snow Leopard don't fall back to 10.5 deployment target. 286 # On Snow Leopard don't fall back to 10.5 deployment target.
285 if [[ ${CHOST} == *-apple-darwin10 ]] ; then 287 if [[ ${CHOST} == *-apple-darwin10 ]]; then
286 sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \ 288 sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \
287 -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \ 289 -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \
288 -i configure mkspecs/common/mac-g++.conf \ 290 -i configure mkspecs/common/mac-g++.conf \
289 || die "sed deployment target failed" 291 || die "sed deployment target failed"
290 fi 292 fi
291 fi 293 fi
292 294
293 # this one is needed for all systems with a separate -liconv, apart from 295 # this one is needed for all systems with a separate -liconv, apart from
294 # Darwin, for which the sources already cater for -liconv 296 # Darwin, for which the sources already cater for -liconv
295 if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] ; then 297 if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]]; then
296 sed -e 's|mac:\(LIBS += -liconv\)|\1|g' \ 298 sed -e 's|mac:\(LIBS += -liconv\)|\1|g' \
297 -i config.tests/unix/iconv/iconv.pro \ 299 -i config.tests/unix/iconv/iconv.pro \
298 || die "sed iconv.pro failed" 300 || die "sed iconv.pro failed"
299 fi 301 fi
300 302
313# @FUNCTION: qt4-build_src_configure 315# @FUNCTION: qt4-build_src_configure
314# @DESCRIPTION: 316# @DESCRIPTION:
315# Default configure phase 317# Default configure phase
316qt4-build_src_configure() { 318qt4-build_src_configure() {
317 setqtenv 319 setqtenv
318 myconf="$(standard_configure_options) ${myconf}" 320
321 local conf="
322 -prefix ${QTPREFIXDIR}
323 -bindir ${QTBINDIR}
324 -libdir ${QTLIBDIR}
325 -docdir ${QTDOCDIR}
326 -headerdir ${QTHEADERDIR}
327 -plugindir ${QTPLUGINDIR}
328 $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR})
329 -datadir ${QTDATADIR}
330 -translationdir ${QTTRANSDIR}
331 -sysconfdir ${QTSYSCONFDIR}
332 -examplesdir ${QTEXAMPLESDIR}
333 -demosdir ${QTDEMOSDIR}
334 -opensource -confirm-license
335 -shared -fast -largefile -stl -verbose
336 -nomake examples -nomake demos"
337
338 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
339 # $(tc-arch). Therefore we convert it to supported values.
340 case "$(tc-arch)" in
341 amd64|x64-*) conf+=" -arch x86_64" ;;
342 ppc-macos) conf+=" -arch ppc" ;;
343 ppc|ppc64|ppc-*) conf+=" -arch powerpc" ;;
344 sparc|sparc-*|sparc64-*) conf+=" -arch sparc" ;;
345 x86-macos) conf+=" -arch x86" ;;
346 x86|x86-*) conf+=" -arch i386" ;;
347 alpha|arm|ia64|mips|s390) conf+=" -arch $(tc-arch)" ;;
348 hppa|sh) conf+=" -arch generic" ;;
349 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
350 esac
351
352 conf+=" -platform $(qt_mkspecs_dir)"
353
354 [[ $(get_libdir) != lib ]] && conf+=" -L${EPREFIX}/usr/$(get_libdir)"
355
356 # debug/release
357 if use debug; then
358 conf+=" -debug"
359 else
360 conf+=" -release"
361 fi
362 conf+=" -no-separate-debug-info"
363
364 # exceptions USE flag
365 conf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)"
366
367 # disable RPATH on Qt >= 4.8 (bug 380415)
368 version_is_at_least 4.8 && conf+=" -no-rpath"
369
370 # precompiled headers don't work on hardened, where the flag is masked
371 conf+=" $(qt_use pch)"
372
373 # -reduce-relocations
374 # This flag seems to introduce major breakage to applications,
375 # mostly to be seen as a core dump with the message "QPixmap: Must
376 # construct a QApplication before a QPaintDevice" on Solaris.
377 # -- Daniel Vergien
378 [[ ${CHOST} != *-solaris* ]] && conf+=" -reduce-relocations"
319 379
320 # this one is needed for all systems with a separate -liconv, apart from 380 # this one is needed for all systems with a separate -liconv, apart from
321 # Darwin, for which the sources already cater for -liconv 381 # Darwin, for which the sources already cater for -liconv
322 use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] && \ 382 if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]]; then
323 myconf+=" -liconv" 383 conf+=" -liconv"
384 fi
324 385
325 if use_if_iuse glib; then 386 if use_if_iuse glib; then
326 # use -I, -L and -l from configure
327 local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)" 387 local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)"
328 # avoid the -pthread argument 388 # avoid the -pthread argument
329 myconf+=" ${glibflags//-pthread}" 389 conf+=" ${glibflags//-pthread}"
330 unset glibflags 390 unset glibflags
331 fi 391 fi
332 392
333 if use_if_iuse qpa; then 393 if use_if_iuse qpa; then
334 ewarn 394 ewarn
335 ewarn "The qpa useflag enables the Qt Platform Abstraction, formely" 395 ewarn "The qpa useflag enables the Qt Platform Abstraction, formely"
336 ewarn "known as Qt Lighthouse. If you are not sure what that is, then" 396 ewarn "known as Qt Lighthouse. If you are not sure what that is, then"
337 ewarn "disable it before reporting any bugs related to this useflag." 397 ewarn "disable it before reporting any bugs related to this useflag."
338 ewarn 398 ewarn
339 myconf+=" -qpa" 399 conf+=" -qpa"
340 fi 400 fi
341 401
342 if use aqua ; then 402 if use aqua; then
343 # On (snow) leopard use the new (frameworked) cocoa code. 403 # On (snow) leopard use the new (frameworked) cocoa code.
344 if [[ ${CHOST##*-darwin} -ge 9 ]] ; then 404 if [[ ${CHOST##*-darwin} -ge 9 ]]; then
345 myconf+=" -cocoa -framework" 405 conf+=" -cocoa -framework"
406 # We need the source's headers, not the installed ones.
407 conf+=" -I${S}/include"
408 # Add hint for the framework location.
409 conf+=" -F${QTLIBDIR}"
346 410
347 # We are crazy and build cocoa + qt3support :-) 411 # We are crazy and build cocoa + qt3support :-)
348 if use qt3support; then 412 if use qt3support; then
349 sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \ 413 sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \
350 -i configure || die 414 -i configure || die
351 fi 415 fi
352 416 else
353 # We need the source's headers, not the installed ones. 417 conf+=" -no-framework"
354 myconf+=" -I${S}/include"
355
356 # Add hint for the framework location.
357 myconf+=" -F${QTLIBDIR}"
358 fi 418 fi
359 else 419 else
360 # freetype2 include dir is non-standard, thus include it on configure 420 # freetype2 include dir is non-standard, thus pass it to configure
361 # use -I from configure
362 myconf+=" $(pkg-config --cflags freetype2)" 421 conf+=" $(pkg-config --cflags-only-I freetype2)"
363 fi 422 fi
364 423
424 conf+=" ${myconf}"
425 myconf=
426
365 echo ./configure ${myconf} 427 echo ./configure ${conf}
366 ./configure ${myconf} || die "./configure failed" 428 ./configure ${conf} || die "./configure failed"
367 myconf=""
368 429
369 prepare_directories ${QT4_TARGET_DIRECTORIES} 430 prepare_directories ${QT4_TARGET_DIRECTORIES}
370} 431}
371 432
372# @FUNCTION: qt4-build_src_compile 433# @FUNCTION: qt4-build_src_compile
380 441
381# @FUNCTION: qt4-build_src_test 442# @FUNCTION: qt4-build_src_test
382# @DESCRIPTION: 443# @DESCRIPTION:
383# Runs tests only in target directories. 444# Runs tests only in target directories.
384qt4-build_src_test() { 445qt4-build_src_test() {
446 # QtMultimedia does not have any test suite (bug #332299)
447 [[ ${PN} == "qt-multimedia" ]] && return
448
385 for dir in ${QT4_TARGET_DIRECTORIES}; do 449 for dir in ${QT4_TARGET_DIRECTORIES}; do
386 emake -j1 check -C ${dir} 450 emake -j1 check -C ${dir}
387 done 451 done
388} 452}
389 453
390# @FUNCTION: fix_includes 454# @FUNCTION: fix_includes
391# @DESCRIPTION: 455# @DESCRIPTION:
392# For MacOS X we need to add some symlinks when frameworks are 456# For MacOS X we need to add some symlinks when frameworks are
393# being used, to avoid complications with some more or less stupid packages. 457# being used, to avoid complications with some more or less stupid packages.
394fix_includes() { 458fix_includes() {
395 if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]] ; then 459 if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]]; then
396 # Some packages tend to include <Qt/...> 460 # Some packages tend to include <Qt/...>
397 dodir "${QTHEADERDIR#${EPREFIX}}"/Qt 461 dodir "${QTHEADERDIR#${EPREFIX}}"/Qt
398 462
399 # Fake normal headers when frameworks are installed... eases life later on 463 # Fake normal headers when frameworks are installed... eases life later on
400 local dest f h 464 local dest f h
450 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4 514 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4
451 515
452 PLATFORM=$(qt_mkspecs_dir) 516 PLATFORM=$(qt_mkspecs_dir)
453 517
454 unset QMAKESPEC 518 unset QMAKESPEC
455}
456
457# @FUNCTION: standard_configure_options
458# @INTERNAL
459# @DESCRIPTION:
460# Sets up some standard configure options, like libdir (if necessary), whether
461# debug info is wanted or not.
462standard_configure_options() {
463 local myconf="-prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
464 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR}
465 $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR})
466 -datadir ${QTDATADIR} -translationdir ${QTTRANSDIR} -sysconfdir ${QTSYSCONFDIR}
467 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}
468 -opensource -confirm-license -shared -fast -largefile -stl -verbose
469 -platform $(qt_mkspecs_dir) -nomake examples -nomake demos"
470
471 [[ $(get_libdir) != lib ]] && myconf+=" -L${EPREFIX}/usr/$(get_libdir)"
472
473 # debug/release
474 if use debug; then
475 myconf+=" -debug"
476 else
477 myconf+=" -release"
478 fi
479 myconf+=" -no-separate-debug-info"
480
481 # exceptions USE flag
482 local exceptions="-exceptions"
483 in_iuse exceptions && exceptions="$(qt_use exceptions)"
484 myconf+=" ${exceptions}"
485
486 # disable RPATH on Qt >= 4.8 (bug 380415)
487 version_is_at_least 4.8 && myconf+=" -no-rpath"
488
489 # precompiled headers don't work on hardened, where the flag is masked
490 myconf+=" $(qt_use pch)"
491
492 # -reduce-relocations
493 # This flag seems to introduce major breakage to applications,
494 # mostly to be seen as a core dump with the message "QPixmap: Must
495 # construct a QApplication before a QPaintDevice" on Solaris.
496 # -- Daniel Vergien
497 [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations"
498
499 use aqua && myconf+=" -no-framework"
500
501 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
502 # $(tc-arch). Therefore we convert it to supported values.
503 case "$(tc-arch)" in
504 amd64|x64-*) myconf+=" -arch x86_64" ;;
505 ppc-macos) myconf+=" -arch ppc" ;;
506 ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;;
507 sparc|sparc-*|sparc64-*) myconf+=" -arch sparc" ;;
508 x86-macos) myconf+=" -arch x86" ;;
509 x86|x86-*) myconf+=" -arch i386" ;;
510 alpha|arm|ia64|mips|s390) myconf+=" -arch $(tc-arch)" ;;
511 hppa|sh) myconf+=" -arch generic" ;;
512 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
513 esac
514
515 echo "${myconf}"
516} 519}
517 520
518# @FUNCTION: prepare_directories 521# @FUNCTION: prepare_directories
519# @USAGE: < directories > 522# @USAGE: < directories >
520# @INTERNAL 523# @INTERNAL

Legend:
Removed from v.1.117  
changed lines
  Added in v.1.121

  ViewVC Help
Powered by ViewVC 1.1.20