/[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.98 Revision 1.106
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.98 2011/11/12 19:01:56 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.106 2011/12/21 22:47:35 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!"
183 sed -e "s/^gcc|g++)/*gcc|*g++)/" \ 183 sed -e "s/^gcc|g++)/*gcc|*g++)/" \
184 -i config.tests/unix/fvisibility.test || 184 -i config.tests/unix/fvisibility.test ||
185 die "visibility fixing sed failed" 185 die "visibility fixing sed failed"
186 fi 186 fi
187 187
188 if version_is_at_least "4.7"; then
188 # fix libX11 dependency on non X packages 189 # fix libX11 dependency on non X packages
189 if version_is_at_least "4.7.0_beta2"; then
190 local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns" 190 local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns"
191 has ${PN} ${nolibx11_pkgs} && qt_nolibx11 191 has ${PN} ${nolibx11_pkgs} && qt_nolibx11
192 [[ ${PN} == "qt-assistant" ]] && qt_assistant_cleanup 192
193 qt_assistant_cleanup
193 fi 194 fi
194 195
195 if use aqua; then 196 if use aqua; then
196 # provide a proper macx-g++-64 197 # provide a proper macx-g++-64
197 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) 198 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
200 -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:' \
201 -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed failed" 202 -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed failed"
202 fi 203 fi
203 204
204 if [[ ${PN} != qt-core ]]; then 205 if [[ ${PN} != qt-core ]]; then
205 skip_qmake_build_patch 206 skip_qmake_build
206 skip_project_generation_patch 207 skip_project_generation
207 symlink_binaries_to_buildtree 208 symlink_binaries_to_buildtree
208 fi 209 fi
209 210
210 if [[ ${CHOST} == *86*-apple-darwin* ]] ; then 211 if [[ ${CHOST} == *86*-apple-darwin* ]] ; then
211 # qmake bus errors with -O2 but -O3 works 212 # qmake bus errors with -O2 but -O3 works
216 if [[ $(gcc-major-version) == 3 ]] && use amd64; then 217 if [[ $(gcc-major-version) == 3 ]] && use amd64; then
217 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" 218 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
218 append-flags -fno-gcse 219 append-flags -fno-gcse
219 fi 220 fi
220 221
221 if has c++0x ${IUSE//+} && use c++0x; then 222 if use_if_iuse c++0x; then
222 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"
223 ewarn "this is an official standard, some of the reverse dependencies" 224 ewarn "this is an official standard, some of the reverse dependencies"
224 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"
225 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"
226 ewarn "disabled." 227 ewarn "disabled."
364 # freetype2 include dir is non-standard, thus include it on configure 365 # freetype2 include dir is non-standard, thus include it on configure
365 # use -I from configure 366 # use -I from configure
366 myconf+=" $(pkg-config --cflags freetype2)" 367 myconf+=" $(pkg-config --cflags freetype2)"
367 fi 368 fi
368 369
369 # Disable SSE4.x, since auto-detection is currently broken
370 # Upstream bug http://bugreports.qt.nokia.com/browse/QTBUG-13623
371 [[ ${PV} == "4.7.1" ]] && myconf+=" -no-sse4.1 -no-sse4.2"
372
373 echo ./configure ${myconf} 370 echo ./configure ${myconf}
374 ./configure ${myconf} || die "./configure failed" 371 ./configure ${myconf} || die "./configure failed"
375 myconf="" 372 myconf=""
376 373
377 prepare_directories ${QT4_TARGET_DIRECTORIES} 374 prepare_directories ${QT4_TARGET_DIRECTORIES}
448 QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig 445 QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig
449 QTDATADIR=${EPREFIX}/usr/share/qt4 446 QTDATADIR=${EPREFIX}/usr/share/qt4
450 QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV} 447 QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV}
451 QTHEADERDIR=${EPREFIX}/usr/include/qt4 448 QTHEADERDIR=${EPREFIX}/usr/include/qt4
452 QTPLUGINDIR=${QTLIBDIR}/plugins 449 QTPLUGINDIR=${QTLIBDIR}/plugins
450 QTIMPORTDIR=${QTLIBDIR}/imports
453 QTSYSCONFDIR=${EPREFIX}/etc/qt4 451 QTSYSCONFDIR=${EPREFIX}/etc/qt4
454 QTTRANSDIR=${QTDATADIR}/translations 452 QTTRANSDIR=${QTDATADIR}/translations
455 QTEXAMPLESDIR=${QTDATADIR}/examples 453 QTEXAMPLESDIR=${QTDATADIR}/examples
456 QTDEMOSDIR=${QTDATADIR}/demos 454 QTDEMOSDIR=${QTDATADIR}/demos
457 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4 455 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4
487 use aqua && myconf+=" -no-framework" 485 use aqua && myconf+=" -no-framework"
488 486
489 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported 487 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
490 # $(tc-arch). Therefore we convert it to supported values. 488 # $(tc-arch). Therefore we convert it to supported values.
491 case "$(tc-arch)" in 489 case "$(tc-arch)" in
492 amd64|x64-*) myconf+=" -arch x86_64" ;; 490 amd64|x64-*) myconf+=" -arch x86_64" ;;
493 ppc-macos) myconf+=" -arch ppc" ;; 491 ppc-macos) myconf+=" -arch ppc" ;;
494 ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;; 492 ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;;
495 sparc|sparc-*) myconf+=" -arch sparc" ;; 493 sparc|sparc-*|sparc64-*) myconf+=" -arch sparc" ;;
496 x86-macos) myconf+=" -arch x86" ;; 494 x86-macos) myconf+=" -arch x86" ;;
497 x86|x86-*) myconf+=" -arch i386" ;; 495 x86|x86-*) myconf+=" -arch i386" ;;
498 alpha|arm|ia64|mips|s390|sparc) myconf+=" -arch $(tc-arch)" ;; 496 alpha|arm|ia64|mips|s390) myconf+=" -arch $(tc-arch)" ;;
499 hppa|sh) myconf+=" -arch generic" ;; 497 hppa|sh) myconf+=" -arch generic" ;;
500 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; 498 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
501 esac 499 esac
502 500
503 # 4.5: build everything but qt-xmlpatterns w/o exceptions
504 # 4.6: exceptions USE flag 501 # exceptions USE flag
505 local exceptions="-exceptions" 502 local exceptions="-exceptions"
506 case "${PV}" in
507 4.5.*)
508 [[ ${PN} == "qt-xmlpatterns" ]] || exceptions="-no-exceptions"
509 ;;
510 *)
511 has exceptions "${IUSE//+}" && exceptions="$(qt_use exceptions)" 503 in_iuse exceptions && exceptions="$(qt_use exceptions)"
512 ;; 504
513 esac 505 # bug 380415
506 version_is_at_least 4.8 && myconf+=" -no-rpath"
514 507
515 # note about -reduce-relocations: 508 # note about -reduce-relocations:
516 # That flag seems to introduce major breakage to applications, 509 # That flag seems to introduce major breakage to applications,
517 # mostly to be seen as a core dump with the message "QPixmap: Must 510 # mostly to be seen as a core dump with the message "QPixmap: Must
518 # construct a QApplication before a QPaintDevice" on Solaris 511 # construct a QApplication before a QPaintDevice" on Solaris
522 myconf+=" -platform $(qt_mkspecs_dir) -stl -verbose -largefile -confirm-license 515 myconf+=" -platform $(qt_mkspecs_dir) -stl -verbose -largefile -confirm-license
523 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} 516 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
524 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} 517 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
525 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} 518 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
526 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} 519 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
527 -demosdir ${QTDEMOSDIR} -silent -fast -opensource 520 -demosdir ${QTDEMOSDIR} -importdir ${QTIMPORTDIR} -silent -fast -opensource
528 ${exceptions} 521 ${exceptions}
529 -nomake examples -nomake demos" 522 -nomake examples -nomake demos"
530 523
531 echo "${myconf}" 524 echo "${myconf}"
532} 525}
541 einfo "Running qmake in: ${x}" 534 einfo "Running qmake in: ${x}"
542 # avoid running over the maximum argument number, bug #299810 535 # avoid running over the maximum argument number, bug #299810
543 { 536 {
544 echo "${S}"/mkspecs/common/*.conf 537 echo "${S}"/mkspecs/common/*.conf
545 find "${S}" -name '*.pr[io]' 538 find "${S}" -name '*.pr[io]'
546 } | xargs sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:${EPREFIX}/usr/$(get_libdir)/qt4:g" || die 539 } | xargs sed -i \
540 -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \
541 -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \
542 || die
547 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" 543 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
548 popd >/dev/null 544 popd >/dev/null
549 done 545 done
550} 546}
551 547
685# breakages and proposed solutions. 681# breakages and proposed solutions.
686qt4-build_pkg_postinst() { 682qt4-build_pkg_postinst() {
687 generate_qconfigs 683 generate_qconfigs
688} 684}
689 685
690# @FUNCTION: skip_qmake_build_patch 686# @FUNCTION: skip_qmake_build
691# @DESCRIPTION: 687# @DESCRIPTION:
692# Don't need to build qmake, as it's already installed from qt-core 688# Don't need to build qmake, as it's already installed from qt-core
693skip_qmake_build_patch() { 689skip_qmake_build() {
694 # Don't need to build qmake, as it's already installed from qt-core 690 # Don't need to build qmake, as it's already installed from qt-core
695 sed -i -e "s:if true:if false:g" "${S}"/configure || die "sed failed" 691 sed -i -e "s:if true:if false:g" "${S}"/configure || die "sed failed"
696} 692}
697 693
698# @FUNCTION: skip_project_generation_patch 694# @FUNCTION: skip_project_generation
699# @DESCRIPTION: 695# @DESCRIPTION:
700# Exit the script early by throwing in an exit before all of the .pro files are scanned 696# Exit the script early by throwing in an exit before all of the .pro files are scanned
701skip_project_generation_patch() { 697skip_project_generation() {
702 # Exit the script early by throwing in an exit before all of the .pro files are scanned 698 # Exit the script early by throwing in an exit before all of the .pro files are scanned
703 sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \ 699 sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \
704 -i "${S}"/configure || die "sed failed" 700 -i "${S}"/configure || die "sed failed"
705} 701}
706 702
708# @DESCRIPTION: 704# @DESCRIPTION:
709# Symlink generated binaries to buildtree so they can be used during compilation 705# Symlink generated binaries to buildtree so they can be used during compilation
710# time 706# time
711symlink_binaries_to_buildtree() { 707symlink_binaries_to_buildtree() {
712 for bin in qmake moc uic rcc; do 708 for bin in qmake moc uic rcc; do
713 ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "symlinking ${bin} to ${S}/bin failed" 709 ln -s "${QTBINDIR}"/${bin} "${S}"/bin/ || die "symlinking ${bin} to ${S}/bin failed"
714 done 710 done
715} 711}
716 712
717# @FUNCTION: fix_library_files 713# @FUNCTION: fix_library_files
718# @DESCRIPTION: 714# @DESCRIPTION:
790 *-solaris*) 786 *-solaris*)
791 spec=solaris ;; 787 spec=solaris ;;
792 *-linux-*|*-linux) 788 *-linux-*|*-linux)
793 spec=linux ;; 789 spec=linux ;;
794 *) 790 *)
795 die "Unknown CHOST, no platform chosen." 791 die "Unknown CHOST, no platform chosen"
796 esac 792 esac
797 793
798 CXX=$(tc-getCXX) 794 CXX=$(tc-getCXX)
799 if [[ ${CXX} == *g++* ]]; then 795 if [[ ${CXX} == *g++* ]]; then
800 spec+=-g++ 796 spec+=-g++
801 elif [[ ${CXX} == *icpc* ]]; then 797 elif [[ ${CXX} == *icpc* ]]; then
802 spec+=-icc 798 spec+=-icc
803 else 799 else
804 die "Unknown compiler '${CXX}'." 800 die "Unknown compiler '${CXX}'"
805 fi 801 fi
806 if [[ -n ${LIBDIR/lib} ]]; then 802 if [[ -n ${LIBDIR/lib} ]]; then
807 spec+=-${LIBDIR/lib} 803 spec+=-${LIBDIR/lib}
808 fi 804 fi
809 805
821} 817}
822 818
823# @FUNCTION: qt_assistant_cleanup 819# @FUNCTION: qt_assistant_cleanup
824# @RETURN: nothing 820# @RETURN: nothing
825# @DESCRIPTION: 821# @DESCRIPTION:
826# Tries to clean up tools.pro for qt-assistant ebuilds 822# Tries to clean up tools.pro for qt-assistant ebuilds.
827# Meant to be called in src_prepare 823# Meant to be called in src_prepare().
824# Since Qt 4.7.4 this function is a no-op.
828qt_assistant_cleanup() { 825qt_assistant_cleanup() {
826 # apply patching to qt-assistant ebuilds only
827 [[ ${PN} != "qt-assistant" ]] && return
828
829 # no longer needed for 4.7.4 and later
830 version_is_at_least "4.7.4" && return
831
829 # different versions (and branches...) may need different handling, 832 # different versions (and branches...) may need different handling,
830 # add a case if you need special handling 833 # add a case if you need special handling
831 case "${MY_PV_EXTRA}" in 834 case "${MY_PV_EXTRA}" in
832 *kde-qt*) 835 *kde-qt*)
833 sed -e "/^[ \t]*porting/,/^[ \t]*win32.*activeqt$/d" \ 836 sed -e "/^[ \t]*porting/,/^[ \t]*win32.*activeqt$/d" \

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.106

  ViewVC Help
Powered by ViewVC 1.1.20