public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] qt5-build.eclass: support sysroot builds
@ 2020-03-27 17:10 David Michael
  2020-03-27 20:49 ` James Le Cuirot
  0 siblings, 1 reply; 3+ messages in thread
From: David Michael @ 2020-03-27 17:10 UTC (permalink / raw
  To: gentoo-dev; +Cc: qt

Signed-off-by: David Michael <fedora.dm0@gmail.com>
---

Hi,

I'd like to be able to install qt5 packages in a sysroot for staging,
and this is an initial patch for it.  The pkg-config variables might not
be required, but it seemed appropriate to pass the sysroot-configured
versions through the build.  There are a few caveats:

  - The upstream configure scripts do some bad things like this:
    https://code.qt.io/cgit/qt/qtbase.git/tree/configure.pri#n363
    That makes the build fail for systems using lib64 (e.g. amd64).  I'm
    able to work around this by defining PKG_CONFIG_LIBDIR for dev-qt/*.

  - This isn't for real cross-compiling.  There are places where it
    tries to execute cross-compiled programs that I haven't investigated
    yet, so this is only for building a sysroot for an architecture
    compatible with the build system for now.

  - The qt packages depend on each other being installed in / as well as
    the sysroot, so their ebuilds will need BDEPENDs added.

  - I've only gotten to testing a few packages that are dependencies of
    other applications (like VLC), so I may be missing breakages.

The patch basically just sets -sysroot when $SYSROOT is defined.  It
also needs to set -extprefix to the normal prefix, since otherwise it
would default to installing into /sysroot/prefix.  Is anyone involved in
qt maintenance more experienced with this and able to comment?

Thanks.

David

 eclass/qt5-build.eclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass
index 70e9be80c98..7fe39e6a23b 100644
--- a/eclass/qt5-build.eclass
+++ b/eclass/qt5-build.eclass
@@ -479,7 +479,7 @@ qt5_symlink_tools_to_build_dir() {
 # Runs ./configure for modules belonging to qtbase.
 qt5_base_configure() {
 	# setup toolchain variables used by configure
-	tc-export AR CC CXX OBJDUMP RANLIB STRIP
+	tc-export AR CC CXX OBJDUMP PKG_CONFIG RANLIB STRIP
 	export LD="$(tc-getCXX)"
 
 	# bug 633838
@@ -487,6 +487,8 @@ qt5_base_configure() {
 
 	# configure arguments
 	local conf=(
+		${SYSROOT:+-extprefix "${QT5_PREFIX}" -sysroot "${SYSROOT}"}
+
 		# installation paths
 		-prefix "${QT5_PREFIX}"
 		-bindir "${QT5_BINDIR}"
@@ -677,6 +679,7 @@ qt5_qmake_args() {
 		QMAKE_LINK=\"$(tc-getCXX)\" \
 		QMAKE_LINK_SHLIB=\"$(tc-getCXX)\" \
 		QMAKE_OBJCOPY=\"$(tc-getOBJCOPY)\" \
+		QMAKE_PKG_CONFIG=\"$(tc-getPKG_CONFIG)\" \
 		QMAKE_RANLIB= \
 		QMAKE_STRIP=\"$(tc-getSTRIP)\" \
 		QMAKE_CFLAGS=\"${CFLAGS}\" \
@@ -716,6 +719,7 @@ qt5_qmake() {
 		QMAKE_LINK="$(tc-getCXX)" \
 		QMAKE_LINK_SHLIB="$(tc-getCXX)" \
 		QMAKE_OBJCOPY="$(tc-getOBJCOPY)" \
+		QMAKE_PKG_CONFIG="$(tc-getPKG_CONFIG)" \
 		QMAKE_RANLIB= \
 		QMAKE_STRIP="$(tc-getSTRIP)" \
 		QMAKE_CFLAGS="${CFLAGS}" \
-- 
2.21.1



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

* Re: [gentoo-dev] [PATCH] qt5-build.eclass: support sysroot builds
  2020-03-27 17:10 [gentoo-dev] [PATCH] qt5-build.eclass: support sysroot builds David Michael
@ 2020-03-27 20:49 ` James Le Cuirot
  2020-03-27 22:59   ` David Michael
  0 siblings, 1 reply; 3+ messages in thread
From: James Le Cuirot @ 2020-03-27 20:49 UTC (permalink / raw
  To: gentoo-dev

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

On Fri, 27 Mar 2020 13:10:34 -0400
David Michael <fedora.dm0@gmail.com> wrote:

> I'd like to be able to install qt5 packages in a sysroot for staging,
> and this is an initial patch for it.  The pkg-config variables might not
> be required, but it seemed appropriate to pass the sysroot-configured
> versions through the build.  There are a few caveats:
> 
>   - The upstream configure scripts do some bad things like this:
>     https://code.qt.io/cgit/qt/qtbase.git/tree/configure.pri#n363
>     That makes the build fail for systems using lib64 (e.g. amd64).  I'm
>     able to work around this by defining PKG_CONFIG_LIBDIR for dev-qt/*.

Indeed, that sucks. We should probably patch that out. I don't know
what it means where it says "or use -pkg-config to override this test",
do you? I suspect you could define PKG_CONFIG_LIBDIR=/ or anywhere that
simply exists and it will still work because our wrapper redefines that
variable anyway.

>   - This isn't for real cross-compiling.  There are places where it
>     tries to execute cross-compiled programs that I haven't investigated
>     yet, so this is only for building a sysroot for an architecture
>     compatible with the build system for now.

Understood. I did try to do cross-compiling with Qt4 once upon a time
and I did make a little headway but it wasn't fun.

>   - The qt packages depend on each other being installed in / as well as
>     the sysroot, so their ebuilds will need BDEPENDs added.

I imagine you'd at least need qtcore for qmake and moc. Probably not
the rest though?

>   - I've only gotten to testing a few packages that are dependencies of
>     other applications (like VLC), so I may be missing breakages.
> 
> The patch basically just sets -sysroot when $SYSROOT is defined.  It
> also needs to set -extprefix to the normal prefix, since otherwise it
> would default to installing into /sysroot/prefix.  Is anyone involved in
> qt maintenance more experienced with this and able to comment?

I'm not the Qt guy but I am the cross guy. I'm not in a position to
test this right now but it looks good and I love the simplicity of it.
It's a hell of a lot simpler than Qt4 was. To be honest, we should be
setting QMAKE_PKG_CONFIG regardless.

-- 
James Le Cuirot (chewi)
Gentoo Linux Developer

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [gentoo-dev] [PATCH] qt5-build.eclass: support sysroot builds
  2020-03-27 20:49 ` James Le Cuirot
@ 2020-03-27 22:59   ` David Michael
  0 siblings, 0 replies; 3+ messages in thread
From: David Michael @ 2020-03-27 22:59 UTC (permalink / raw
  To: gentoo-dev

On Fri, Mar 27, 2020 at 4:49 PM James Le Cuirot <chewi@gentoo.org> wrote:
> On Fri, 27 Mar 2020 13:10:34 -0400
> David Michael <fedora.dm0@gmail.com> wrote:
>
> > I'd like to be able to install qt5 packages in a sysroot for staging,
> > and this is an initial patch for it.  The pkg-config variables might not
> > be required, but it seemed appropriate to pass the sysroot-configured
> > versions through the build.  There are a few caveats:
> >
> >   - The upstream configure scripts do some bad things like this:
> >     https://code.qt.io/cgit/qt/qtbase.git/tree/configure.pri#n363
> >     That makes the build fail for systems using lib64 (e.g. amd64).  I'm
> >     able to work around this by defining PKG_CONFIG_LIBDIR for dev-qt/*.
>
> Indeed, that sucks. We should probably patch that out. I don't know
> what it means where it says "or use -pkg-config to override this test",
> do you?

I'm not sure, since -pkg-config is already being used by the eclass.
Maybe it was supposed to reference the -force-pkg-config option, which
I haven't tried.

> I suspect you could define PKG_CONFIG_LIBDIR=/ or anywhere that
> simply exists and it will still work because our wrapper redefines that
> variable anyway.
>
> >   - This isn't for real cross-compiling.  There are places where it
> >     tries to execute cross-compiled programs that I haven't investigated
> >     yet, so this is only for building a sysroot for an architecture
> >     compatible with the build system for now.
>
> Understood. I did try to do cross-compiling with Qt4 once upon a time
> and I did make a little headway but it wasn't fun.
>
> >   - The qt packages depend on each other being installed in / as well as
> >     the sysroot, so their ebuilds will need BDEPENDs added.
>
> I imagine you'd at least need qtcore for qmake and moc. Probably not
> the rest though?

I needed qtcore, qtgui, and qtwidgets in /, but it's possible there
are just bad configure scripts that I didn't dig into yet.  As for VLC
deps:
  - qtcore works as is
  - qtgui requires qtcore for bootstrap-private in /
  - qtwidgets requires qtgui in / for some opengl check
  - qtsvg and qtx11extras need qmake to build, but their packages will
be empty unless qtwidgets is installed in /

> >   - I've only gotten to testing a few packages that are dependencies of
> >     other applications (like VLC), so I may be missing breakages.
> >
> > The patch basically just sets -sysroot when $SYSROOT is defined.  It
> > also needs to set -extprefix to the normal prefix, since otherwise it
> > would default to installing into /sysroot/prefix.  Is anyone involved in
> > qt maintenance more experienced with this and able to comment?
>
> I'm not the Qt guy but I am the cross guy. I'm not in a position to
> test this right now but it looks good and I love the simplicity of it.
> It's a hell of a lot simpler than Qt4 was. To be honest, we should be
> setting QMAKE_PKG_CONFIG regardless.


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

end of thread, other threads:[~2020-03-27 23:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-27 17:10 [gentoo-dev] [PATCH] qt5-build.eclass: support sysroot builds David Michael
2020-03-27 20:49 ` James Le Cuirot
2020-03-27 22:59   ` David Michael

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