public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Georg Rudoy <0xd34df00d@gmail.com>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Supporting both Qt4 and Qt5 builds
Date: Sun, 10 Aug 2014 14:51:45 +0400	[thread overview]
Message-ID: <CAGbUWSKf=6iRiGf7ByL45jfvF+vo26pxGCqrb2Vy0AxzoqtXAA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]

Hi,

I'm thinking of converting a few ebuilds (x11-libs/qwt,
dev-libs/kqoauth, net-libs/qxmpp among them) to support building with
both Qt4 and Qt5.

Should this better be done by adding the corresponding useflags (qt4
and qt5 respectively) or by slotting? The pros and cons for each, off
the top of my head:

slotting:
+ Allows having different use flags for qt4 and qt5 builds (can't
think why that would be needed in the above examples though).
- Possibility of exponential growth of the number of slots in case
slotting would be required according to some other criteria (again,
can't think why that would be needed in the above examples).
- Requires keeping two different copies of the same ebuild with
basically the same build rules, with all the consequences.

useflags:
+ Seems to be easier and doing the required trick.
+ app-text/poppler already does this.
- Enabling support for previously disabled Qt version requires
rebuilding the whole library twice.

What's your opinion on this?

I've attached the useflag-based variant as a draft.

-- 
  Georg Rudoy

[-- Attachment #2: kqoauth-0.98-r2.ebuild --]
[-- Type: application/octet-stream, Size: 2170 bytes --]

# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/kqoauth/kqoauth-0.98-r1.ebuild,v 1.2 2014/07/11 17:54:39 zlogene Exp $

EAPI=5

inherit qt4-r2 multibuild vcs-snapshot

DESCRIPTION="Library for Qt that implements the OAuth 1.0 authentication specification"
HOMEPAGE="https://github.com/kypeli/kQOAuth"
SRC_URI="https://github.com/kypeli/kQOAuth/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+qt4 qt5"

DEPEND="
	qt4? ( dev-qt/qtcore:4
		dev-qt/qtgui:4 )
	qt5? ( dev-qt/qtcore:5
		dev-qt/qtgui:5 )
"
RDEPEND="${DEPEND}"
REQUIRED_USE="|| ( qt4 qt5 )"

src_prepare() {
	MULTIBUILD_VARIANTS=( )
	if use qt4; then
		MULTIBUILD_VARIANTS+=( qt4-shared )
	fi

	if use qt5; then
		MULTIBUILD_VARIANTS+=( qt5-shared )
	fi

	multibuild_copy_sources

	preparation() {
		# prevent tests from beeing built at src_compile
		sed -i -e '/SUBDIRS/s/ tests//' ${PN}.pro || die "sed on ${PN}.pro failed"
		# respect libdir
		sed -e 's:{INSTALL_PREFIX}/lib:[QT_INSTALL_LIBS]:g' -i src/src.pro || die "sed on src.pro failed"

		case "${MULTIBUILD_VARIANT}" in
			qt4-*)
				sed \
					-e "s/TARGET = kqoauth/TARGET = kqoauth-qt4/g" \
					-i src/src.pro || die
				qt4-r2_src_prepare
			;;
			qt5-*)
				sed \
					-e "s/TARGET = kqoauth/TARGET = kqoauth-qt5/g" \
					-i src/src.pro || die
			;;
		esac
	}

	multibuild_foreach_variant run_in_build_dir preparation
}

src_configure() {
	configuration() {
		case "${MULTIBUILD_VARIANT}" in
			qt4-*)
				qt4-r2_src_configure
			;;
			qt5-*)
				/usr/lib/qt5/bin/qmake
			;;
		esac

	}
	multibuild_parallel_foreach_variant run_in_build_dir configuration
}

src_compile() {
	compilation() {
		case "${MULTIBUILD_VARIANT}" in
			qt4-*)
				qt4-r2_src_compile
			;;
			qt5-*)
				emake
			;;
		esac

	}
	multibuild_foreach_variant run_in_build_dir compilation
}

src_install () {
	installation() {
		case "${MULTIBUILD_VARIANT}" in
			qt4-*)
				qt4-r2_src_install
			;;
			qt5-*)
				emake INSTALL_ROOT="${D}" install
			;;
		esac
	}

	multibuild_foreach_variant run_in_build_dir installation
}

             reply	other threads:[~2014-08-11 22:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-10 10:51 Georg Rudoy [this message]
2014-08-11 22:33 ` [gentoo-dev] Supporting both Qt4 and Qt5 builds Johannes Huber
2014-08-12  5:28 ` Ben de Groot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGbUWSKf=6iRiGf7ByL45jfvF+vo26pxGCqrb2Vy0AxzoqtXAA@mail.gmail.com' \
    --to=0xd34df00d@gmail.com \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox