| 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.122 2012/03/01 15:19:14 pesa Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.123 2012/03/08 14:24:40 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. |
| 9 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 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 | |
|
|
12 | case ${EAPI} in |
|
|
13 | 2|3|4) : ;; |
|
|
14 | *) die "qt4-build.eclass requires EAPI 2, 3 or 4." ;; |
|
|
15 | esac |
| 11 | |
16 | |
| 12 | inherit base eutils multilib toolchain-funcs flag-o-matic versionator |
17 | inherit base eutils multilib toolchain-funcs flag-o-matic versionator |
| 13 | |
18 | |
| 14 | MY_PV=${PV/_/-} |
19 | MY_PV=${PV/_/-} |
| 15 | MY_P=qt-everywhere-opensource-src-${MY_PV} |
20 | MY_P=qt-everywhere-opensource-src-${MY_PV} |
| … | |
… | |
| 84 | else |
89 | else |
| 85 | ewarn "Downgrading Qt is completely unsupported and will break your system!" |
90 | ewarn "Downgrading Qt is completely unsupported and will break your system!" |
| 86 | fi |
91 | fi |
| 87 | fi |
92 | fi |
| 88 | |
93 | |
| 89 | if [[ ${PN} == "qt-webkit" ]]; then |
94 | if [[ ${PN} == qt-webkit ]]; then |
| 90 | eshopts_push -s extglob |
95 | eshopts_push -s extglob |
| 91 | if is-flagq '-g?(gdb)?([1-9])'; then |
96 | if is-flagq '-g?(gdb)?([1-9])'; then |
| 92 | echo |
97 | echo |
| 93 | ewarn "You have enabled debug info (probably have -g or -ggdb in your \$C{,XX}FLAGS)." |
98 | ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)." |
| 94 | ewarn "You may experience really long compilation times and/or increased memory usage." |
99 | ewarn "You may experience really long compilation times and/or increased memory usage." |
| 95 | ewarn "If compilation fails, please try removing -g{,gdb} before reporting a bug." |
100 | ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug." |
| 96 | ewarn "For more info check out bug #307861" |
101 | ewarn "For more info check out bug #307861" |
| 97 | echo |
102 | echo |
| 98 | fi |
103 | fi |
| 99 | eshopts_pop |
104 | eshopts_pop |
| 100 | fi |
105 | fi |
| … | |
… | |
| 110 | [[ ${CHOST} == *-apple-darwin* ]] && \ |
115 | [[ ${CHOST} == *-apple-darwin* ]] && \ |
| 111 | QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm |
116 | QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm |
| 112 | ${QT4_EXTRACT_DIRECTORIES}" |
117 | ${QT4_EXTRACT_DIRECTORIES}" |
| 113 | fi |
118 | fi |
| 114 | |
119 | |
| 115 | # Make sure ebuilds use the required EAPI |
|
|
| 116 | if [[ ${EAPI} != [234] ]]; then |
|
|
| 117 | eerror "The qt4-build eclass requires EAPI 2,3 or 4 but this ebuild is using" |
|
|
| 118 | eerror "EAPI=${EAPI:-0}. The ebuild author or editor failed. This ebuild needs to be" |
|
|
| 119 | eerror "fixed. Using qt4-build eclass without EAPI 2,3 or 4 will fail." |
|
|
| 120 | die "qt4-build eclass requires EAPI 2,3 or 4" |
|
|
| 121 | fi |
|
|
| 122 | |
|
|
| 123 | if ! version_is_at_least 4.1 $(gcc-version); then |
120 | if ! version_is_at_least 4.1 $(gcc-version); then |
| 124 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
121 | ewarn "Using a GCC version lower than 4.1 is not supported." |
| 125 | fi |
122 | fi |
| 126 | } |
123 | } |
| 127 | |
124 | |
| 128 | # @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES |
125 | # @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES |
| 129 | # @DESCRIPTION: |
126 | # @DESCRIPTION: |
| … | |
… | |
| 173 | # the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in /etc/make.conf. |
170 | # the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in /etc/make.conf. |
| 174 | qt4-build_src_prepare() { |
171 | qt4-build_src_prepare() { |
| 175 | setqtenv |
172 | setqtenv |
| 176 | cd "${S}" |
173 | cd "${S}" |
| 177 | |
174 | |
| 178 | if version_is_at_least "4.7"; then |
175 | if version_is_at_least 4.7; then |
| 179 | # fix libX11 dependency on non X packages |
176 | # fix libX11 dependency on non X packages |
| 180 | local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns" |
177 | local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns" |
| 181 | has ${PN} ${nolibx11_pkgs} && qt_nolibx11 |
178 | has ${PN} ${nolibx11_pkgs} && qt_nolibx11 |
| 182 | |
179 | |
| 183 | qt_assistant_cleanup |
180 | qt_assistant_cleanup |
| … | |
… | |
| 208 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
205 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
| 209 | append-flags -fno-gcse |
206 | append-flags -fno-gcse |
| 210 | fi |
207 | fi |
| 211 | |
208 | |
| 212 | if use_if_iuse c++0x; then |
209 | if use_if_iuse c++0x; then |
|
|
210 | echo |
| 213 | ewarn "You are about to build Qt4 using the C++11 standard. Even though" |
211 | ewarn "You are about to build Qt4 using the C++11 standard. Even though" |
| 214 | ewarn "this is an official standard, some of the reverse dependencies" |
212 | ewarn "this is an official standard, some of the reverse dependencies" |
| 215 | ewarn "may fail to compile or link againt the Qt4 libraries. Before" |
213 | ewarn "may fail to compile or link againt the Qt4 libraries. Before" |
| 216 | ewarn "reporting a bug, make sure your bug is reproducible with c++0x" |
214 | ewarn "reporting a bug, make sure your bug is reproducible with c++0x" |
| 217 | ewarn "disabled." |
215 | ewarn "disabled." |
|
|
216 | echo |
| 218 | append-flags -std=c++0x |
217 | append-flags -std=c++0x |
| 219 | fi |
218 | fi |
| 220 | |
219 | |
| 221 | # Unsupported old gcc versions - hardened needs this :( |
220 | # Unsupported old gcc versions - hardened needs this :( |
| 222 | if [[ $(gcc-major-version) -lt 4 ]]; then |
221 | if [[ $(gcc-major-version) -lt 4 ]]; then |
| … | |
… | |
| 389 | conf+=" ${glibflags//-pthread}" |
388 | conf+=" ${glibflags//-pthread}" |
| 390 | unset glibflags |
389 | unset glibflags |
| 391 | fi |
390 | fi |
| 392 | |
391 | |
| 393 | if use_if_iuse qpa; then |
392 | if use_if_iuse qpa; then |
| 394 | ewarn |
393 | echo |
| 395 | ewarn "The qpa useflag enables the Qt Platform Abstraction, formely" |
394 | ewarn "The qpa useflag enables the Qt Platform Abstraction, formely" |
| 396 | ewarn "known as Qt Lighthouse. If you are not sure what that is, then" |
395 | ewarn "known as Qt Lighthouse. If you are not sure what that is, then" |
| 397 | ewarn "disable it before reporting any bugs related to this useflag." |
396 | ewarn "disable it before reporting any bugs related to this useflag." |
| 398 | ewarn |
397 | echo |
| 399 | conf+=" -qpa" |
398 | conf+=" -qpa" |
| 400 | fi |
399 | fi |
| 401 | |
400 | |
| 402 | if use aqua; then |
401 | if use aqua; then |
| 403 | # On (snow) leopard use the new (frameworked) cocoa code. |
402 | # On (snow) leopard use the new (frameworked) cocoa code. |
| … | |
… | |
| 442 | # @FUNCTION: qt4-build_src_test |
441 | # @FUNCTION: qt4-build_src_test |
| 443 | # @DESCRIPTION: |
442 | # @DESCRIPTION: |
| 444 | # Runs tests only in target directories. |
443 | # Runs tests only in target directories. |
| 445 | qt4-build_src_test() { |
444 | qt4-build_src_test() { |
| 446 | # QtMultimedia does not have any test suite (bug #332299) |
445 | # QtMultimedia does not have any test suite (bug #332299) |
| 447 | [[ ${PN} == "qt-multimedia" ]] && return |
446 | [[ ${PN} == qt-multimedia ]] && return |
| 448 | |
447 | |
| 449 | for dir in ${QT4_TARGET_DIRECTORIES}; do |
448 | for dir in ${QT4_TARGET_DIRECTORIES}; do |
| 450 | emake -j1 check -C ${dir} |
449 | emake -j1 check -C ${dir} |
| 451 | done |
450 | done |
| 452 | } |
451 | } |
| … | |
… | |
| 610 | # @FUNCTION: generate_qconfigs |
609 | # @FUNCTION: generate_qconfigs |
| 611 | # @INTERNAL |
610 | # @INTERNAL |
| 612 | # @DESCRIPTION: |
611 | # @DESCRIPTION: |
| 613 | # Generates gentoo-specific qconfig.{h,pri}. |
612 | # Generates gentoo-specific qconfig.{h,pri}. |
| 614 | generate_qconfigs() { |
613 | generate_qconfigs() { |
| 615 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then |
614 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${PN} == qt-core ]]; then |
| 616 | local x qconfig_add qconfig_remove qconfig_new |
615 | local x qconfig_add qconfig_remove qconfig_new |
| 617 | for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do |
616 | for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do |
| 618 | [[ -f ${x} ]] || continue |
617 | [[ -f ${x} ]] || continue |
| 619 | qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")" |
618 | qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")" |
| 620 | qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")" |
619 | qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")" |
| … | |
… | |
| 806 | # Tries to clean up tools.pro for qt-assistant ebuilds. |
805 | # Tries to clean up tools.pro for qt-assistant ebuilds. |
| 807 | # Meant to be called in src_prepare(). |
806 | # Meant to be called in src_prepare(). |
| 808 | # Since Qt 4.7.4 this function is a no-op. |
807 | # Since Qt 4.7.4 this function is a no-op. |
| 809 | qt_assistant_cleanup() { |
808 | qt_assistant_cleanup() { |
| 810 | # apply patching to qt-assistant ebuilds only |
809 | # apply patching to qt-assistant ebuilds only |
| 811 | [[ ${PN} != "qt-assistant" ]] && return |
810 | [[ ${PN} != qt-assistant ]] && return |
| 812 | |
811 | |
| 813 | # no longer needed for 4.7.4 and later |
812 | # no longer needed for 4.7.4 and later |
| 814 | version_is_at_least "4.7.4" && return |
813 | version_is_at_least 4.7.4 && return |
| 815 | |
814 | |
| 816 | # different versions (and branches...) may need different handling, |
815 | # different versions (and branches...) may need different handling, |
| 817 | # add a case if you need special handling |
816 | # add a case if you need special handling |
| 818 | case "${MY_PV_EXTRA}" in |
817 | case "${MY_PV_EXTRA}" in |
| 819 | *kde-qt*) |
818 | *kde-qt*) |