Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson: default the backends list to 'auto' #104

Merged
merged 2 commits into from
Dec 9, 2022

Conversation

whot
Copy link
Contributor

@whot whot commented Jul 1, 2022

This changes the 'backends' option to the special string 'auto' - all
backends become optional by default and are built if the dependencies
are available.

If need be this can be combined with explicitly listing a backend, so
backends=auto,gtk3 will require the GTK3 backend and optionally build
the Qt5 and GTK4 backends. A summary is printed to list the actually
enabled backends and a warning where no backends are enabled at all.

This makes life easier for new users since the majority of them will not
have GTK3, GTK4 and Qt5 headers installed by default and thus are almost
guaranteed to run into a meson error on first configure.

Fixes #94

@whot
Copy link
Contributor Author

whot commented Jul 1, 2022

cc @eli-schwartz for the inevitable meson magic that already exists for this and that I'm not aware of ;)

Copy link

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dunno about "magic", but...

libportal/meson.build Outdated Show resolved Hide resolved
libportal/meson.build Outdated Show resolved Hide resolved
@whot whot force-pushed the wip/auto-backends branch 2 times, most recently from 508c85b to 3289fee Compare July 1, 2022 08:23
@whot
Copy link
Contributor Author

whot commented Jul 14, 2022

gentle ping

@whot
Copy link
Contributor Author

whot commented Jul 29, 2022

gentle ping again

@whot
Copy link
Contributor Author

whot commented Aug 30, 2022

monthly ping again

@whot
Copy link
Contributor Author

whot commented Sep 6, 2022

@GeorgesStavracas - any chance we can merge this? Not having to manually supply the backends to build libportal from git is a rather nice feature.

@whot
Copy link
Contributor Author

whot commented Nov 28, 2022

ping again?

@GeorgesStavracas
Copy link
Member

@eli-schwartz I'd actually like to hear your thoughts on the "auto" magic that's happening here. I'm not convinced this is a great idea. Or, at least, I'd love to hear what a Mesonic way to implement this would look like.

@GeorgesStavracas
Copy link
Member

@whot sorry, completely dropped the ball here

@whot
Copy link
Contributor Author

whot commented Nov 28, 2022

My guess would be that the mesonic way would be to have each backend as separate feature option (instead of a "backends" array with a special string). That'd be easy enough to introduce but changes the build invocations.

@eli-schwartz
Copy link

Yeah, adding a separate option for each one would be the most obvious way to handle it.

If you want to keep the existing option, I guess you could make each option default to auto, and then use something like:

backends = get_option('backends')
x_opt = 'x' in backends ? true : get_option('x')
y_opt = 'y' in backends ? true : get_option('y')

The option will then usually be a feature option, but will be a boolean true (equal to enabled when used inside required: kwargs) if the existing option specifies to build that backend. Check for the dependencies using required: x_opt, and they will use:

  • auto /check by default
  • the feature value specifically passed for that option
  • true / enabled if listed in backends

Whichever one matches last.

This removes the 'backends' option and replaces it with individual
options for each backend, e.g. -Dbackend-gtk3=enabled.
All backends become optional by default and are built if the
dependencies are available.

A summary is printed to list the actually enabled backends.

This makes life easier for new users since the majority of them will not
have GTK3, GTK4 and Qt5 headers installed by default and thus are almost
guaranteed to run into a meson error on first configure.

Fixes flatpak#94
@whot
Copy link
Contributor Author

whot commented Dec 8, 2022

Changed this PR to use -Dbackend-gtk3=enabled and so on. I tried keeping backends as list for backwards compatibility but tbh the conditions got confusing enough (in particular: -Dbackends=gtk3 must also set the others to disabled) that I didn't really see the value in keeping it, so it's removed now.

@GeorgesStavracas GeorgesStavracas merged commit 333a299 into flatpak:main Dec 9, 2022
gnomesysadmins pushed a commit to GNOME/nautilus that referenced this pull request Dec 10, 2022
gnomesysadmins pushed a commit to GNOME/nautilus that referenced this pull request Dec 10, 2022
gnomesysadmins pushed a commit to GNOME/nautilus that referenced this pull request Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Omit qt / qt5 while compiling?
3 participants