meson cleanups and fixes #240

Merged
ariadne merged 10 commits from dcbaker/pkgconf:submit/meson-cleanups into master 2022-08-02 23:09:25 +00:00

Migrated from github.

Initially I started on this because I'm using this in a subproject that set's it's C version to c99, and libpkgconf is full of warnings because of undefined functions. I realized that meson isn't setting a c_std unlike autotools. So i fixed that, added some warnings, updated the CI to be more picky, and then cleaned up the meson a bit (I am a meson dev, I might as well do something useful with all that knowledge :)

Migrated from [github](https://github.com/pkgconf/pkgconf/pull/256). Initially I started on this because I'm using this in a subproject that set's it's C version to c99, and libpkgconf is full of warnings because of undefined functions. I realized that meson isn't setting a c_std unlike autotools. So i fixed that, added some warnings, updated the CI to be more picky, and then cleaned up the meson a bit (I am a meson dev, I might as well do something useful with all that knowledge :)
dcbaker added 10 commits 2022-08-02 17:22:39 +00:00
71974d8c54 meson: Add _BSD_SOURCE and _DEFAULT_SOURCE
To avoid warnings about string functions like strdup which are otherwise
undefined, but succeed at linking anyway when the C standard is c99.
40ec08594e meson: add warning for implicit-function-declarations
This would be triggered without the previous addition of -D_BSD_SOURCE
for strdup, among others
4a2c9c285f meson: use C99 as the standard
autoconf uses either C99 or Gnu99. Meson does not provide a graceful way
to select gnu99 if possible or c99 (though there are several proposals
currently happening to get there), so I've selected c99 as the
conservative default. Without this, the compiler uses whatever it's
default happens to be, which may or may not work out correctly, and
hides bugs from CI that are present with c99 as the default.
bf307c1d95 ci: set meson to build with -Werror
This will help catch any new warnings added in CI.
5ba74dec93 meson: use straight indexing instead of array.get()
It's more terse, and we don't need the support of a fallback value.
1f993bc095 meson: use string methods to avoid repeating data
Instead of writing `['HAVE_FOO_H', 'foo.h']`, use meson's string methods
to just write `['foo.h']`, and let meson create `HAVE_FOO_H` for us.
06fe2e23b0 meson: use current_source_dir and current_build_dir instead of *_root
The latter doesn't work correctly when being used as a subproject, as it
returns the *absolute* root. So if pkgconf is being built as part of
muon, then it will return muon's source root. current_source_dir, on the
other hand returns the directory correctly whether being built as a
subproject or superproject.
c04097e491 meson: pass configured files idiomatically
Instead of attempting to figure out what the paths will be, take the
returned file object and pass that around, meson will then automatically
figure out the correct paths.
ci/woodpecker/pr/woodpecker Pipeline was successful Details
dd779ad9f8
meson: add check to run_command
Because we really should be checking that it succeeds, and because not
setting it is deprecated.
ariadne merged commit a042827951 into master 2022-08-02 23:09:25 +00:00
ariadne deleted branch submit/meson-cleanups 2022-08-02 23:09:30 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#240
There is no content yet.