/[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.136 Revision 1.141
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.136 2012/09/27 16:35:41 axs Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.141 2012/12/31 06:29:42 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 11
12case ${EAPI} in 12case ${EAPI} in
13 2|3|4|5) : ;; 13 3|4|5) : ;;
14 *) die "qt4-build.eclass requires EAPI 2, 3 or 4." ;; 14 *) die "qt4-build.eclass: unsupported EAPI=${EAPI:-0}" ;;
15esac 15esac
16 16
17inherit eutils flag-o-matic multilib toolchain-funcs versionator 17inherit eutils flag-o-matic multilib toolchain-funcs versionator
18 18
19if [[ ${PV} == *9999* ]]; then 19if [[ ${PV} == *9999* ]]; then
21 inherit git-2 21 inherit git-2
22else 22else
23 QT4_BUILD_TYPE="release" 23 QT4_BUILD_TYPE="release"
24fi 24fi
25 25
26HOMEPAGE="http://qt-project.org/ http://qt.nokia.com/" 26HOMEPAGE="http://qt-project.org/ http://qt.digia.com/"
27LICENSE="|| ( LGPL-2.1 GPL-3 )" 27LICENSE="|| ( LGPL-2.1 GPL-3 )"
28 28
29MY_PV=${PV/_/-} 29MY_PV=${PV/_/-}
30MY_P=qt-everywhere-opensource-src-${MY_PV} 30MY_P=qt-everywhere-opensource-src-${MY_PV}
31 31
34 EGIT_REPO_URI="git://gitorious.org/qt/qt.git 34 EGIT_REPO_URI="git://gitorious.org/qt/qt.git
35 https://git.gitorious.org/qt/qt.git" 35 https://git.gitorious.org/qt/qt.git"
36 EGIT_BRANCH=${PV%.9999} 36 EGIT_BRANCH=${PV%.9999}
37 ;; 37 ;;
38 release) 38 release)
39 if version_is_at_least 4.8.1; then
40 SRC_URI="http://releases.qt-project.org/qt4/source/${MY_P}.tar.gz" 39 SRC_URI="http://releases.qt-project.org/qt4/source/${MY_P}.tar.gz"
41 else
42 SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz"
43 fi
44 ;; 40 ;;
45esac 41esac
46 42
47IUSE="aqua debug pch" 43IUSE="aqua debug pch"
48[[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] && IUSE+=" +exceptions" 44[[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] && IUSE+=" +exceptions"
49if version_is_at_least 4.8; then
50 [[ ${CATEGORY}/${PN} != x11-libs/qt-webkit ]] && IUSE+=" c++0x" 45[[ ${CATEGORY}/${PN} != x11-libs/qt-webkit ]] && IUSE+=" c++0x"
51 version_is_at_least 4.8.3 || IUSE+=" qpa"
52fi
53 46
54DEPEND="virtual/pkgconfig" 47DEPEND="virtual/pkgconfig"
55if [[ ${QT4_BUILD_TYPE} == live ]]; then 48if [[ ${QT4_BUILD_TYPE} == live ]]; then
56 DEPEND+=" dev-lang/perl" 49 DEPEND+=" dev-lang/perl"
57fi 50fi
99 92
100# @FUNCTION: qt4-build_pkg_setup 93# @FUNCTION: qt4-build_pkg_setup
101# @DESCRIPTION: 94# @DESCRIPTION:
102# Sets up PATH and LD_LIBRARY_PATH. 95# Sets up PATH and LD_LIBRARY_PATH.
103qt4-build_pkg_setup() { 96qt4-build_pkg_setup() {
104 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
105
106 # Protect users by not allowing downgrades between releases. 97 # Protect users by not allowing downgrades between releases.
107 # Downgrading revisions within the same release should be allowed. 98 # Downgrading revisions within the same release should be allowed.
108 if has_version ">${CATEGORY}/${P}-r9999:4"; then 99 if has_version ">${CATEGORY}/${P}-r9999:4"; then
109 if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then 100 if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
110 eerror " *** Sanity check to keep you from breaking your system ***" 101 eerror " *** Sanity check to keep you from breaking your system ***"
188# @DEFAULT_UNSET 179# @DEFAULT_UNSET
189# @DESCRIPTION: 180# @DESCRIPTION:
190# PATCHES array variable containing all various patches to be applied. 181# PATCHES array variable containing all various patches to be applied.
191# This variable is expected to be defined in global scope of ebuild. 182# This variable is expected to be defined in global scope of ebuild.
192# Make sure to specify the full path. This variable is utilised in 183# Make sure to specify the full path. This variable is utilised in
193# src_unpack/src_prepare phase, based on EAPI. 184# src_prepare() phase.
194# 185#
195# @CODE 186# @CODE
196# PATCHES=( "${FILESDIR}/mypatch.patch" 187# PATCHES=( "${FILESDIR}/mypatch.patch"
197# "${FILESDIR}/patches_folder/" ) 188# "${FILESDIR}/patches_folder/" )
198# @CODE 189# @CODE
206 197
207 if [[ ${QT4_BUILD_TYPE} == live ]]; then 198 if [[ ${QT4_BUILD_TYPE} == live ]]; then
208 QTDIR="." ./bin/syncqt || die "syncqt failed" 199 QTDIR="." ./bin/syncqt || die "syncqt failed"
209 fi 200 fi
210 201
211 if version_is_at_least 4.7; then
212 # avoid X11 dependency in non-gui packages 202 # avoid X11 dependency in non-gui packages
213 local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns" 203 local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns"
214 has ${PN} ${nolibx11_pkgs} && qt_nolibx11 204 has ${PN} ${nolibx11_pkgs} && qt_nolibx11
215 fi
216 205
217 if use aqua; then 206 if use aqua; then
218 # provide a proper macx-g++-64 207 # provide a proper macx-g++-64
219 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) 208 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
220 209
276 -i configure \ 265 -i configure \
277 || die "sed SYSTEM_VARIABLES failed" 266 || die "sed SYSTEM_VARIABLES failed"
278 267
279 # Respect CC, CXX, LINK and *FLAGS in config.tests 268 # Respect CC, CXX, LINK and *FLAGS in config.tests
280 find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \ 269 find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \
281 sed -i -e "/bin\/qmake/ s: \"QT_BUILD_TREE=: \ 270 sed -i -e "/bin\/qmake/ s: \"\$SRCDIR/: \
282 'QMAKE_CC=$(tc-getCC)' 'QMAKE_CXX=$(tc-getCXX)' 'QMAKE_LINK=$(tc-getCXX)' \ 271 'QMAKE_CC=$(tc-getCC)' 'QMAKE_CXX=$(tc-getCXX)' 'QMAKE_LINK=$(tc-getCXX)' \
283 'QMAKE_CFLAGS+=${CFLAGS}' 'QMAKE_CXXFLAGS+=${CXXFLAGS}' 'QMAKE_LFLAGS+=${LDFLAGS}'&:" \ 272 'QMAKE_CFLAGS+=${CFLAGS}' 'QMAKE_CXXFLAGS+=${CXXFLAGS}' 'QMAKE_LFLAGS+=${LDFLAGS}'&:" \
284 || die "sed config.tests failed" 273 || die "sed config.tests failed"
285
286 if ! version_is_at_least 4.8; then
287 # Strip predefined CFLAGS from mkspecs (bugs 312689 and 352778)
288 sed -i -e '/^QMAKE_CFLAGS_RELEASE/s:+=.*:+=:' mkspecs/common/g++.conf || die
289 fi
290 274
291 # Bug 172219 275 # Bug 172219
292 sed -e 's:/X11R6/:/:' -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die 276 sed -e 's:/X11R6/:/:' -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
293 277
294 if [[ ${CHOST} == *-darwin* ]]; then 278 if [[ ${CHOST} == *-darwin* ]]; then
374 -bindir ${QTBINDIR} 358 -bindir ${QTBINDIR}
375 -libdir ${QTLIBDIR} 359 -libdir ${QTLIBDIR}
376 -docdir ${QTDOCDIR} 360 -docdir ${QTDOCDIR}
377 -headerdir ${QTHEADERDIR} 361 -headerdir ${QTHEADERDIR}
378 -plugindir ${QTPLUGINDIR} 362 -plugindir ${QTPLUGINDIR}
379 $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR}) 363 -importdir ${QTIMPORTDIR}
380 -datadir ${QTDATADIR} 364 -datadir ${QTDATADIR}
381 -translationdir ${QTTRANSDIR} 365 -translationdir ${QTTRANSDIR}
382 -sysconfdir ${QTSYSCONFDIR} 366 -sysconfdir ${QTSYSCONFDIR}
383 -examplesdir ${QTEXAMPLESDIR} 367 -examplesdir ${QTEXAMPLESDIR}
384 -demosdir ${QTDEMOSDIR} 368 -demosdir ${QTDEMOSDIR}
413 conf+=" -no-separate-debug-info" 397 conf+=" -no-separate-debug-info"
414 398
415 # exceptions USE flag 399 # exceptions USE flag
416 conf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)" 400 conf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)"
417 401
418 # disable rpath on Qt >= 4.8 (bug 380415) 402 # disable rpath (bug 380415), except on prefix (bug 417169)
419 # but leave it enabled on prefix (bug 417169) 403 use prefix || conf+=" -no-rpath"
420 version_is_at_least 4.8 && use !prefix && conf+=" -no-rpath"
421 404
422 # precompiled headers don't work on hardened, where the flag is masked 405 # precompiled headers don't work on hardened, where the flag is masked
423 conf+=" $(qt_use pch)" 406 conf+=" $(qt_use pch)"
424 407
425 # -reduce-relocations 408 # -reduce-relocations
548 531
549# @FUNCTION: qt4-build_src_install 532# @FUNCTION: qt4-build_src_install
550# @DESCRIPTION: 533# @DESCRIPTION:
551# Perform the actual installation including some library fixes. 534# Perform the actual installation including some library fixes.
552qt4-build_src_install() { 535qt4-build_src_install() {
553 [[ ${EAPI} == 2 ]] && use !prefix && ED=${D}
554 setqtenv 536 setqtenv
555 537
556 install_directories ${QT4_TARGET_DIRECTORIES} 538 install_directories ${QT4_TARGET_DIRECTORIES}
557 install_qconfigs 539 install_qconfigs
558 fix_library_files 540 fix_library_files
559 fix_includes 541 fix_includes
560 542
561 # remove .la files since we are building only shared Qt libraries 543 # remove .la files since we are building only shared libraries
562 find "${D}"${QTLIBDIR} -type f -name '*.la' -print0 | xargs -0 rm -f 544 prune_libtool_files
563} 545}
564 546
565# @FUNCTION: setqtenv 547# @FUNCTION: setqtenv
566# @INTERNAL 548# @INTERNAL
567setqtenv() { 549setqtenv() {
568 # Set up installation directories 550 # Set up installation directories
569 QTPREFIXDIR=${EPREFIX}/usr 551 QTPREFIXDIR=${EPREFIX}/usr
570 QTBINDIR=${EPREFIX}/usr/bin 552 QTBINDIR=${QTPREFIXDIR}/bin
571 QTLIBDIR=${EPREFIX}/usr/$(get_libdir)/qt4 553 QTLIBDIR=${QTPREFIXDIR}/$(get_libdir)/qt4
572 QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig 554 QTPCDIR=${QTPREFIXDIR}/$(get_libdir)/pkgconfig
573 QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV} 555 QTDOCDIR=${QTPREFIXDIR}/share/doc/qt-${PV}
574 QTHEADERDIR=${EPREFIX}/usr/include/qt4 556 QTHEADERDIR=${QTPREFIXDIR}/include/qt4
575 QTPLUGINDIR=${QTLIBDIR}/plugins 557 QTPLUGINDIR=${QTLIBDIR}/plugins
576 QTIMPORTDIR=${QTLIBDIR}/imports 558 QTIMPORTDIR=${QTLIBDIR}/imports
577 QTDATADIR=${EPREFIX}/usr/share/qt4 559 QTDATADIR=${QTPREFIXDIR}/share/qt4
578 QTTRANSDIR=${QTDATADIR}/translations 560 QTTRANSDIR=${QTDATADIR}/translations
579 QTSYSCONFDIR=${EPREFIX}/etc/qt4 561 QTSYSCONFDIR=${EPREFIX}/etc/qt4
580 QTEXAMPLESDIR=${QTDATADIR}/examples 562 QTEXAMPLESDIR=${QTDATADIR}/examples
581 QTDEMOSDIR=${QTDATADIR}/demos 563 QTDEMOSDIR=${QTDATADIR}/demos
582 QMAKE_LIBDIR_QT=${QTLIBDIR} 564 QMAKE_LIBDIR_QT=${QTLIBDIR}
583 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4
584 565
585 PLATFORM=$(qt_mkspecs_dir) 566 PLATFORM=$(qt_mkspecs_dir)
586 unset QMAKESPEC 567 unset QMAKESPEC
587 568
588 export XDG_CONFIG_HOME="${T}" 569 export XDG_CONFIG_HOME="${T}"
592# @USAGE: < directories > 573# @USAGE: < directories >
593# @INTERNAL 574# @INTERNAL
594# @DESCRIPTION: 575# @DESCRIPTION:
595# Generates Makefiles for the given list of directories. 576# Generates Makefiles for the given list of directories.
596prepare_directories() { 577prepare_directories() {
578 # avoid running over the maximum argument number, bug #299810
579 {
580 echo "${S}"/mkspecs/common/*.conf
581 find "${S}" -name '*.pr[io]'
582 } | xargs sed -i \
583 -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \
584 -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \
585 || die
586
597 for x in "$@"; do 587 for x in "$@"; do
598 pushd "${S}"/${x} >/dev/null || die 588 pushd "${S}"/${x} >/dev/null || die
599 einfo "Running qmake in: ${x}" 589 einfo "Running qmake in: ${x}"
600 # avoid running over the maximum argument number, bug #299810 590 "${S}"/bin/qmake \
601 { 591 "LIBS+=-L${QTLIBDIR}" \
602 echo "${S}"/mkspecs/common/*.conf 592 "CONFIG+=nostrip" \
603 find "${S}" -name '*.pr[io]' 593 || die "qmake failed"
604 } | xargs sed -i \
605 -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \
606 -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \
607 || die
608 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
609 popd >/dev/null || die 594 popd >/dev/null || die
610 done 595 done
611} 596}
612
613 597
614# @FUNCTION: build_directories 598# @FUNCTION: build_directories
615# @USAGE: < directories > 599# @USAGE: < directories >
616# @INTERNAL 600# @INTERNAL
617# @DESCRIPTION: 601# @DESCRIPTION:
618# Compiles the code in the given list of directories. 602# Compiles the code in the given list of directories.
619build_directories() { 603build_directories() {
620 for x in "$@"; do 604 for x in "$@"; do
621 pushd "${S}"/${x} >/dev/null || die 605 pushd "${S}"/${x} >/dev/null || die
606 emake \
607 AR="$(tc-getAR) cqs" \
622 emake CC="$(tc-getCC)" \ 608 CC="$(tc-getCC)" \
623 CXX="$(tc-getCXX)" \ 609 CXX="$(tc-getCXX)" \
624 LINK="$(tc-getCXX)" || die "emake failed" 610 LINK="$(tc-getCXX)" \
611 RANLIB=":" \
612 STRIP=":" \
613 || die "emake failed"
625 popd >/dev/null || die 614 popd >/dev/null || die
626 done 615 done
627} 616}
628 617
629# @FUNCTION: install_directories 618# @FUNCTION: install_directories

Legend:
Removed from v.1.136  
changed lines
  Added in v.1.141

  ViewVC Help
Powered by ViewVC 1.1.20