Commit Graph

159 Commits

Author SHA1 Message Date
X512 b1384b9c9f Haiku pkgconfig directory layout support 2023-01-20 14:57:33 -05:00
Paolo Bonzini 863f2a6d74 forbid using declare_dependency(objects: ...) with pkg-config module
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-01-04 09:44:32 -08:00
Dylan Baker 20d76b8353
pylint: enable unnecessary-comprehension 2022-10-03 00:14:43 -04:00
Dylan Baker a572734330 modules/pkgconfig: make it a NewExtensionModule
Since we no longer need Interpreter.extract_variables, we can remove the
interpreter from the module!
2022-08-18 21:57:36 -04:00
Dylan Baker 7c12066e73 modules/pkgconfig: mypy clean! 2022-08-18 21:57:36 -04:00
Dylan Baker 9bd3c1957d modules/pkgconfig: Fix code to handle CustomTarget and CustomTargetIndex 2022-08-18 21:57:36 -04:00
Dylan Baker 2fb0c0e4d8 modules/pkgconfig: remove type checking abstraction
Which confuses the heck out of mypy
2022-08-18 21:57:36 -04:00
Dylan Baker e15f15d904 modules/pkgconfig: get rid of modifications to the BuildTarget objects
This would tack on extra attributes for meta data tracking. Do that with
our own datastructures instead
2022-08-18 21:57:36 -04:00
Dylan Baker 3f63827527 modules/pkgconfig: ensure "name" is not None
The name can be None if a library is not passed as a positional
argument, and the name keyword argument is not provided. We shouldn't
allow that to happen.
2022-08-18 21:57:36 -04:00
Dylan Baker 26f02f50b8 modules/pkgconfig: Get most type annotations added
There are still a lot of errors here due to a mixture of really bad
design (adding extra attributes to objects), and legitimate type errors
(passing a str where a List[str] is expected). I suspect a lot of these
cases aren't hit for some reason.
2022-08-18 21:57:36 -04:00
Dylan Baker e84f293f67 modules/pkgconfig: Use typed_kwargs 2022-08-18 21:57:36 -04:00
Dylan Baker ddb95b0ed8 modules/pkgconfig: use typed_pos_args 2022-08-18 21:57:36 -04:00
Dylan Baker 6e75456a75 modules/pkgconfig: fix typo in blocked variable
require_private -> requires_private.
2022-08-18 21:57:36 -04:00
Dylan Baker 48222c45b2 modules/pkgconfig: Fix some low hanging typing issues 2022-08-18 21:57:36 -04:00
Dylan Baker 6843f56f6b modules: use module level information about new and deprecation
Instead of using FeatureNew/FeatureDeprecated in the module.

The goal here is to be able to handle information about modules in a
single place, instead of having to handle it separately. Each module
simply defines some metadata, and then the interpreter handles the rest.
2022-08-17 16:25:36 -04:00
Marc-André Lureau 6096337904 pkgconfig: do not add valgrind as requirement
For the same reasons commit 7aa28456d ("Add dependency type for
Valgrind") removed linking with valgrind, pkgconfig shouldn't generate
"Requirements" for it, in general.

This solves dbus meson port question/issue from:
https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/303#note_1444819

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-06 10:36:44 -07:00
Michael Mera 9b21428006 fix parameter expansion in several error messages
At several points in the code base, f-strings are not correctly expanded
due to missing 'f' string prefix. This fixes all the occurrences I could
find.
2022-06-17 12:16:42 -04:00
Fredrik Salomonsson 2e31330fe6 pkgconfig: Add relocatable module option
If set to true it will generate the pkgconfig files as relocatable i.e
the prefix variable will be relative to the install_dir. By default
this is false.

Will generate a MesonException if the pkgconfig file is installed
outside of the package and pkgconfig.relocatable=true.
2022-04-19 17:35:08 -04:00
Tristan Partin 2c03b2bb7f Move dataonly pkgconfig file to datadir/pkgconfig
dataonly files are architecture independent (lib vs lib64 for example).

Fixes #9902
2022-03-09 17:50:41 -05:00
Eli Schwartz 6240920c21
pkgconfig module: allow custom variables to reference builtin directories
Automatically generate additional variables and write them into the
generated pkg-config file.

This means projects no longer need to manually define the ones they
use, which is annoying for dataonly usages (it used to forbid setting
the base library-relevant "reserved" ones, and now allows it only for
dataonly. But it's bloat to manualy list them anyway).

It also fixes a regression in commit
248e6cf473 which caused libdir to not be
set, and to be unsettable, if the pkg-config file has no libraries but
uses the ${libdir} expansion in a custom variable. This could be
considered likely a case for dataonly, but it's not guaranteed.
2022-02-15 16:50:41 -05:00
Andrea Pappacoda 248e6cf473 pkgconfig: set libdir only if used
This should address some concerns outlined in
https://github.com/yhirose/cpp-httplib/pull/1182
2022-02-01 12:23:06 -08:00
Xavier Claessens 95a4c6a62a pkgconfig: Fix linking to a custom target
When generating pkgconfig file for a library that links to an
uninstalled static library built by custom_target() Meson was crashing
when trying to access some attributes that does not exist on that class.

Also fix is_internal() implementation, it only really make sense on a
CustomTargetIndex or if CustomTarget has only a single output.
2021-12-22 08:04:08 +05:30
Eli Schwartz 038b31e72b
various manual conversion of percent-formatted strings to f-strings 2021-11-01 20:26:18 -04:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Eli Schwartz da81586a5b pkgconfig module: correctly generate Libs search path with absolute install_dir
For example the OpenRC build files install libraries to install_dir: '/lib'
and this works, but causes the generated pkg-config to say:

prefix=/usr

Libs: -L${prefix}//lib

which is both ugly (double //) and resolves to /usr/lib which is exactly
what does not work.
2021-10-10 14:30:46 +03:00
Eli Schwartz d06cc042eb
f-strings 2021-10-04 16:29:32 -04:00
Dylan Baker c3c30d4b06 interpreter: Use typed_kwargs for func_custom_target
This does not convert the build side, or remove any of the checking it
does. We still need that for other callers of custom target. What we'll
do for those is add an internal interface that defaults things, then
we'll be able to have those callers do their own validation, and the
CustomTarget validation machinary can be removed.

Fixes #9096
2021-09-30 21:01:38 +02:00
Dylan Baker d661a0cd96 build: use an object rather than a dict for the dep_manifest
This really is more of a struct than a dict, as the types are disjoint
and they are internally handled, (ie, not from user input). This cleans
some things up, in addition I spotted a bug in the ModuleState where the
dict with the version and license is passed to a field that expects just
the version string.
2021-09-24 10:36:05 -07:00
Filipe Laíns af8b55d49b mintro: add installed_plan
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-06 18:10:55 +02:00
Xavier Claessens 8c5aa031b5 Add install tags
Fixes: #7007.
2021-08-17 15:19:18 -04:00
Dylan Baker 20399a3e04 modules/pkgconfig: remove handling of .pcdep
Nothing uses this anymore, so don't check for it.
2021-07-13 16:43:14 -07:00
Daniel Mensinger 8f7343831b refactor: Refactor BothLibraries logic
This commit introduces a new type of `HoldableObject`: The
`SecondLevelHolder`. The primary purpose of this class is
to handle cases where two (or more) `HoldableObject`s are
stored at the same time (with one default object). The
best (and currently only) example here is the `BothLibraries`
class.
2021-06-26 12:49:35 +02:00
Daniel Mensinger 34c28dc92c holders: remove unholder 2021-06-18 23:48:33 +02:00
Daniel Mensinger 84a3e459a8 holders: Introduce BothLibraries 2021-06-18 23:48:33 +02:00
Daniel Mensinger 95b70bcb97 deps: Split dependencies.base
Split the Factory and dependency classes out
of the base.py script to improve maintainability.
2021-06-03 10:23:27 -07:00
Xavier Claessens 2e02ef6592 modules: Add methods dict everywhere
This fix calling random internal methods from meson.build as long as
they were not prefixed by underscore.
2021-05-28 15:17:10 -04:00
Xavier Claessens 69a5c950a3 pkgconfig: Do not escape custom variables
We need to escape space in variables that gets into cflags or libs
because otherwise we cannot split compiler args when paths contains
spaces. But custom variables are unlikely to be path that gets used in
cflags/libs, and escaping them cause regression in GStreamer that use
space as separator in a list variable.
2021-05-18 18:03:37 -04:00
Xavier Claessens 3c64ecaf86 pkgconfig: Add support for CustomTarget objects in generator
Fixes: #8618.
2021-04-19 17:57:34 +03:00
Xavier Claessens 8f6ad8e52e pkgconfig: Fix broken paths in -uninstalled.pc on Windows
Fixes: #8668
2021-04-18 22:17:21 +03:00
Xavier Claessens 47633330da pkgconfig: Allow setting prefix in dataonly pc file
Some variables are reserved because meson set them automatically. But we
are not setting them for dataonly pc files, so there is no reason to
reserve them.

Fixes: #8583.
2021-03-26 23:41:03 +02:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Xavier Claessens 5ad9320f47 pkgconfig: Add missing permitted kwargs
Fixes #8462
2021-03-03 09:23:37 -05:00
Xavier Claessens 2fabd4c7dc minstall: Add --skip-subprojects option
By default all subprojects are installed. If --skip-subprojects is given
with no value only the main project is installed. If --skip-subprojects
is given with a value, it should be a coma separated list of subprojects
to skip and all others will be installed.

Fixes: #2550.
2021-02-22 23:03:55 +02:00
Dylan Baker 022632c91b build/interperter: Add annotations and move input validation to interpreter
This moves the user input validation to the interpreter, instead of
being in the build module, and adds type annotations.
2021-01-13 13:32:48 -08:00
Dylan Baker e81acbd606 Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
2021-01-04 12:20:58 -08:00
Dylan Baker f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
Xavier Claessens 6d816c1800 pkgconfig: Make external deps of static library public
This fix a regression caused by
https://github.com/mesonbuild/meson/pull/7837, it wanted to make
InternalDependency's external_deps private but has side effect of making
StatisLibrary's external_deps private too.

It is technically correct to make them private, but Meson used to make
StaticLibrary deps public so they are usable without `pkg-config
--static` when we know there is only a static library available.

Fixes: #7929.
2020-11-04 17:56:48 +02:00
Xavier Claessens 14fd1a329a pkgconfig: Define libdir and includedir in -uninstalled.pc files
This fixes glib-2.0-uninstalled.pc file.
GLib does `extra_cflags : ['-I${libdir}/glib-2.0/include']` because some
of its headers gets installed there. But when used uninstalled that path
makes no sense and pkg-config aborts because ${libdir} is not defined.
This cannot be worked around by GLib because Meson does not allow
setting different `extra_cflags` for -uninstalled.pc, and does not allow
setting libdir in `uninstalled_variables`.
2020-10-22 00:58:30 +03:00
Xavier Claessens 0c95d92404 pkgconfig: InternalDependency's ext_deps should be private by default
This fixes a regression introduced by
https://github.com/mesonbuild/meson/pull/7488.

InternalDependency's ext_deps previously where simply ignored, but that
PR has effect to add many more public Requires in generated pc files.
2020-10-17 15:53:46 +03:00
Xavier Claessens bcf369ea3c Fix consistency in variables kwarg
Share common code to extract the `variables` kwarg in
declare_dependency() and pkg.generate().
2020-10-16 18:09:56 +03:00