public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Supporting both Qt4 and Qt5 builds
@ 2014-08-10 10:51 Georg Rudoy
  2014-08-11 22:33 ` Johannes Huber
  2014-08-12  5:28 ` Ben de Groot
  0 siblings, 2 replies; 3+ messages in thread
From: Georg Rudoy @ 2014-08-10 10:51 UTC (permalink / raw
  To: gentoo-dev

[-- 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
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] Supporting both Qt4 and Qt5 builds
  2014-08-10 10:51 [gentoo-dev] Supporting both Qt4 and Qt5 builds Georg Rudoy
@ 2014-08-11 22:33 ` Johannes Huber
  2014-08-12  5:28 ` Ben de Groot
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Huber @ 2014-08-11 22:33 UTC (permalink / raw
  To: gentoo-dev

Am Sonntag, 10. August 2014, 14:51:45 schrieb Georg Rudoy:
> 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.

Multibuild is prefered.

-- 
Johannes Huber (johu)
Gentoo Linux Developer / KDE Team
GPG Key ID F3CFD2BD



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] Supporting both Qt4 and Qt5 builds
  2014-08-10 10:51 [gentoo-dev] Supporting both Qt4 and Qt5 builds Georg Rudoy
  2014-08-11 22:33 ` Johannes Huber
@ 2014-08-12  5:28 ` Ben de Groot
  1 sibling, 0 replies; 3+ messages in thread
From: Ben de Groot @ 2014-08-12  5:28 UTC (permalink / raw
  To: gentoo-dev

On 10 August 2014 18:51, Georg Rudoy <0xd34df00d@gmail.com> wrote:
> 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?
>
> What's your opinion on this?
>

The Qt team has always recommended the useflag method for packages
that support more than one major version of Qt. This is also what we
implement ourselves. So for consistency's sake, please stick with the
useflags.

-- 
Cheers,

Ben | yngwin
Gentoo developer


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-12  5:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-10 10:51 [gentoo-dev] Supporting both Qt4 and Qt5 builds Georg Rudoy
2014-08-11 22:33 ` Johannes Huber
2014-08-12  5:28 ` Ben de Groot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox