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 790178 - Various meson related improvements
Various meson related improvements
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: nm-applet
unspecified
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-11-10 16:19 UTC by Iñigo Martínez
Modified: 2017-12-18 09:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Fix index used for PACKAGE_STRING (1011 bytes, patch)
2017-11-10 16:20 UTC, Iñigo Martínez
none Details | Review
build: Remove default warning level (897 bytes, patch)
2017-11-10 16:24 UTC, Iñigo Martínez
none Details | Review
build: Rename build options (8.78 KB, patch)
2017-11-10 16:33 UTC, Iñigo Martínez
none Details | Review
Use meson 0.43.0 features (1.17 KB, patch)
2017-11-10 16:42 UTC, Iñigo Martínez
none Details | Review
build: Use a variable for the name (3.30 KB, patch)
2017-11-11 16:33 UTC, Iñigo Martínez
none Details | Review
build: Remove unused defines (6.68 KB, patch)
2017-11-11 19:03 UTC, Iñigo Martínez
none Details | Review
build: Remove default options (994 bytes, patch)
2017-11-11 19:12 UTC, Iñigo Martínez
none Details | Review
build: Improve AppStream metainfo handling (1.14 KB, patch)
2017-11-11 19:22 UTC, Iñigo Martínez
none Details | Review
build: Remove unused defines (6.68 KB, patch)
2017-11-11 19:25 UTC, Iñigo Martínez
none Details | Review

Description Iñigo Martínez 2017-11-10 16:19:12 UTC
This bug includes various meson improvements.
Comment 1 Iñigo Martínez 2017-11-10 16:20:56 UTC
Created attachment 363360 [details] [review]
build: Fix index used for PACKAGE_STRING

In the PACKAGE_STRING variable generation wrong index is used.

This patch uses string concatenation to fix the problem.
Comment 2 Iñigo Martínez 2017-11-10 16:24:06 UTC
Created attachment 363361 [details] [review]
build: Remove default warning level

`network-manager-applet` 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-10 16:33:08 UTC
Created attachment 363362 [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.
- Remove the `with` prefix from string options.
- The character separator from multi-word options has been changed
  to underscore (`_`).

[0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
Comment 4 Iñigo Martínez 2017-11-10 16:42:26 UTC
Created attachment 363364 [details] [review]
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 5 Iñigo Martínez 2017-11-11 16:33:41 UTC
Created attachment 363395 [details] [review]
build: Use a variable for the name

A previous commit[0] fixed a mistake done by me regarding the names.

This patch tries to improve that fix a little bit by introducing a new variable which holds the name (may I say short name?) used by network-manager-applet, which is `nm-applet`.

Those would help in case some `nma` fields are renamed (let's say that PACKAGE define is moved from `nm-applet` to `network-manager-applet`) and also helps in consistency, since the same string is used where it is needed, avoiding any error caused by handwriting.

The name variable is also used as the `gettext` domain, as both use the same string. If desired, a new variable can also be created to separate both concepts. I haven't done it because it's used two times, which in my eyes didn't seem to be reason enough.

[0] https://git.gnome.org/browse/network-manager-applet/commit/?id=b1a7c2b93
Comment 6 Iñigo Martínez 2017-11-11 19:03:50 UTC
Created attachment 363401 [details] [review]
build: Remove unused defines

There are a lot of defines in the `config.h` file mimicking those generated by autotools. However, most of them are not actually needed. `PACKAGE` defines, std headers defines, functions defines.

I am used to not removed them because I'm not sure if they are necessary in non-linux systems (bsd?), or even on older linux systems. They are at least not necessary on my system.

This patch removes the correspondant checks and their settings in the configuration object.

The `HAVE_CONFIG_H` macro definition, which is also used by autotools, is also no necessary, so it has been removed.

Regarding `PACKAGE*` defines, they are actually needed in the documentation generation by the `gtkdocentities.ent` file. They have been removed from the `config_h` configuration object and the template file used and a new configuration object has been created which will only be used when documentation generation is requested.
Comment 7 Iñigo Martínez 2017-11-11 19:12:07 UTC
Created attachment 363402 [details] [review]
build: Remove default options

I've also noticed that setting `b_lundef` in the project's default options is unnecessary.

This option was used by autotools so I ended setting it up in the default options to enforce its use. However it's already in meson's default options, so setting the option again may lead to confusion.

This patch obsolotes the previous one, 363361, which only removed `warning_level` option.
Comment 8 Iñigo Martínez 2017-11-11 19:22:59 UTC
Created attachment 363403 [details] [review]
build: Improve AppStream metainfo handling

I'm sorry for this mistake, I was confused and it also happened to me with other meson ports[0]. Thanks for fixing it in the commit c5786deb4.

This patch improves it a little bit, avoiding to use the same string twice, so if the file name is changed it's less error prone.

I've also updated the AppStream metainfo directory, which must be now `metainfo`.

[0] https://bugzilla.gnome.org/show_bug.cgi?id=784922#c9
Comment 9 Iñigo Martínez 2017-11-11 19:25:08 UTC
Created attachment 363404 [details] [review]
build: Remove unused defines

I've fixed a little bit the commit subject which was not the best.
Comment 10 Thomas Haller 2017-11-13 09:33:21 UTC
`git bz apply` is unable to apply the patches without conflict. Can you instead make a github pull-request, link to a git-branch somewhere, or attach a complete set of patches which applies without conflicts? Thanks
Comment 11 Iñigo Martínez 2017-11-13 10:00:56 UTC
(In reply to Thomas Haller from comment #10)
> `git bz apply` is unable to apply the patches without conflict.

I'm sorry about this. I had been uploading the patches while I was making changes, trying to separate them by concepts instead of uploading a `big` patch with multiple unrelated changes.

In case you consider it more convenient, I can also squash the patches.

> Can you instead make a github pull-request, link to a git-branch somewhere, or
> attach a complete set of patches which applies without conflicts? Thanks

Sure! You can find the changes in the following wip branch: https://git.gnome.org/browse/network-manager-applet/log/?h=wip/inigomartinez/meson-improvements
Comment 12 Thomas Haller 2017-11-13 11:58:10 UTC
Thanks. wip/inigomartinez/meson-improvements lgtm
Comment 13 Beniamino Galvani 2017-11-13 13:39:29 UTC
Looks good.
Comment 15 Thomas Haller 2017-11-13 18:19:36 UTC
Thanks Iñigo!!
Comment 16 Lubomir Rintel 2017-12-18 08:38:01 UTC
> I've also updated the AppStream metainfo directory, which must be now `metainfo`.

Note that I've reverted this again. Not because that it would be an inherently bad change, but it regresses from what's done by autotools.

Of course, the autotools could be changed too. However, it's not clear (from the commit message), whether this is going to break on older platforms.

On my system (Fedora 27), most packages seems to use the /usr/share/appdata, not /usr/share/metainfo
Comment 17 Iñigo Martínez 2017-12-18 09:03:18 UTC
(In reply to Lubomir Rintel from comment #16)
> > I've also updated the AppStream metainfo directory, which must be now `metainfo`.
> 
> Note that I've reverted this again. Not because that it would be an
> inherently bad change, but it regresses from what's done by autotools.
> 
> Of course, the autotools could be changed too. However, it's not clear (from
> the commit message), whether this is going to break on older platforms.
> 
> On my system (Fedora 27), most packages seems to use the /usr/share/appdata,
> not /usr/share/metainfo

I'm not sure what is the situation regarding `/usr/share/appdata`. I guess that in order to avoid breaking current applications, there is backward compatibility, but the current spec recommends `/usr/share/metainfo` for Desktop applications[0].

I wasn't aware of the new spec recommendation until some months ago[1], and following that comment I also made some mistakes[2].

I didn't care about autotools, because my idea was to provide a patch to remove it at some point. However, while autotools is supported, probably `appdata` should be renamed to `metainfo`.

[0] https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Application.html
[1] https://bugzilla.gnome.org/show_bug.cgi?id=783205#c10
[2] https://bugzilla.gnome.org/show_bug.cgi?id=784922#c8