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 790303 - Various meson related improvements
Various meson related improvements
Status: RESOLVED FIXED
Product: gnome-disk-utility
Classification: Core
Component: general
3.25.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-disk-utility-maint
gnome-disk-utility-maint
Depends on:
Blocks:
 
 
Reported: 2017-11-13 17:53 UTC by Iñigo Martínez
Modified: 2017-11-15 11:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Rename build options (2.00 KB, patch)
2017-11-13 18:32 UTC, Iñigo Martínez
committed Details | Review
build: Remove default warning level (952 bytes, patch)
2017-11-13 18:33 UTC, Iñigo Martínez
committed Details | Review
build: Remove unused defines (3.04 KB, patch)
2017-11-13 18:34 UTC, Iñigo Martínez
committed Details | Review
build: Remove macro definition (1.16 KB, patch)
2017-11-13 18:34 UTC, Iñigo Martínez
committed Details | Review
build: Use meson 0.43.0 features (2.29 KB, patch)
2017-11-13 18:35 UTC, Iñigo Martínez
committed Details | Review
build: Use datadir on post install script (1.81 KB, patch)
2017-11-13 18:36 UTC, Iñigo Martínez
committed Details | Review
build: Move the icons files (4.72 KB, patch)
2017-11-13 18:37 UTC, Iñigo Martínez
committed Details | Review
build: Document custom build switches (2.02 KB, patch)
2017-11-14 13:31 UTC, Kai Lüke
committed Details | Review
build: Add a configure script (5.29 KB, patch)
2017-11-14 16:42 UTC, Iñigo Martínez
reviewed Details | Review

Description Iñigo Martínez 2017-11-13 17:53:17 UTC
This bug includes various meson improvements.
Comment 1 Iñigo Martínez 2017-11-13 18:32:54 UTC
Created attachment 363534 [details] [review]
build: Rename build options

Following the new meson porting guidelines[0], this patch renames the build options. The list of changes is as follows:

- Remove the enable prefix from boolean options.
- The character separator from multi-word options has been changed to underscore.

[0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
Comment 2 Iñigo Martínez 2017-11-13 18:33:30 UTC
Created attachment 363535 [details] [review]
build: Remove default warning level

gnome-disk-utility uses 1 as the project's default warning level. However, meson already uses this level as the default warning level.

This patch removes the warning level from project's default options.
Comment 3 Iñigo Martínez 2017-11-13 18:34:15 UTC
Created attachment 363536 [details] [review]
build: Remove unused defines

meson generates the config.h file with multiple defines to be used as guards, in the same way as autotools does. However, almost all of them are not used.

This patch removes the unused defines.
Comment 4 Iñigo Martínez 2017-11-13 18:34:53 UTC
Created attachment 363537 [details] [review]
build: Remove macro definition

meson uses the compiler's `HAVE_CONFIG_H` macro definiton, inherited from autotools behaviours. However it is not necessary.

This patch removes the use of the macro definition.
Comment 5 Iñigo Martínez 2017-11-13 18:35:35 UTC
Created attachment 363538 [details] [review]
build: Use meson 0.43.0 features

meson 0.43.0 comes with a new function in the compiler's object called get_supported_arguments, which allows checking multiple optiones at once.

This patch bumps meson's version number and also takes advantage of this new feature.
Comment 6 Iñigo Martínez 2017-11-13 18:36:17 UTC
Created attachment 363539 [details] [review]
build: Use datadir on post install script

The previous approach used a fixed path for datadir. However, its location might change.

This patch uses the provided datadir path, if the user provides one, or the default path.
Comment 7 Iñigo Martínez 2017-11-13 18:37:07 UTC
Created attachment 363540 [details] [review]
build: Move the icons files

The icons' files locations are not exactly in their final installation location.

This patch creates the proper directory tree needed on the installation process so they do not have to be copied one by one to the final destination.
Comment 8 Kai Lüke 2017-11-14 13:31:31 UTC
Created attachment 363584 [details] [review]
build: Document custom build switches

Hello,

thanks a lot for caring about the state of the meson config.
For me it works well in two different scenarios.

But I realized that it is hard for new meson users to find out how the options are to be set. Passing e.g. -D enable-foo=true instead of -D foo=true is just ignored without warning. The meson configure command is not documented in meson --help and so I made some writeup in the INSTALL file and printed how to use the switches after configuration.

What do you think about that?
Regards,
Kai
Comment 9 Iñigo Martínez 2017-11-14 16:42:39 UTC
Created attachment 363616 [details] [review]
build: Add a configure script

(In reply to Kai Lüke from comment #8)
> Created attachment 363584 [details] [review] [review]
> thanks a lot for caring about the state of the meson config.
> For me it works well in two different scenarios.

Thank you for taking time for testing it :)

> But I realized that it is hard for new meson users to find out how the
> options are to be set. Passing e.g. -D enable-foo=true instead of -D
> foo=true is just ignored without warning. The meson configure command is not
> documented in meson --help and so I made some writeup in the INSTALL file
> and printed how to use the switches after configuration.
> 
> What do you think about that?

Fair enough. You are totally right, despite the fact that it's enough for me, meson's documentation should improve. Although meson's developers are working hard including new features, the documentation remains one step behind. There has also been a discussion in desktop-devel-list about this issue[0].

I'm convinced that, once meson's use is extended, this issue will be adressed.

Your patch looks good to me. I'm also including a `configure` script, which `simulates` a configure script from autotools. It could be removed once meson's documentation improves.

This patch also is useful for gnome-continuous support[1].

[0] https://mail.gnome.org/archives/desktop-devel-list/2017-July/msg00000.html
[1] https://git.gnome.org/browse/gnome-continuous/tree/patches
Comment 10 Kai Lüke 2017-11-15 02:12:18 UTC
Review of attachment 363616 [details] [review]:

Is it really a good idea to support two ways of building? I guess it can cause confusion in a GNOME Builder project on which file to select when opening the source directory.

And also because the ./configure script does not exactly behave the same since it can't be run twice.

Maybe it's better to file it for gnome-continuous directly and leave it away?

::: configure
@@ +6,3 @@
+# Copyright 2017 Iñigo Martínez <inigomartinez@gmail.com>
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+

In general I would add as many safeguards as possible from here:
https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail

E.g. a "set -e" here captures missing write permissions for "mkdir -p" but this is not a big deal since meson will also fail later.
Comment 11 Iñigo Martínez 2017-11-15 09:02:23 UTC
(In reply to Kai Lüke from comment #10)
> Review of attachment 363616 [details] [review] [review]:
> Maybe it's better to file it for gnome-continuous directly and leave it away?

I agree that it may cause confussion. It would help to gnome-continuous, though it's going to support meson at some point[0].

> In general I would add as many safeguards as possible from here:
> https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail
> 
> E.g. a "set -e" here captures missing write permissions for "mkdir -p" but
> this is not a big deal since meson will also fail later.

The configure script is just a workaround, and I'm not a bash script expert either, so it probably has some pitfals. However the hints in the link are nice. I used before `-e` and `-x`, but I wasn't aware of the other two. Thanks!

[0] https://bugzilla.gnome.org/show_bug.cgi?id=789146#c3
Comment 12 Kai Lüke 2017-11-15 11:47:44 UTC
I just wasn't sure, did not want to turn down the last patch ;) We could ask if someone has experience if it's good to have such a wrapper script (And place a hint somewhere for usage with Builder).
But the script should probably make use of "meson configure" if the build directory is present already (but I don't know if this works when the meson version has changed).
If you want to work on it for end user experience we can reopen this bug.
Concerning continuous I need to figure out what the current state is for submitting the patch.

Thanks a lot and many greetings,
Kai