| 1 | # Copyright 2007-2009 Gentoo Foundation |
1 | # Copyright 2007-2009 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.36 2009/05/29 14:48:00 hwoarang Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.41 2009/06/28 15:24:42 hwoarang Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: qt4-build.eclass |
5 | # @ECLASS: qt4-build.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ben de Groot <yngwin@gentoo.org>, |
7 | # Ben de Groot <yngwin@gentoo.org>, |
| 8 | # Markos Chandras <hwoarang@gentoo.org>, |
8 | # Markos Chandras <hwoarang@gentoo.org>, |
| 9 | # Caleb Tennis <caleb@gentoo.org> |
9 | # Caleb Tennis <caleb@gentoo.org> |
| 10 | # @BLURB: Eclass for Qt4 split ebuilds. |
10 | # @BLURB: Eclass for Qt4 split ebuilds. |
| 11 | # @DESCRIPTION: |
11 | # @DESCRIPTION: |
| 12 | # This eclass contains various functions that are used when building Qt4 |
12 | # This eclass contains various functions that are used when building Qt4 |
| 13 | |
13 | |
| 14 | inherit eutils multilib toolchain-funcs flag-o-matic versionator |
14 | inherit base eutils multilib toolchain-funcs flag-o-matic versionator |
| 15 | |
15 | |
| 16 | IUSE="${IUSE} custom-cxxflags debug pch" |
16 | IUSE="${IUSE} debug pch" |
| 17 | RDEPEND=" |
17 | RDEPEND=" |
| 18 | !<x11-libs/qt-assistant-${PV} |
18 | !<x11-libs/qt-assistant-${PV} |
| 19 | !>x11-libs/qt-assistant-${PV}-r9999 |
19 | !>x11-libs/qt-assistant-${PV}-r9999 |
| 20 | !<x11-libs/qt-core-${PV} |
20 | !<x11-libs/qt-core-${PV} |
| 21 | !>x11-libs/qt-core-${PV}-r9999 |
21 | !>x11-libs/qt-core-${PV}-r9999 |
| … | |
… | |
| 56 | esac |
56 | esac |
| 57 | MY_P=qt-x11-${SRCTYPE}-${MY_PV} |
57 | MY_P=qt-x11-${SRCTYPE}-${MY_PV} |
| 58 | S=${WORKDIR}/${MY_P} |
58 | S=${WORKDIR}/${MY_P} |
| 59 | |
59 | |
| 60 | HOMEPAGE="http://www.qtsoftware.com/" |
60 | HOMEPAGE="http://www.qtsoftware.com/" |
| 61 | SRC_URI="http://download.qtsoftware.com/qt/source/${MY_P}.tar.bz2" |
61 | SRC_URI="http://get.qtsoftware.com/qt/source/${MY_P}.tar.bz2" |
| 62 | |
62 | |
| 63 | case "${PV}" in |
63 | case "${PV}" in |
| 64 | 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;; |
64 | 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;; |
| 65 | *) ;; |
65 | *) ;; |
| 66 | esac |
66 | esac |
| … | |
… | |
| 107 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
107 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
| 108 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
108 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
| 109 | echo |
109 | echo |
| 110 | ebeep 3 |
110 | ebeep 3 |
| 111 | fi |
111 | fi |
| 112 | |
|
|
| 113 | if use custom-cxxflags; then |
|
|
| 114 | echo |
|
|
| 115 | ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the" |
|
|
| 116 | ewarn "CXXFLAGS you have set in /etc/make.conf. This is not supported, and we" |
|
|
| 117 | ewarn "recommend to unset this useflag. But you are free to experiment with it." |
|
|
| 118 | ewarn "Just do not start crying if it breaks your system, or eats your kitten" |
|
|
| 119 | ewarn "for breakfast. ;-) " |
|
|
| 120 | echo |
|
|
| 121 | fi |
|
|
| 122 | |
|
|
| 123 | } |
112 | } |
| 124 | |
113 | |
| 125 | # @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES |
114 | # @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES |
| 126 | # @DESCRIPTION: |
115 | # @DESCRIPTION: |
| 127 | # Arguments for build_target_directories. Takes the directories, in which the |
116 | # Arguments for build_target_directories. Takes the directories, in which the |
| … | |
… | |
| 162 | if [[ $EAPI != 2 ]]; then |
151 | if [[ $EAPI != 2 ]]; then |
| 163 | qt4-build_src_prepare |
152 | qt4-build_src_prepare |
| 164 | fi |
153 | fi |
| 165 | } |
154 | } |
| 166 | |
155 | |
|
|
156 | # @ECLASS-VARIABLE: PATCHES |
|
|
157 | # @DESCRIPTION: |
|
|
158 | # In case you have patches to apply, specify them in PATCHES variable. Make sure |
|
|
159 | # to specify the full path. This variable is necessary for src_prepare phase. |
|
|
160 | # example: |
|
|
161 | # PATCHES="${FILESDIR}"/mypatch.patch |
|
|
162 | # ${FILESDIR}"/mypatch2.patch" |
|
|
163 | # |
| 167 | |
164 | |
| 168 | # @FUNCTION: qt4-build_src_prepare |
165 | # @FUNCTION: qt4-build_src_prepare |
| 169 | # @DESCRIPTION: |
166 | # @DESCRIPTION: |
| 170 | # Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix |
167 | # Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix |
| 171 | # source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf. |
168 | # source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf. |
| … | |
… | |
| 174 | |
171 | |
| 175 | if [[ ${PN} != qt-core ]]; then |
172 | if [[ ${PN} != qt-core ]]; then |
| 176 | skip_qmake_build_patch |
173 | skip_qmake_build_patch |
| 177 | skip_project_generation_patch |
174 | skip_project_generation_patch |
| 178 | symlink_binaries_to_buildtree |
175 | symlink_binaries_to_buildtree |
| 179 | fi |
|
|
| 180 | |
|
|
| 181 | if ! use custom-cxxflags;then |
|
|
| 182 | # Don't let the user go too overboard with flags. |
|
|
| 183 | strip-flags |
|
|
| 184 | replace-flags -O3 -O2 |
|
|
| 185 | fi |
176 | fi |
| 186 | |
177 | |
| 187 | # Bug 178652 |
178 | # Bug 178652 |
| 188 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
179 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
| 189 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
180 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
| … | |
… | |
| 209 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
200 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
| 210 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
201 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
| 211 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
202 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
| 212 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
203 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
| 213 | |
204 | |
|
|
205 | base_src_prepare |
| 214 | } |
206 | } |
| 215 | |
207 | |
| 216 | # @FUNCTION: qt4-build_src_configure |
208 | # @FUNCTION: qt4-build_src_configure |
| 217 | # @DESCRIPTION: |
209 | # @DESCRIPTION: |
| 218 | # Default configure phase |
210 | # Default configure phase |
| … | |
… | |
| 280 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;; |
272 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;; |
| 281 | hppa|sh) myconf="${myconf} -arch generic" ;; |
273 | hppa|sh) myconf="${myconf} -arch generic" ;; |
| 282 | *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; |
274 | *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; |
| 283 | esac |
275 | esac |
| 284 | |
276 | |
| 285 | # Bug 261412 Qt configure detects archs by uname |
|
|
| 286 | case "$(tc-arch)" in |
|
|
| 287 | ppc) myconf="${myconf} -platform linux-g++-32";; |
|
|
| 288 | esac |
|
|
| 289 | |
|
|
| 290 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
277 | myconf="${myconf} -platform $(qt_mkspecs_dir) -stl -verbose -largefile -confirm-license -no-rpath |
| 291 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
278 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 292 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
279 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
| 293 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
280 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
| 294 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
281 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
| 295 | -demosdir ${QTDEMOSDIR} -silent -fast |
282 | -demosdir ${QTDEMOSDIR} -silent -fast |
| 296 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
283 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
| 297 | -reduce-relocations -nomake examples -nomake demos" |
284 | -reduce-relocations -nomake examples -nomake demos" |
| 298 | |
285 | |
| 299 | # Make eclass 4.5.{1,2} ready |
286 | # Make eclass 4.5.{1,2} ready |
| 300 | case "${MY_PV}" in |
287 | case "${MY_PV}" in |
| 301 | 4.5.1 | 4.5.2) |
288 | 4.5.1 | 4.5.2) |
| 302 | myconf="${myconf} -opensource" |
289 | myconf="${myconf} -opensource" |
| 303 | ;; |
290 | ;; |
| … | |
… | |
| 447 | ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any" |
434 | ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any" |
| 448 | ewarn "additional KDE4/Qt4 styles, qscintilla and PyQt4. Before filing a bug report," |
435 | ewarn "additional KDE4/Qt4 styles, qscintilla and PyQt4. Before filing a bug report," |
| 449 | ewarn "make sure all your Qt4 packages are up-to-date and built with the same" |
436 | ewarn "make sure all your Qt4 packages are up-to-date and built with the same" |
| 450 | ewarn "configuration." |
437 | ewarn "configuration." |
| 451 | ewarn |
438 | ewarn |
| 452 | ewarn "For more information, see http://doc.trolltech.com/4.4/plugins-howto.html" |
439 | ewarn "For more information, see http://doc.trolltech.com/${PV%.*}/plugins-howto.html" |
| 453 | echo |
440 | echo |
| 454 | } |
441 | } |
| 455 | |
442 | |
| 456 | # @FUNCTION: skip_qmake_build_patch |
443 | # @FUNCTION: skip_qmake_build_patch |
| 457 | # @DESCRIPTION: |
444 | # @DESCRIPTION: |
| … | |
… | |
| 507 | rmdir "${D}"/${QTLIBDIR}/pkgconfig |
494 | rmdir "${D}"/${QTLIBDIR}/pkgconfig |
| 508 | } |
495 | } |
| 509 | |
496 | |
| 510 | # @FUNCTION: qt_use |
497 | # @FUNCTION: qt_use |
| 511 | # @USAGE: < flag > [ feature ] [ enableval ] |
498 | # @USAGE: < flag > [ feature ] [ enableval ] |
| 512 | # @DESCRIPTION: |
499 | # @DESCRIPTION: |
| 513 | # This will echo "${enableval}-${feature}" if <flag> is enabled, or |
500 | # This will echo "${enableval}-${feature}" if <flag> is enabled, or |
| 514 | # "-no-${feature} if the flag is disabled. If [feature] is not specified <flag> |
501 | # "-no-${feature} if the flag is disabled. If [feature] is not specified <flag> |
| 515 | # will be used for that. If [enableval] is not specified, it omits the |
502 | # will be used for that. If [enableval] is not specified, it omits the |
| 516 | # assignment-part |
503 | # assignment-part |
| 517 | qt_use() { |
504 | qt_use() { |
| … | |
… | |
| 599 | fi |
586 | fi |
| 600 | } |
587 | } |
| 601 | |
588 | |
| 602 | # @FUNCTION: qt_mkspecs_dir |
589 | # @FUNCTION: qt_mkspecs_dir |
| 603 | # @RETURN: the specs-directory w/o path |
590 | # @RETURN: the specs-directory w/o path |
| 604 | # @DESCRIPTION: |
591 | # @DESCRIPTION: |
| 605 | # Allows us to define which mkspecs dir we want to use. |
592 | # Allows us to define which mkspecs dir we want to use. |
| 606 | qt_mkspecs_dir() { |
593 | qt_mkspecs_dir() { |
| 607 | # Allows us to define which mkspecs dir we want to use. |
594 | # Allows us to define which mkspecs dir we want to use. |
| 608 | local spec |
595 | local spec |
| 609 | |
596 | |