/[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.133 Revision 1.139
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.133 2012/06/18 21:33:50 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.139 2012/11/12 09:28:53 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) : ;; 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 base 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
20 QT4_BUILD_TYPE="live" 20 QT4_BUILD_TYPE="live"
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
99 99
100# @FUNCTION: qt4-build_pkg_setup 100# @FUNCTION: qt4-build_pkg_setup
101# @DESCRIPTION: 101# @DESCRIPTION:
102# Sets up PATH and LD_LIBRARY_PATH. 102# Sets up PATH and LD_LIBRARY_PATH.
103qt4-build_pkg_setup() { 103qt4-build_pkg_setup() {
104 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
105
106 # Protect users by not allowing downgrades between releases. 104 # Protect users by not allowing downgrades between releases.
107 # Downgrading revisions within the same release should be allowed. 105 # Downgrading revisions within the same release should be allowed.
108 if has_version ">${CATEGORY}/${P}-r9999:4"; then 106 if has_version ">${CATEGORY}/${P}-r9999:4"; then
109 if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then 107 if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
110 eerror " *** Sanity check to keep you from breaking your system ***" 108 eerror " *** Sanity check to keep you from breaking your system ***"
188# @DEFAULT_UNSET 186# @DEFAULT_UNSET
189# @DESCRIPTION: 187# @DESCRIPTION:
190# PATCHES array variable containing all various patches to be applied. 188# PATCHES array variable containing all various patches to be applied.
191# This variable is expected to be defined in global scope of ebuild. 189# 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 190# Make sure to specify the full path. This variable is utilised in
193# src_unpack/src_prepare phase, based on EAPI. 191# src_prepare() phase.
194# 192#
195# @CODE 193# @CODE
196# PATCHES=( "${FILESDIR}/mypatch.patch" 194# PATCHES=( "${FILESDIR}/mypatch.patch"
197# "${FILESDIR}/patches_folder/" ) 195# "${FILESDIR}/patches_folder/" )
198# @CODE 196# @CODE
206 204
207 if [[ ${QT4_BUILD_TYPE} == live ]]; then 205 if [[ ${QT4_BUILD_TYPE} == live ]]; then
208 QTDIR="." ./bin/syncqt || die "syncqt failed" 206 QTDIR="." ./bin/syncqt || die "syncqt failed"
209 fi 207 fi
210 208
211 if version_is_at_least 4.7; then
212 # avoid X11 dependency in non-gui packages 209 # avoid X11 dependency in non-gui packages
213 local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns" 210 local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns"
214 has ${PN} ${nolibx11_pkgs} && qt_nolibx11 211 has ${PN} ${nolibx11_pkgs} && qt_nolibx11
215 fi
216 212
217 if use aqua; then 213 if use aqua; then
218 # provide a proper macx-g++-64 214 # provide a proper macx-g++-64
219 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) 215 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
220 216
264 sed -e "/^SYSTEM_VARIABLES=/i \ 260 sed -e "/^SYSTEM_VARIABLES=/i \
265 CC='$(tc-getCC)'\n\ 261 CC='$(tc-getCC)'\n\
266 CXX='$(tc-getCXX)'\n\ 262 CXX='$(tc-getCXX)'\n\
267 CFLAGS='${CFLAGS}'\n\ 263 CFLAGS='${CFLAGS}'\n\
268 CXXFLAGS='${CXXFLAGS}'\n\ 264 CXXFLAGS='${CXXFLAGS}'\n\
269 LDFLAGS='${LDFLAGS}'\n" \ 265 LDFLAGS='${LDFLAGS}'\n\
266 QMakeVar set QMAKE_CFLAGS_RELEASE\n\
267 QMakeVar set QMAKE_CFLAGS_DEBUG\n\
268 QMakeVar set QMAKE_CXXFLAGS_RELEASE\n\
269 QMakeVar set QMAKE_CXXFLAGS_DEBUG\n\
270 QMakeVar set QMAKE_LFLAGS_RELEASE\n\
271 QMakeVar set QMAKE_LFLAGS_DEBUG\n"\
270 -i configure \ 272 -i configure \
271 || die "sed SYSTEM_VARIABLES failed" 273 || die "sed SYSTEM_VARIABLES failed"
272 274
273 # Respect CC, CXX, LINK and *FLAGS in config.tests 275 # Respect CC, CXX, LINK and *FLAGS in config.tests
274 find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \ 276 find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \
350 sed -i -e '/PLATFORM=solaris-cc/s/cc/g++/' configure || die 352 sed -i -e '/PLATFORM=solaris-cc/s/cc/g++/' configure || die
351 # do not flirt with non-Prefix stuff, we're quite possessive 353 # do not flirt with non-Prefix stuff, we're quite possessive
352 sed -i -e '/^QMAKE_\(LIB\|INC\)DIR\(_X11\|_OPENGL\|\)\t/s/=.*$/=/' \ 354 sed -i -e '/^QMAKE_\(LIB\|INC\)DIR\(_X11\|_OPENGL\|\)\t/s/=.*$/=/' \
353 mkspecs/$(qt_mkspecs_dir)/qmake.conf || die 355 mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
354 356
355 base_src_prepare 357 # apply patches
358 [[ -n ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
359 epatch_user
356} 360}
357 361
358# @FUNCTION: qt4-build_src_configure 362# @FUNCTION: qt4-build_src_configure
359# @DESCRIPTION: 363# @DESCRIPTION:
360# Default configure phase 364# Default configure phase
366 -bindir ${QTBINDIR} 370 -bindir ${QTBINDIR}
367 -libdir ${QTLIBDIR} 371 -libdir ${QTLIBDIR}
368 -docdir ${QTDOCDIR} 372 -docdir ${QTDOCDIR}
369 -headerdir ${QTHEADERDIR} 373 -headerdir ${QTHEADERDIR}
370 -plugindir ${QTPLUGINDIR} 374 -plugindir ${QTPLUGINDIR}
371 $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR}) 375 -importdir ${QTIMPORTDIR}
372 -datadir ${QTDATADIR} 376 -datadir ${QTDATADIR}
373 -translationdir ${QTTRANSDIR} 377 -translationdir ${QTTRANSDIR}
374 -sysconfdir ${QTSYSCONFDIR} 378 -sysconfdir ${QTSYSCONFDIR}
375 -examplesdir ${QTEXAMPLESDIR} 379 -examplesdir ${QTEXAMPLESDIR}
376 -demosdir ${QTDEMOSDIR} 380 -demosdir ${QTDEMOSDIR}
540 544
541# @FUNCTION: qt4-build_src_install 545# @FUNCTION: qt4-build_src_install
542# @DESCRIPTION: 546# @DESCRIPTION:
543# Perform the actual installation including some library fixes. 547# Perform the actual installation including some library fixes.
544qt4-build_src_install() { 548qt4-build_src_install() {
545 [[ ${EAPI} == 2 ]] && use !prefix && ED=${D}
546 setqtenv 549 setqtenv
547 550
548 install_directories ${QT4_TARGET_DIRECTORIES} 551 install_directories ${QT4_TARGET_DIRECTORIES}
549 install_qconfigs 552 install_qconfigs
550 fix_library_files 553 fix_library_files
551 fix_includes 554 fix_includes
552 555
553 # remove .la files since we are building only shared Qt libraries 556 # remove .la files since we are building only shared libraries
554 find "${D}"${QTLIBDIR} -type f -name '*.la' -print0 | xargs -0 rm -f 557 prune_libtool_files
555} 558}
556 559
557# @FUNCTION: setqtenv 560# @FUNCTION: setqtenv
558# @INTERNAL 561# @INTERNAL
559setqtenv() { 562setqtenv() {
560 # Set up installation directories 563 # Set up installation directories
561 QTPREFIXDIR=${EPREFIX}/usr 564 QTPREFIXDIR=${EPREFIX}/usr
562 QTBINDIR=${EPREFIX}/usr/bin 565 QTBINDIR=${QTPREFIXDIR}/bin
563 QTLIBDIR=${EPREFIX}/usr/$(get_libdir)/qt4 566 QTLIBDIR=${QTPREFIXDIR}/$(get_libdir)/qt4
564 QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig 567 QTPCDIR=${QTPREFIXDIR}/$(get_libdir)/pkgconfig
565 QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV} 568 QTDOCDIR=${QTPREFIXDIR}/share/doc/qt-${PV}
566 QTHEADERDIR=${EPREFIX}/usr/include/qt4 569 QTHEADERDIR=${QTPREFIXDIR}/include/qt4
567 QTPLUGINDIR=${QTLIBDIR}/plugins 570 QTPLUGINDIR=${QTLIBDIR}/plugins
568 QTIMPORTDIR=${QTLIBDIR}/imports 571 QTIMPORTDIR=${QTLIBDIR}/imports
569 QTDATADIR=${EPREFIX}/usr/share/qt4 572 QTDATADIR=${QTPREFIXDIR}/share/qt4
570 QTTRANSDIR=${QTDATADIR}/translations 573 QTTRANSDIR=${QTDATADIR}/translations
571 QTSYSCONFDIR=${EPREFIX}/etc/qt4 574 QTSYSCONFDIR=${EPREFIX}/etc/qt4
572 QTEXAMPLESDIR=${QTDATADIR}/examples 575 QTEXAMPLESDIR=${QTDATADIR}/examples
573 QTDEMOSDIR=${QTDATADIR}/demos 576 QTDEMOSDIR=${QTDATADIR}/demos
574 QMAKE_LIBDIR_QT=${QTLIBDIR} 577 QMAKE_LIBDIR_QT=${QTLIBDIR}
575 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4
576 578
577 PLATFORM=$(qt_mkspecs_dir) 579 PLATFORM=$(qt_mkspecs_dir)
578 unset QMAKESPEC 580 unset QMAKESPEC
579 581
580 export XDG_CONFIG_HOME="${T}" 582 export XDG_CONFIG_HOME="${T}"
584# @USAGE: < directories > 586# @USAGE: < directories >
585# @INTERNAL 587# @INTERNAL
586# @DESCRIPTION: 588# @DESCRIPTION:
587# Generates Makefiles for the given list of directories. 589# Generates Makefiles for the given list of directories.
588prepare_directories() { 590prepare_directories() {
591 # avoid running over the maximum argument number, bug #299810
592 {
593 echo "${S}"/mkspecs/common/*.conf
594 find "${S}" -name '*.pr[io]'
595 } | xargs sed -i \
596 -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \
597 -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \
598 || die
599
589 for x in "$@"; do 600 for x in "$@"; do
590 pushd "${S}"/${x} >/dev/null || die 601 pushd "${S}"/${x} >/dev/null || die
591 einfo "Running qmake in: ${x}" 602 einfo "Running qmake in: ${x}"
592 # avoid running over the maximum argument number, bug #299810 603 "${S}"/bin/qmake \
593 { 604 "LIBS+=-L${QTLIBDIR}" \
594 echo "${S}"/mkspecs/common/*.conf 605 "CONFIG+=nostrip" \
595 find "${S}" -name '*.pr[io]' 606 || die "qmake failed"
596 } | xargs sed -i \
597 -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \
598 -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \
599 || die
600 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
601 popd >/dev/null || die 607 popd >/dev/null || die
602 done 608 done
603} 609}
604
605 610
606# @FUNCTION: build_directories 611# @FUNCTION: build_directories
607# @USAGE: < directories > 612# @USAGE: < directories >
608# @INTERNAL 613# @INTERNAL
609# @DESCRIPTION: 614# @DESCRIPTION:
610# Compiles the code in the given list of directories. 615# Compiles the code in the given list of directories.
611build_directories() { 616build_directories() {
612 for x in "$@"; do 617 for x in "$@"; do
613 pushd "${S}"/${x} >/dev/null || die 618 pushd "${S}"/${x} >/dev/null || die
619 emake \
620 AR="$(tc-getAR) cqs" \
614 emake CC="$(tc-getCC)" \ 621 CC="$(tc-getCC)" \
615 CXX="$(tc-getCXX)" \ 622 CXX="$(tc-getCXX)" \
616 LINK="$(tc-getCXX)" || die "emake failed" 623 LINK="$(tc-getCXX)" \
624 RANLIB=":" \
625 STRIP=":" \
626 || die "emake failed"
617 popd >/dev/null || die 627 popd >/dev/null || die
618 done 628 done
619} 629}
620 630
621# @FUNCTION: install_directories 631# @FUNCTION: install_directories

Legend:
Removed from v.1.133  
changed lines
  Added in v.1.139

  ViewVC Help
Powered by ViewVC 1.1.20