After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795277 - [PATCH] build: port to meson
[PATCH] build: port to meson
Status: RESOLVED OBSOLETE
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2018-04-15 15:13 UTC by Rasmus Thomsen
Modified: 2020-11-13 10:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] build: port to meson (11.70 KB, patch)
2018-04-15 15:13 UTC, Rasmus Thomsen
none Details | Review
[PATCH] build: port to meson (32.31 KB, patch)
2018-04-26 18:08 UTC, Rasmus Thomsen
none Details | Review

Description Rasmus Thomsen 2018-04-15 15:13:25 UTC
Created attachment 370963 [details] [review]
[PATCH] build: port to meson

Hello,

I've ported (most) of gparted's current autotools based build system to meson. I've tested it locally and it works fine for me, however, there's still some stuff to do:

* Clean it up a bit.
* Add support for tests.
* Add support for building docs with gnome-doc-utils (& yelp), if that's still desired.
* Maybe drop intltool, meson doesn't exactly support it.
* Do we still need to compile gtest & ucompose? If so, add support for compiling that.

I tested it on my linux desktop (running exherbo), so it'd be very welcome if someone could test it on a more "mainstream-ish" distro like Fedora/Ubuntu. Currently this needs at least meson 0.46 (unreleased as of now) for the `rename` keyword in `install_data` though.
Comment 1 Curtis Gedak 2018-04-15 15:35:44 UTC
Thank you Rasmus for your interest in GParted.

Why would we want to port the GParted process to meson?
Comment 2 Rasmus Thomsen 2018-04-15 17:35:40 UTC
1) Meson is way faster than autotools (as in it doesn't take as much time to configure the build + ninja is faster than make, see below)

Build times with autotools (docs disabled since meson doesn't build them yet):
( ./configure --disable-doc && make -j16 -l15; )  212.62s user 16.17s system 957% cpu 23.891 total

Build times with meson: 
( meson build && ninja -v -C build; )  164.55s user 13.18s system 1222% cpu 14.538 total

I used an Ryzen 1700 for tests.

2) The polkit detection with gparted's configure is broken for me and running `autoreconf` needs gnome-doc-utils (which is pretty old and not really *that* maintained)

3) This is most likely personal preference, but I feel like meson is easier to maintain than autotools (as in it's less effort to change something in the build system). Also, the build system consists of fewer files (only meson.build's and meson_options.txt) instead of Makefile.am etc. This makes it easier for casual contributors to contribute to gparted

To quote Dylan Baker (from https://lwn.net/Articles/718351/), what advantages meson has:

"
First it's written in python, which means the potential developer base
is massive. And it provides a recursive view for humans, but a
non-recursive view for the system. This is the best of both worlds,
humans can organize the build system in a way that makes sense, and the
machine gets a non-recursive build system. It also uses ninja rather
than make, and ninja is faster than make inherently. Meson is also a
simpler syntax than autotools or cmake it's not Turing Complete by
design nor does it expose python, again, by design. This allows meson
itself to be reimplemented in a another language if python becomes a
dead-end or a bottle-neck. It also makes it much easier to understand
what the build system is doing.

What's different about using meson?

Well, apart from a faster builds and less magic in the build system? The
configure flags are different, it uses -D<opt>=<value> more like cmake
than the --enable or --with flags of autotools, although oddly it uses
--prefix and friends when calling meson, but not with mesonconf, there's
a bug opened on this. Meson also doesn't support in-tree builds at all;
all builds are done out of tree. It also doesn't provide a "make dist"
target, fortunately there's this awesome tool called git, and it
provides a "git archive" command that does much the same thing. Did I
mention it's fast?
"
Comment 3 Mike Fleetwood 2018-04-15 19:07:09 UTC
All the core GNOME 3 components and applications are being ported to use
Meson build system.
https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
Comment 4 Curtis Gedak 2018-04-16 16:26:19 UTC
Faster compile times would be nice.

With GParted we try to ensure that it compiles and works with currently supported versions of several major GNU/Linux distributions [1].

[1] https://gparted.org/development.php

Will Meson work with older currently supported versions of distros, such as CentOS 6?
Comment 5 Rasmus Thomsen 2018-04-16 18:27:17 UTC
(In reply to Curtis Gedak from comment #4)

> Will Meson work with older currently supported versions of distros, such as
> CentOS 6?

Well, for one, there's no need to immediately drop the autotools build system once/if meson supports gets merged.

Also, meson works on (pretty much) every system that supports python3 (other than solaris, I think), however, I admittedly can't seem to find an official package for meson for centos 6 (only for centos 7), but a `pip install meson` would take care of that as well. I don't know centos too well though, so maybe it's just me being unable to find it.
Comment 6 Curtis Gedak 2018-04-18 15:55:18 UTC
Thanks Rasmus for checking on Meson packages.

Due to the lack of distro supported packages for the GNU/Linux distributions currently supported by GParted, I think it best to stick with Autotools as the primary build system for GParted for now.

We could consider Meson for a secondary build system.  To be complete it would have to recreate all of the functionality of Autotools which includes such things as the help documentation, language translations, and code testing.

Note that GParted uses gtkmm2, and as such requires the older gnome_doc_utils.

    Bug #704634 - Switch from gnome-doc-utils to yelp-tools
    https://bugzilla.gnome.org/show_bug.cgi?id=704634

Because adding a second build system is not a priority for me, work to develop and maintain it would fall to others such as yourself.

Regards,
Curtis
Comment 7 Rasmus Thomsen 2018-04-18 17:22:39 UTC
(In reply to Curtis Gedak from comment #6)
> Thanks Rasmus for checking on Meson packages.
> 
> Due to the lack of distro supported packages for the GNU/Linux distributions
> currently supported by GParted, I think it best to stick with Autotools as
> the primary build system for GParted for now.
> 
> We could consider Meson for a secondary build system.  To be complete it
> would have to recreate all of the functionality of Autotools which includes
> such things as the help documentation, language translations, and code
> testing.

Yep, sounds good to me :)

Language translations already work with meson, I'll look into tests. 

> Note that GParted uses gtkmm2, and as such requires the older
> gnome_doc_utils.
> 
>     Bug #704634 - Switch from gnome-doc-utils to yelp-tools
>     https://bugzilla.gnome.org/show_bug.cgi?id=704634

Meson doesn't officially support gnome-doc-utils, so it doesn't have so handy helper function for it, but I guess I can craft something custom for that.

> Because adding a second build system is not a priority for me, work to
> develop and maintain it would fall to others such as yourself.
> 
> Regards,
> Curtis

Sure, maintaining and improving the meson build system isn't too hard, so I'd be willed to help :)
Comment 8 Rasmus Thomsen 2018-04-26 18:08:30 UTC
Created attachment 371443 [details] [review]
[PATCH] build: port to meson

I've just added support for tests and gnome-doc-utils to the meson build system. As far as I can tell everything works now. Some thing to note:
- Right now I always define the following values in config.h to 1:
    HAVE_NLS,HAVE_INTTYPES_H,HAVE_LIBPARTED,HAVE_LIBUUID and HAVE_STRING_H
    I'm not quite sure which of these have to be optionalised.

- Meson 0.46 has been released, so most distros should have it soon-ish in their repos

- Some linguas don't have "gparted_window.png" in help/${lingua}/figures/, but with the autotools based system it's still installed. I'm not quite sure where it takes those files from, so I currently don't install them for those linguas.

- The meson files still need a bit of commenting&polishing, but do work for me, feel free to test them :)
Comment 9 André Klapper 2020-11-13 10:41:23 UTC
bugzilla.gnome.org is being replaced by gitlab.gnome.org. We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time.

If you still use gparted and if you still see this bug / want this feature in a recent and currently supported version, then please feel free to report it at
https://gitlab.gnome.org/GNOME/gparted/-/issues/
by following the guidelines at
https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines

Thank you for creating this report and we are sorry it could not be implemented so far (volunteer workforce and time is limited).