/[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.114 Revision 1.122
1# Copyright 1999-2011 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.114 2012/01/01 18:12:03 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.122 2012/03/01 15:19:14 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}
109 QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm 111 QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm
110 ${QT4_EXTRACT_DIRECTORIES}" 112 ${QT4_EXTRACT_DIRECTORIES}"
111 fi 113 fi
112 114
113 # Make sure ebuilds use the required EAPI 115 # Make sure ebuilds use the required EAPI
114 if [[ ${EAPI} != [23] ]]; then 116 if [[ ${EAPI} != [234] ]]; then
115 eerror "The qt4-build eclass requires EAPI=2 or EAPI=3, but this ebuild is using" 117 eerror "The qt4-build eclass requires EAPI 2,3 or 4 but this ebuild is using"
116 eerror "EAPI=${EAPI:-0}. The ebuild author or editor failed. This ebuild needs to be" 118 eerror "EAPI=${EAPI:-0}. The ebuild author or editor failed. This ebuild needs to be"
117 eerror "fixed. Using qt4-build eclass without EAPI=2 or EAPI=3 will fail." 119 eerror "fixed. Using qt4-build eclass without EAPI 2,3 or 4 will fail."
118 die "qt4-build eclass requires EAPI=2 or EAPI=3" 120 die "qt4-build eclass requires EAPI 2,3 or 4"
119 fi 121 fi
120 122
121 if ! version_is_at_least 4.1 $(gcc-version); then 123 if ! version_is_at_least 4.1 $(gcc-version); then
122 ewarn "Using a GCC version lower than 4.1 is not supported!" 124 ewarn "Using a GCC version lower than 4.1 is not supported!"
123 fi 125 fi
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 -importdir ${QTIMPORTDIR} -datadir ${QTDATADIR} -translationdir ${QTTRANSDIR}
466 -sysconfdir ${QTSYSCONFDIR} -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}
467 -opensource -confirm-license -shared -fast -largefile -stl -verbose
468 -platform $(qt_mkspecs_dir) -nomake examples -nomake demos"
469
470 [[ $(get_libdir) != lib ]] && myconf+=" -L${EPREFIX}/usr/$(get_libdir)"
471
472 # debug/release
473 if use debug; then
474 myconf+=" -debug"
475 else
476 myconf+=" -release"
477 fi
478 myconf+=" -no-separate-debug-info"
479
480 # exceptions USE flag
481 local exceptions="-exceptions"
482 in_iuse exceptions && exceptions="$(qt_use exceptions)"
483 myconf+=" ${exceptions}"
484
485 # disable RPATH on Qt >= 4.8 (bug 380415)
486 version_is_at_least 4.8 && myconf+=" -no-rpath"
487
488 # precompiled headers don't work on hardened, where the flag is masked
489 myconf+=" $(qt_use pch)"
490
491 # -reduce-relocations
492 # This flag seems to introduce major breakage to applications,
493 # mostly to be seen as a core dump with the message "QPixmap: Must
494 # construct a QApplication before a QPaintDevice" on Solaris.
495 # -- Daniel Vergien
496 [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations"
497
498 use aqua && myconf+=" -no-framework"
499
500 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
501 # $(tc-arch). Therefore we convert it to supported values.
502 case "$(tc-arch)" in
503 amd64|x64-*) myconf+=" -arch x86_64" ;;
504 ppc-macos) myconf+=" -arch ppc" ;;
505 ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;;
506 sparc|sparc-*|sparc64-*) myconf+=" -arch sparc" ;;
507 x86-macos) myconf+=" -arch x86" ;;
508 x86|x86-*) myconf+=" -arch i386" ;;
509 alpha|arm|ia64|mips|s390) myconf+=" -arch $(tc-arch)" ;;
510 hppa|sh) myconf+=" -arch generic" ;;
511 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
512 esac
513
514 echo "${myconf}"
515} 519}
516 520
517# @FUNCTION: prepare_directories 521# @FUNCTION: prepare_directories
518# @USAGE: < directories > 522# @USAGE: < directories >
519# @INTERNAL 523# @INTERNAL
747# @RETURN: the specs-directory w/o path 751# @RETURN: the specs-directory w/o path
748# @DESCRIPTION: 752# @DESCRIPTION:
749# Allows us to define which mkspecs dir we want to use. 753# Allows us to define which mkspecs dir we want to use.
750qt_mkspecs_dir() { 754qt_mkspecs_dir() {
751 local spec= 755 local spec=
756
752 case ${CHOST} in 757 case "${CHOST}" in
753 *-freebsd*|*-dragonfly*) 758 *-freebsd*|*-dragonfly*)
754 spec=freebsd ;; 759 spec=freebsd ;;
755 *-openbsd*) 760 *-openbsd*)
756 spec=openbsd ;; 761 spec=openbsd ;;
757 *-netbsd*) 762 *-netbsd*)
768 *-solaris*) 773 *-solaris*)
769 spec=solaris ;; 774 spec=solaris ;;
770 *-linux-*|*-linux) 775 *-linux-*|*-linux)
771 spec=linux ;; 776 spec=linux ;;
772 *) 777 *)
773 die "Unknown CHOST, no platform chosen" 778 die "${FUNCNAME}(): Unknown CHOST '${CHOST}'" ;;
774 esac 779 esac
775 780
776 CXX=$(tc-getCXX) 781 case "$(tc-getCXX)" in
777 if [[ ${CXX} == *g++* ]]; then 782 *g++*)
778 spec+=-g++ 783 spec+=-g++ ;;
779 elif [[ ${CXX} == *icpc* ]]; then 784 *icpc*)
780 spec+=-icc 785 spec+=-icc ;;
781 else 786 *)
782 die "Unknown compiler '${CXX}'" 787 die "${FUNCNAME}(): Unknown compiler '$(tc-getCXX)'" ;;
783 fi 788 esac
784 if [[ -n ${LIBDIR/lib} ]]; then
785 spec+=-${LIBDIR/lib}
786 fi
787 789
788 # Add -64 for 64bit profiles 790 # Add -64 for 64bit profiles
789 if use x64-freebsd || 791 if use x64-freebsd ||
790 use amd64-linux || 792 use amd64-linux ||
791 use x64-macos || 793 use x64-macos ||

Legend:
Removed from v.1.114  
changed lines
  Added in v.1.122

  ViewVC Help
Powered by ViewVC 1.1.20