From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.77) (envelope-from ) id 1SpQdY-00070e-By for garchives@archives.gentoo.org; Thu, 12 Jul 2012 21:09:24 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5F674E02CB; Thu, 12 Jul 2012 21:09:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 205B1E01F1 for ; Thu, 12 Jul 2012 21:09:07 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 643071B4060 for ; Thu, 12 Jul 2012 21:09:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 2621AE5433 for ; Thu, 12 Jul 2012 21:09:05 +0000 (UTC) From: "Davide Pesavento" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Davide Pesavento" Message-ID: <1342126934.b3a4e045f5aee9115a190b1eaf84ee3d38cb091b.pesa@gentoo> Subject: [gentoo-commits] proj/qt:master commit in: eclass/ X-VCS-Repository: proj/qt X-VCS-Files: eclass/qt5-module.eclass X-VCS-Directories: eclass/ X-VCS-Committer: pesa X-VCS-Committer-Name: Davide Pesavento X-VCS-Revision: b3a4e045f5aee9115a190b1eaf84ee3d38cb091b X-VCS-Branch: master Date: Thu, 12 Jul 2012 21:09:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: e37898f0-d319-480b-8340-d8e35dec728a X-Archives-Hash: 602a372cbcd97e40510b32a74c3dadd4 commit: b3a4e045f5aee9115a190b1eaf84ee3d38cb091b Author: Davide Pesavento gmail com> AuthorDate: Thu Jul 12 21:02:14 2012 +0000 Commit: Davide Pesavento gentoo org> CommitDate: Thu Jul 12 21:02:14 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/qt.git;a=3Dco= mmit;h=3Db3a4e045 [qt5-module.eclass] New eclass for Qt5 modules not belonging to qtbase. --- eclass/qt5-module.eclass | 280 ++++++++++++++++++++++++++++++++++++++++= ++++++ 1 files changed, 280 insertions(+), 0 deletions(-) diff --git a/eclass/qt5-module.eclass b/eclass/qt5-module.eclass new file mode 100644 index 0000000..0fbc140 --- /dev/null +++ b/eclass/qt5-module.eclass @@ -0,0 +1,280 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# @ECLASS: qt5-module.eclass +# @MAINTAINER: +# Qt herd +# @BLURB: Eclass for Qt5 split ebuilds. +# @DESCRIPTION: +# This eclass contains various functions that are used when building Qt5= . +# Requires EAPI 4. + +case ${EAPI} in + 4) : ;; + *) die "qt5-module.eclass: unsupported EAPI=3D${EAPI:-0}" ;; +esac + +inherit eutils flag-o-matic multilib toolchain-funcs versionator + +if [[ ${PV} =3D=3D *9999* ]]; then + QT5_BUILD_TYPE=3D"live" + inherit git-2 +else + QT5_BUILD_TYPE=3D"release" +fi + +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_comp= ile src_install src_test + +HOMEPAGE=3D"http://qt-project.org/ http://qt.nokia.com/" +LICENSE=3D"|| ( LGPL-2.1 GPL-3 )" +SLOT=3D"5" + +EGIT_PROJECT=3D${PN/-} +case ${QT5_BUILD_TYPE} in + live) + EGIT_REPO_URI=3D"git://gitorious.org/qt/${EGIT_PROJECT}.git + https://git.gitorious.org/qt/${EGIT_PROJECT}.git" + ;; + release) + SRC_URI=3D"" # TODO + ;; +esac + +IUSE=3D"debug test" + +DEPEND=3D" + virtual/pkgconfig + test? ( ~x11-libs/qt-test-${PV}[debug=3D] ) +" +if [[ ${QT5_BUILD_TYPE} =3D=3D "live" ]]; then + DEPEND+=3D" dev-lang/perl" +fi + +# @ECLASS-VARIABLE: PATCHES +# @DEFAULT_UNSET +# @DESCRIPTION: +# Array variable containing all the patches to be applied. This variable +# is expected to be defined in the global scope of ebuilds. Make sure to +# specify the full path. This variable is used in src_prepare phase. +# +# Example: +# @CODE +# PATCHES=3D( +# "${FILESDIR}/mypatch.patch" +# "${FILESDIR}/mypatch2.patch" +# ) +# @CODE + +# @ECLASS-VARIABLE: QT5_TARGET_SUBDIRS +# @DEFAULT_UNSET +# @DESCRIPTION: +# Array variable containing the source directories that should be built. +# All paths must be relative to ${S}. + +# @ECLASS-VARIABLE: QT5_BUILD_DIR +# @DESCRIPTION: +# Build directory for out-of-source builds. +: ${QT5_BUILD_DIR:=3D${WORKDIR}/${P}_build} + +# @ECLASS-VARIABLE: QCONFIG_ADD +# @DESCRIPTION: +# List of options that need to be added to QT_CONFIG in qconfig.pri +: ${QCONFIG_ADD:=3D} + +# @ECLASS-VARIABLE: QCONFIG_REMOVE +# @DESCRIPTION: +# List of options that need to be removed from QT_CONFIG in qconfig.pri +: ${QCONFIG_REMOVE:=3D} + +# @ECLASS-VARIABLE: QCONFIG_DEFINE +# @DESCRIPTION: +# List of variables that should be defined at the top of QtCore/qconfig.= h +: ${QCONFIG_DEFINE:=3D} + +# @FUNCTION: qt5-module_pkg_setup +# @DESCRIPTION: +# Warns and/or dies if the user is trying to downgrade Qt. +qt5-module_pkg_setup() { + # Protect users by not allowing downgrades between releases. + # Downgrading revisions within the same release should be allowed. + if has_version ">${CATEGORY}/${P}-r9999:${SLOT}"; then + if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then + eerror " *** Sanity check to keep you from breaking your system = ***" + eerror "Downgrading Qt is completely unsupported and will break your = system!" + die "aborting to save your system" + else + ewarn "Downgrading Qt is completely unsupported and will break your s= ystem!" + fi + fi +} + +# @FUNCTION: qt5-module_src_unpack +# @DESCRIPTION: +# Unpacks the sources. +qt5-module_src_unpack() { + if ! version_is_at_least 4.4 $(gcc-version); then + ewarn "Using a GCC version lower than 4.4 is not supported." + fi + + if [[ ${PN} =3D=3D "qt-webkit" ]]; then + eshopts_push -s extglob + if is-flagq '-g?(gdb)?([1-9])'; then + echo + ewarn "You have enabled debug info (probably have -g or -ggdb in your= CFLAGS/CXXFLAGS)." + ewarn "You may experience really long compilation times and/or increa= sed memory usage." + ewarn "If compilation fails, please try removing -g/-ggdb before repo= rting a bug." + ewarn "For more info check out https://bugs.gentoo.org/307861" + echo + fi + eshopts_pop + fi + + case ${QT5_BUILD_TYPE} in + live) + git-2_src_unpack + ;; + release) + default + ;; + esac +} + +# @FUNCTION: qt5-module_src_prepare +# @DESCRIPTION: +# Prepare the sources before the configure phase. +qt5-module_src_prepare() { + qt5_prepare_env + + mkdir -p "${QT5_BUILD_DIR}" || die + + # Apply patches + [[ -n ${PATCHES[@]} ]] && epatch "${PATCHES[@]}" + epatch_user +} + +# @FUNCTION: qt5-module_src_configure +# @DESCRIPTION: +# Runs ./configure and qmake. +qt5-module_src_configure() { + # toolchain setup + tc-export CC CXX RANLIB STRIP + # qmake-generated Makefiles use LD/LINK for linking + export LD=3D"$(tc-getCXX)" + + pushd "${QT5_BUILD_DIR}" > /dev/null || die + + einfo "Running qmake" + "${QTBINDIR}"/qmake \ + "${S}/${PN/-}.pro" \ + CONFIG+=3Dnostrip \ + || die "qmake failed" + + popd > /dev/null || die +} + +# @FUNCTION: qt5-module_src_compile +# @DESCRIPTION: +# Compiles the code in target directories. +qt5-module_src_compile() { + qt5_foreach_target_subdir emake +} + +# @FUNCTION: qt5-module_src_test +# @DESCRIPTION: +# Runs tests in target directories. +# TODO: find a way to avoid circular deps with USE=3Dtest. +qt5-module_src_test() { + echo ">>> Test phase [QtTest]: ${CATEGORY}/${PF}" + + # create a custom testrunner script that correctly sets + # {,DY}LD_LIBRARY_PATH before executing the given test + local testrunner=3D${QT5_BUILD_DIR}/gentoo-testrunner + cat <<-EOF > "${testrunner}" + #!/bin/sh + export LD_LIBRARY_PATH=3D"${QT5_BUILD_DIR}/lib:${QTLIBDIR}" + export DYLD_LIBRARY_PATH=3D"${QT5_BUILD_DIR}/lib:${QTLIBDIR}" + "\$@" + EOF + chmod +x "${testrunner}" + + qmake() { + "${QTBINDIR}"/qmake \ + "${S}/${subdir}/${subdir##*/}.pro" \ + || die "qmake failed" + } + qt5_foreach_target_subdir qmake + qt5_foreach_target_subdir emake + qt5_foreach_target_subdir emake TESTRUNNER=3D"'${testrunner}'" check +} + +# @FUNCTION: qt5-module_src_install +# @DESCRIPTION: +# Performs the actual installation of target directories. +# TODO: pkgconfig files are installed in the wrong place +qt5-module_src_install() { + qt5_foreach_target_subdir emake INSTALL_ROOT=3D"${D}" install + + # TODO: qt5_install_module_qconfigs + + # remove .la files since we are building only shared libraries + prune_libtool_files +} + +# @FUNCTION: qt_use +# @USAGE: [feature] [enableval] +# @DESCRIPTION: +# This will echo "-${enableval}-${feature}" if is enabled, or +# "-no-${feature}" if it's disabled. If [feature] is not specified, +# will be used for that. If [enableval] is not specified, the +# "-${enableval}" prefix is omitted. +qt_use() { + use "$1" && echo "${3:+-$3}-${2:-$1}" || echo "-no-${2:-$1}" +} + + +###### Internal functions ###### + +# @FUNCTION: qt5_prepare_env +# @INTERNAL +# @DESCRIPTION: +# Prepares the environment for building Qt. +qt5_prepare_env() { + # setup installation directories + QTPREFIXDIR=3D${EPREFIX}/usr + QTBINDIR=3D${QTPREFIXDIR}/qt5/bin # FIXME + QTLIBDIR=3D${QTPREFIXDIR}/$(get_libdir)/qt5 + QTDOCDIR=3D${QTPREFIXDIR}/share/doc/qt-${PV} + QTHEADERDIR=3D${QTPREFIXDIR}/include/qt5 + QTPLUGINDIR=3D${QTLIBDIR}/plugins + QTIMPORTDIR=3D${QTLIBDIR}/imports + QTDATADIR=3D${QTPREFIXDIR}/share/qt5 + QTTRANSDIR=3D${QTDATADIR}/translations + QTEXAMPLESDIR=3D${QTDATADIR}/examples + QTTESTSDIR=3D${QTDATADIR}/tests + QTSYSCONFDIR=3D${EPREFIX}/etc/qt5 +} + +# @FUNCTION: qt5_foreach_target_subdir +# @INTERNAL +# @DESCRIPTION: +# Executes the arguments inside each directory listed in QT5_TARGET_SUBD= IRS. +qt5_foreach_target_subdir() { + [[ -z ${QT5_TARGET_SUBDIRS[@]} ]] && QT5_TARGET_SUBDIRS=3D("") + + local subdir + for subdir in "${QT5_TARGET_SUBDIRS[@]}"; do + if [[ ${EBUILD_PHASE} =3D=3D "test" ]]; then + subdir=3Dtests/auto${subdir#src} + [[ -d ${S}/${subdir} ]] || continue + fi + + mkdir -p "${QT5_BUILD_DIR}/${subdir}" || die + pushd "${QT5_BUILD_DIR}/${subdir}" > /dev/null || die + + einfo "Running $* ${subdir:+in ${subdir}}" + "$@" + + popd > /dev/null || die + done +}