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 792948 - Various meson related improvements
Various meson related improvements
Status: RESOLVED FIXED
Product: libgnome-volume-control
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: libgnome-volume-control-maint
libgnome-volume-control-maint
Depends on:
Blocks:
 
 
Reported: 2018-01-27 09:00 UTC by Iñigo Martínez
Modified: 2018-01-30 12:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Use meson's options for library type (1.51 KB, patch)
2018-01-27 09:03 UTC, Iñigo Martínez
accepted-commit_now Details | Review
build: Rename build options (2.65 KB, patch)
2018-01-27 09:04 UTC, Iñigo Martínez
none Details | Review
build: Remove dependencies' variables (1.42 KB, patch)
2018-01-27 09:05 UTC, Iñigo Martínez
committed Details | Review
build: Do not use headers on library building (2.22 KB, patch)
2018-01-27 09:05 UTC, Iñigo Martínez
none Details | Review
build: Use meson's library function (2.12 KB, patch)
2018-01-27 09:06 UTC, Iñigo Martínez
accepted-commit_now Details | Review
build: Make use of assert function (2.25 KB, patch)
2018-01-27 09:07 UTC, Iñigo Martínez
none Details | Review
Remove the include directory variable (1.52 KB, patch)
2018-01-27 09:08 UTC, Iñigo Martínez
none Details | Review
build: Remove config.h template file (1.26 KB, patch)
2018-01-27 09:09 UTC, Iñigo Martínez
committed Details | Review
build: Rename build options (2.88 KB, patch)
2018-01-29 18:33 UTC, Iñigo Martínez
committed Details | Review
build: Do not use headers on library building (2.22 KB, patch)
2018-01-29 18:34 UTC, Iñigo Martínez
committed Details | Review
build: Make use of assert function (2.15 KB, patch)
2018-01-29 18:35 UTC, Iñigo Martínez
committed Details | Review
build: Remove the include directory variable (1.78 KB, patch)
2018-01-29 18:36 UTC, Iñigo Martínez
committed Details | Review

Description Iñigo Martínez 2018-01-27 09:00:24 UTC
This bug includes various meson improvements.
Comment 1 Iñigo Martínez 2018-01-27 09:03:26 UTC
Created attachment 367503 [details] [review]
build: Use meson's options for library type

meson's `default_library` can be used to know the type of library to be created, so there is no need to have another option for it.
Comment 2 Iñigo Martínez 2018-01-27 09:04:17 UTC
Created attachment 367504 [details] [review]
build: Rename build options

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

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

It also changes the introspection meson variable to be consistent with the one used for alsa.
Comment 3 Iñigo Martínez 2018-01-27 09:05:02 UTC
Created attachment 367505 [details] [review]
build: Remove dependencies' variables

A set of different variables are used to hold dependencies. However, no individual use of them is done.

This patch removes these variables and holds their objects directly in the array of dependencies.
Comment 4 Iñigo Martínez 2018-01-27 09:05:51 UTC
Created attachment 367506 [details] [review]
build: Do not use headers on library building

Headers are not necessary to be passed to the library compilation function because the compiler will found them. In the other hand they are necessary for the proper GIR generation.

This patch splits headers and sources, uses only sources for the library building and uses both for GIR generation. It also allows getting both separately.
Comment 5 Iñigo Martínez 2018-01-27 09:06:34 UTC
Created attachment 367507 [details] [review]
build: Use meson's library function

meson features a `library` function which based on the `default_library`, already used, builds a shared or a static library.

This patch takes advantage of this function, there is no need to conditionally split the library creation.
Comment 6 Iñigo Martínez 2018-01-27 09:07:30 UTC
Created attachment 367508 [details] [review]
build: Make use of assert function

meson has support for `assert` function, which halts meson's execution showing a given message when a given condition is false.

This patch takes advantage of this function to slightly improve meson's build file readibility.

It also removes a duplicated check for `pkglibdir` being set when introspection is also set, because this check is already done when a shared library is being created, that is a precondition for introspection generation.
Comment 7 Iñigo Martínez 2018-01-27 09:08:14 UTC
Created attachment 367509 [details] [review]
Remove the include directory variable

The variable which holds the current directory is not necessary because this is already included when building the library.

However, it might be interessant for any package using the library to include the directory where headers are present, so the current directory is appended to the library dependency without the include directory variable.
Comment 8 Iñigo Martínez 2018-01-27 09:09:05 UTC
Created attachment 367510 [details] [review]
build: Remove config.h template file

The `config.h` can be generated without any template.

This patch removes the template file and modifies the build file to not make any use of it.

It also removes the variable which holds the generated configuration file target, as it will not be necessary for any packages building libgnome-volume-control.
Comment 9 Iñigo Martínez 2018-01-27 09:11:32 UTC
For ease the testing of all the patches, I have created a wip branch: https://git.gnome.org/browse/libgnome-volume-control/log/?h=wip/inigomartinez/meson

There is also a weird behaviour with meson's options to choose between `shared` and `static` library. Please take a look at: https://github.com/mesonbuild/meson/issues/2910
Comment 10 Bastien Nocera 2018-01-29 12:53:53 UTC
Review of attachment 367503 [details] [review]:

Sure, will need a gnome-shell patch to go with it.
Comment 11 Bastien Nocera 2018-01-29 12:54:52 UTC
Review of attachment 367504 [details] [review]:

Sure, will also need a gnome-shell change.
Comment 12 Bastien Nocera 2018-01-29 12:55:52 UTC
Review of attachment 367505 [details] [review]:

Sure
Comment 13 Bastien Nocera 2018-01-29 12:58:13 UTC
Review of attachment 367506 [details] [review]:

> function because the compiler will found them. In the other hand

"find" and "On the other hand".

Looks good otherwise.
Comment 14 Bastien Nocera 2018-01-29 13:06:29 UTC
Review of attachment 367507 [details] [review]:

Looks good
Comment 15 Bastien Nocera 2018-01-29 13:08:00 UTC
Review of attachment 367508 [details] [review]:

Looks good
Comment 16 Bastien Nocera 2018-01-29 13:08:41 UTC
Review of attachment 367509 [details] [review]:

Looks fine
Comment 17 Bastien Nocera 2018-01-29 13:09:00 UTC
Review of attachment 367510 [details] [review]:

Sure.
Comment 18 Iñigo Martínez 2018-01-29 18:32:08 UTC
(In reply to Iñigo Martínez from comment #1)
> Created attachment 367503 [details] [review] [review]
> build: Use meson's options for library type
> 
> meson's `default_library` can be used to know the type of library to be
> created, so there is no need to have another option for it.

I have made a terrible mistake with this one. Only user options can be set when using any project as subproject[0], so this patch actually doesn't work. Seems that I'm not the only one with the same confusion[1] :(.

2 patches are not necessary anymore, 4 have been updated and 2 still remain the same.

[0] http://mesonbuild.com/Reference-manual.html#subproject
[1] https://github.com/mesonbuild/meson/issues/2612
Comment 19 Iñigo Martínez 2018-01-29 18:33:46 UTC
Created attachment 367589 [details] [review]
build: Rename build options

Updated patch.
Comment 20 Iñigo Martínez 2018-01-29 18:34:48 UTC
Created attachment 367590 [details] [review]
build: Do not use headers on library building

Updated patch.
Comment 21 Iñigo Martínez 2018-01-29 18:35:40 UTC
Created attachment 367591 [details] [review]
build: Make use of assert function

Updated patch.
Comment 22 Iñigo Martínez 2018-01-29 18:36:19 UTC
Created attachment 367592 [details] [review]
build: Remove the include directory variable

Updated patch.
Comment 23 Bastien Nocera 2018-01-30 09:19:27 UTC
Review of attachment 367589 [details] [review]:

Sure, will need gnome-shell changes.
Comment 24 Bastien Nocera 2018-01-30 09:20:15 UTC
Review of attachment 367590 [details] [review]:

Sure.
Comment 25 Bastien Nocera 2018-01-30 09:20:32 UTC
Review of attachment 367591 [details] [review]:

Fine.
Comment 26 Bastien Nocera 2018-01-30 09:20:52 UTC
Review of attachment 367592 [details] [review]:

Yep.
Comment 27 Iñigo Martínez 2018-01-30 12:22:43 UTC
attachment 367510 [details] [review] pushed as 6a0ac9b - build: Remove config.h template file
attachment 367592 [details] [review] pushed as ef5d07f - build: Remove the include directory variable
attachment 367591 [details] [review] pushed as 69eac7d - build: Make use of assert function
attachment 367590 [details] [review] pushed as f764bb6 - build: Do not use headers on library building
attachment 367505 [details] [review] pushed as 68b7fcc - build: Remove dependencies' variables
attachment 367589 [details] [review] pushed as b4854a8 - build: Rename build options
Comment 28 Iñigo Martínez 2018-01-30 12:55:07 UTC
(In reply to Bastien Nocera from comment #23)
> Review of attachment 367589 [details] [review] [review]:
> 
> Sure, will need gnome-shell changes.

Just pushed a merge request: https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/13

I will follow its merging there so I'll close this one.

Thank you!