/[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.99 Revision 1.107
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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.99 2011/11/19 20:00:35 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.107 2011/12/21 23:38:45 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.
10# This eclass contains various functions that are used when building Qt4. 10# This eclass contains various functions that are used when building Qt4.
11 11
12inherit base eutils multilib toolchain-funcs flag-o-matic versionator 12inherit base eutils multilib toolchain-funcs flag-o-matic versionator
13 13
14MY_PV=${PV/_/-} 14MY_PV=${PV/_/-}
15if version_is_at_least 4.5.99999999; then
16 MY_P=qt-everywhere-opensource-src-${MY_PV} 15MY_P=qt-everywhere-opensource-src-${MY_PV}
16
17HOMEPAGE="http://qt.nokia.com/ http://qt-project.org/"
18SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz"
19LICENSE="|| ( LGPL-2.1 GPL-3 )"
20
21IUSE="aqua debug pch"
22
17 [[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] && 23[[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] &&
18 [[ ${CATEGORY}/${PN} != x11-themes/qgtkstyle ]] && 24[[ ${CATEGORY}/${PN} != x11-themes/qgtkstyle ]] &&
19 IUSE="+exceptions" 25 IUSE+=" +exceptions"
20else
21 MY_P=qt-x11-opensource-src-${MY_PV}
22fi
23 26
24if version_is_at_least 4.7.99999999; then 27if version_is_at_least 4.7.99999999; then
25 IUSE+=" c++0x qpa" 28 IUSE+=" c++0x qpa"
26fi 29fi
27 30
28HOMEPAGE="http://qt.nokia.com/" 31DEPEND="dev-util/pkgconfig"
29SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz"
30
31LICENSE="|| ( LGPL-2.1 GPL-3 )"
32IUSE+=" debug pch aqua"
33
34RDEPEND=" 32RDEPEND="
35 !<x11-libs/qt-assistant-${PV} 33 !<x11-libs/qt-assistant-${PV}
36 !>x11-libs/qt-assistant-${PV}-r9999 34 !>x11-libs/qt-assistant-${PV}-r9999
37 !<x11-libs/qt-core-${PV} 35 !<x11-libs/qt-core-${PV}
38 !>x11-libs/qt-core-${PV}-r9999 36 !>x11-libs/qt-core-${PV}-r9999
39 !<x11-libs/qt-dbus-${PV} 37 !<x11-libs/qt-dbus-${PV}
40 !>x11-libs/qt-dbus-${PV}-r9999 38 !>x11-libs/qt-dbus-${PV}-r9999
39 !<x11-libs/qt-declarative-${PV}
40 !>x11-libs/qt-declarative-${PV}-r9999
41 !<x11-libs/qt-demo-${PV} 41 !<x11-libs/qt-demo-${PV}
42 !>x11-libs/qt-demo-${PV}-r9999 42 !>x11-libs/qt-demo-${PV}-r9999
43 !<x11-libs/qt-gui-${PV} 43 !<x11-libs/qt-gui-${PV}
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}
72qt4-build_pkg_setup() { 72qt4-build_pkg_setup() {
73 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX= 73 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
74 74
75 # Protect users by not allowing downgrades between releases 75 # Protect users by not allowing downgrades between releases
76 # Downgrading revisions within the same release should be allowed 76 # Downgrading revisions within the same release should be allowed
77 if has_version '>'${CATEGORY}/${P}-r9999 ; then 77 if has_version '>'${CATEGORY}/${P}-r9999; then
78 if [[ -z $I_KNOW_WHAT_I_AM_DOING ]] ; then 78 if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
79 eerror "Sanity check to keep you from breaking your system:" 79 eerror "Sanity check to keep you from breaking your system:"
80 eerror " Downgrading Qt is completely unsupported and will break your system!" 80 eerror " Downgrading Qt is completely unsupported and will break your system!"
81 die "aborting to save your system" 81 die "aborting to save your system"
82 else 82 else
83 ewarn "Downgrading Qt is completely unsupported and will break your system!" 83 ewarn "Downgrading Qt is completely unsupported and will break your system!"
201 -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \ 201 -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \
202 -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed failed" 202 -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed failed"
203 fi 203 fi
204 204
205 if [[ ${PN} != qt-core ]]; then 205 if [[ ${PN} != qt-core ]]; then
206 skip_qmake_build_patch 206 skip_qmake_build
207 skip_project_generation_patch 207 skip_project_generation
208 symlink_binaries_to_buildtree 208 symlink_binaries_to_buildtree
209 fi 209 fi
210 210
211 if [[ ${CHOST} == *86*-apple-darwin* ]] ; then 211 if [[ ${CHOST} == *86*-apple-darwin* ]] ; then
212 # qmake bus errors with -O2 but -O3 works 212 # qmake bus errors with -O2 but -O3 works
217 if [[ $(gcc-major-version) == 3 ]] && use amd64; then 217 if [[ $(gcc-major-version) == 3 ]] && use amd64; then
218 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" 218 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
219 append-flags -fno-gcse 219 append-flags -fno-gcse
220 fi 220 fi
221 221
222 if has c++0x ${IUSE//+} && use c++0x; then 222 if use_if_iuse c++0x; then
223 ewarn "You are about to build Qt4 using the C++11 standard. Even though" 223 ewarn "You are about to build Qt4 using the C++11 standard. Even though"
224 ewarn "this is an official standard, some of the reverse dependencies" 224 ewarn "this is an official standard, some of the reverse dependencies"
225 ewarn "may fail to compile or link againt the Qt4 libraries. Before" 225 ewarn "may fail to compile or link againt the Qt4 libraries. Before"
226 ewarn "reporting a bug, make sure your bug is reproducible with c++0x" 226 ewarn "reporting a bug, make sure your bug is reproducible with c++0x"
227 ewarn "disabled." 227 ewarn "disabled."
365 # freetype2 include dir is non-standard, thus include it on configure 365 # freetype2 include dir is non-standard, thus include it on configure
366 # use -I from configure 366 # use -I from configure
367 myconf+=" $(pkg-config --cflags freetype2)" 367 myconf+=" $(pkg-config --cflags freetype2)"
368 fi 368 fi
369 369
370 # Disable SSE4.x, since auto-detection is currently broken
371 # Upstream bug http://bugreports.qt.nokia.com/browse/QTBUG-13623
372 [[ ${PV} == "4.7.1" ]] && myconf+=" -no-sse4.1 -no-sse4.2"
373
374 echo ./configure ${myconf} 370 echo ./configure ${myconf}
375 ./configure ${myconf} || die "./configure failed" 371 ./configure ${myconf} || die "./configure failed"
376 myconf="" 372 myconf=""
377 373
378 prepare_directories ${QT4_TARGET_DIRECTORIES} 374 prepare_directories ${QT4_TARGET_DIRECTORIES}
449 QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig 445 QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig
450 QTDATADIR=${EPREFIX}/usr/share/qt4 446 QTDATADIR=${EPREFIX}/usr/share/qt4
451 QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV} 447 QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV}
452 QTHEADERDIR=${EPREFIX}/usr/include/qt4 448 QTHEADERDIR=${EPREFIX}/usr/include/qt4
453 QTPLUGINDIR=${QTLIBDIR}/plugins 449 QTPLUGINDIR=${QTLIBDIR}/plugins
450 QTIMPORTDIR=${QTLIBDIR}/imports
454 QTSYSCONFDIR=${EPREFIX}/etc/qt4 451 QTSYSCONFDIR=${EPREFIX}/etc/qt4
455 QTTRANSDIR=${QTDATADIR}/translations 452 QTTRANSDIR=${QTDATADIR}/translations
456 QTEXAMPLESDIR=${QTDATADIR}/examples 453 QTEXAMPLESDIR=${QTDATADIR}/examples
457 QTDEMOSDIR=${QTDATADIR}/demos 454 QTDEMOSDIR=${QTDATADIR}/demos
458 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4 455 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4
464# @FUNCTION: standard_configure_options 461# @FUNCTION: standard_configure_options
465# @DESCRIPTION: 462# @DESCRIPTION:
466# Sets up some standard configure options, like libdir (if necessary), whether 463# Sets up some standard configure options, like libdir (if necessary), whether
467# debug info is wanted or not. 464# debug info is wanted or not.
468standard_configure_options() { 465standard_configure_options() {
469 local myconf= 466 local myconf="-prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
467 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR}
468 -importdir ${QTIMPORTDIR} -datadir ${QTDATADIR} -translationdir ${QTTRANSDIR}
469 -sysconfdir ${QTSYSCONFDIR} -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}
470 -opensource -confirm-license -shared -fast -largefile -stl -verbose
471 -platform $(qt_mkspecs_dir) -nomake examples -nomake demos"
470 472
471 [[ $(get_libdir) != lib ]] && myconf+=" -L${EPREFIX}/usr/$(get_libdir)" 473 [[ $(get_libdir) != lib ]] && myconf+=" -L${EPREFIX}/usr/$(get_libdir)"
472 474
473 # Disable visibility explicitly if gcc version isn't 4 475 # debug/release
474 if [[ $(gcc-major-version) -lt 4 ]]; then
475 myconf+=" -no-reduce-exports"
476 fi
477
478 # precompiled headers doesn't work on hardened, where the flag is masked.
479 myconf+=" $(qt_use pch)"
480
481 if use debug; then 476 if use debug; then
482 myconf+=" -debug" 477 myconf+=" -debug"
483 else 478 else
484 myconf+=" -release" 479 myconf+=" -release"
485 fi 480 fi
486 myconf+=" -no-separate-debug-info" 481 myconf+=" -no-separate-debug-info"
487 482
483 # exceptions USE flag
484 local exceptions="-exceptions"
485 in_iuse exceptions && exceptions="$(qt_use exceptions)"
486 myconf+=" ${exceptions}"
487
488 # disable RPATH on Qt >= 4.8 (bug 380415)
489 version_is_at_least 4.8 && myconf+=" -no-rpath"
490
491 # precompiled headers don't work on hardened, where the flag is masked
492 myconf+=" $(qt_use pch)"
493
494 # -reduce-relocations
495 # This flag seems to introduce major breakage to applications,
496 # mostly to be seen as a core dump with the message "QPixmap: Must
497 # construct a QApplication before a QPaintDevice" on Solaris.
498 # -- Daniel Vergien
499 [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations"
500
488 use aqua && myconf+=" -no-framework" 501 use aqua && myconf+=" -no-framework"
489 502
490 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported 503 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
491 # $(tc-arch). Therefore we convert it to supported values. 504 # $(tc-arch). Therefore we convert it to supported values.
492 case "$(tc-arch)" in 505 case "$(tc-arch)" in
493 amd64|x64-*) myconf+=" -arch x86_64" ;; 506 amd64|x64-*) myconf+=" -arch x86_64" ;;
494 ppc-macos) myconf+=" -arch ppc" ;; 507 ppc-macos) myconf+=" -arch ppc" ;;
495 ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;; 508 ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;;
496 sparc|sparc-*) myconf+=" -arch sparc" ;; 509 sparc|sparc-*|sparc64-*) myconf+=" -arch sparc" ;;
497 x86-macos) myconf+=" -arch x86" ;; 510 x86-macos) myconf+=" -arch x86" ;;
498 x86|x86-*) myconf+=" -arch i386" ;; 511 x86|x86-*) myconf+=" -arch i386" ;;
499 alpha|arm|ia64|mips|s390|sparc) myconf+=" -arch $(tc-arch)" ;; 512 alpha|arm|ia64|mips|s390) myconf+=" -arch $(tc-arch)" ;;
500 hppa|sh) myconf+=" -arch generic" ;; 513 hppa|sh) myconf+=" -arch generic" ;;
501 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; 514 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
502 esac 515 esac
503
504 # 4.5: build everything but qt-xmlpatterns w/o exceptions
505 # 4.6: exceptions USE flag
506 local exceptions="-exceptions"
507 case "${PV}" in
508 4.5.*)
509 [[ ${PN} == "qt-xmlpatterns" ]] || exceptions="-no-exceptions"
510 ;;
511 *)
512 has exceptions "${IUSE//+}" && exceptions="$(qt_use exceptions)"
513 ;;
514 esac
515
516 # note about -reduce-relocations:
517 # That flag seems to introduce major breakage to applications,
518 # mostly to be seen as a core dump with the message "QPixmap: Must
519 # construct a QApplication before a QPaintDevice" on Solaris
520 # -- Daniel Vergien
521 [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations"
522
523 myconf+=" -platform $(qt_mkspecs_dir) -stl -verbose -largefile -confirm-license
524 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
525 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
526 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
527 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
528 -demosdir ${QTDEMOSDIR} -silent -fast -opensource
529 ${exceptions}
530 -nomake examples -nomake demos"
531 516
532 echo "${myconf}" 517 echo "${myconf}"
533} 518}
534 519
535# @FUNCTION: prepare_directories 520# @FUNCTION: prepare_directories
542 einfo "Running qmake in: ${x}" 527 einfo "Running qmake in: ${x}"
543 # avoid running over the maximum argument number, bug #299810 528 # avoid running over the maximum argument number, bug #299810
544 { 529 {
545 echo "${S}"/mkspecs/common/*.conf 530 echo "${S}"/mkspecs/common/*.conf
546 find "${S}" -name '*.pr[io]' 531 find "${S}" -name '*.pr[io]'
547 } | xargs sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:${EPREFIX}/usr/$(get_libdir)/qt4:g" || die 532 } | xargs sed -i \
533 -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \
534 -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \
535 || die
548 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" 536 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
549 popd >/dev/null 537 popd >/dev/null
550 done 538 done
551} 539}
552 540
686# breakages and proposed solutions. 674# breakages and proposed solutions.
687qt4-build_pkg_postinst() { 675qt4-build_pkg_postinst() {
688 generate_qconfigs 676 generate_qconfigs
689} 677}
690 678
691# @FUNCTION: skip_qmake_build_patch 679# @FUNCTION: skip_qmake_build
692# @DESCRIPTION: 680# @DESCRIPTION:
693# Don't need to build qmake, as it's already installed from qt-core 681# Don't need to build qmake, as it's already installed from qt-core
694skip_qmake_build_patch() { 682skip_qmake_build() {
695 # Don't need to build qmake, as it's already installed from qt-core 683 # Don't need to build qmake, as it's already installed from qt-core
696 sed -i -e "s:if true:if false:g" "${S}"/configure || die "sed failed" 684 sed -i -e "s:if true:if false:g" "${S}"/configure || die "sed failed"
697} 685}
698 686
699# @FUNCTION: skip_project_generation_patch 687# @FUNCTION: skip_project_generation
700# @DESCRIPTION: 688# @DESCRIPTION:
701# Exit the script early by throwing in an exit before all of the .pro files are scanned 689# Exit the script early by throwing in an exit before all of the .pro files are scanned
702skip_project_generation_patch() { 690skip_project_generation() {
703 # Exit the script early by throwing in an exit before all of the .pro files are scanned 691 # Exit the script early by throwing in an exit before all of the .pro files are scanned
704 sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \ 692 sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \
705 -i "${S}"/configure || die "sed failed" 693 -i "${S}"/configure || die "sed failed"
706} 694}
707 695
709# @DESCRIPTION: 697# @DESCRIPTION:
710# Symlink generated binaries to buildtree so they can be used during compilation 698# Symlink generated binaries to buildtree so they can be used during compilation
711# time 699# time
712symlink_binaries_to_buildtree() { 700symlink_binaries_to_buildtree() {
713 for bin in qmake moc uic rcc; do 701 for bin in qmake moc uic rcc; do
714 ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "symlinking ${bin} to ${S}/bin failed" 702 ln -s "${QTBINDIR}"/${bin} "${S}"/bin/ || die "symlinking ${bin} to ${S}/bin failed"
715 done 703 done
716} 704}
717 705
718# @FUNCTION: fix_library_files 706# @FUNCTION: fix_library_files
719# @DESCRIPTION: 707# @DESCRIPTION:
791 *-solaris*) 779 *-solaris*)
792 spec=solaris ;; 780 spec=solaris ;;
793 *-linux-*|*-linux) 781 *-linux-*|*-linux)
794 spec=linux ;; 782 spec=linux ;;
795 *) 783 *)
796 die "Unknown CHOST, no platform chosen." 784 die "Unknown CHOST, no platform chosen"
797 esac 785 esac
798 786
799 CXX=$(tc-getCXX) 787 CXX=$(tc-getCXX)
800 if [[ ${CXX} == *g++* ]]; then 788 if [[ ${CXX} == *g++* ]]; then
801 spec+=-g++ 789 spec+=-g++
802 elif [[ ${CXX} == *icpc* ]]; then 790 elif [[ ${CXX} == *icpc* ]]; then
803 spec+=-icc 791 spec+=-icc
804 else 792 else
805 die "Unknown compiler '${CXX}'." 793 die "Unknown compiler '${CXX}'"
806 fi 794 fi
807 if [[ -n ${LIBDIR/lib} ]]; then 795 if [[ -n ${LIBDIR/lib} ]]; then
808 spec+=-${LIBDIR/lib} 796 spec+=-${LIBDIR/lib}
809 fi 797 fi
810 798

Legend:
Removed from v.1.99  
changed lines
  Added in v.1.107

  ViewVC Help
Powered by ViewVC 1.1.20