Commit Graph

101 Commits

Author SHA1 Message Date
Stéphane Cerveau 21e543fea8 pkgconfig: Fix deprecation message (fixes #6720)
Deprecation warning was unable to display because of patch
c8f8d58273

fixes #6720
2020-03-03 08:25:25 -05:00
Rohan Garg 73f03e6093 Introduce dataonly for the pkgconfig module
This allows users to disable writing out the inbuilt variables to
the pkg-config file as they might actualy not be required.

One reason to have this is for architecture-independent pkg-config
files in projects which also have architecture-dependent outputs.

For example : https://gitlab.freedesktop.org/wayland/weston/issues/269

Fixes #4011
2020-02-20 10:19:19 -05:00
Xavier Claessens 4c5a9523be pkgconfig: Generate -uninstalled.pc files
Closes: #3472.
2020-02-05 16:54:01 +01:00
Xavier Claessens b3ab022777 pkgconfig: Fix code that make relative path
When subdir is '/foo/bar' and prefix '/foo' it was returning '/bar',
which is an absolute path. It was then constructing '-L${prefix}//bar'
with bogus double slash.

When subdir is '/fooo/bar' and prefix '/foo' it was returning 'o/bar'.
2020-02-05 16:54:01 +01:00
Dylan Baker fbad73c939 dependencies: Use a DependencyFactory for threads
This lets us make a number of uses of threads safer, because we can use
the threads_factory instead of the ThreadDependency
2020-01-29 09:11:24 -08:00
Eli Schwartz 71bbcc7669 pkgconfig module: add FeatureNew for requires: dependency('foo')
Introduced in https://github.com/mesonbuild/meson/pull/3131
2020-01-09 22:08:03 -05:00
Ryan Lucia 8987a39675 pkgconfig: only check import_filename for shared libraries 2019-11-07 22:20:56 +02:00
sghctoma aba8792b66 Change default pkgconfig directory on FreeBSD
FreeBSD uses ${PREFIX}/libdata/pkgconfig as default pkgconf search path
for non-base libraries. This commit makes that directory the default
install_dir in the pkgconfig module on FreeBSD.
2019-11-05 18:41:00 +02:00
Xavier Claessens dc5ad1fad9 pkgconfig: Do not include uninstalled static libraries 2019-10-01 13:06:45 -04:00
Xavier Claessens 5d0ced220c pkgconfig: Fix ordering of public libraries
The main library must come before extra libraries, because they are
likely to be dependencies of the main library that get promoted from
private to public. This was causing static link issues with glib-2.0.pc.
2019-09-17 11:56:46 -04:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Simon Allen 6a7b4be824 Handle case of dependency('threads') in 'requires' 2019-09-02 21:34:22 +03:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
myd7349 5ede0f5ef0 Force pkgconfig to UTF-8 2019-05-12 00:30:44 +03:00
Eli Schwartz 311cbf347b pkgconfig.generate: add FeatureNew and documentation for implict version
The documentation for this change was left out of its implementation in
commit b4aee4675a and was later documented
in commit f831c05b55 as if it had always
existed.
2019-03-09 19:39:51 +02:00
Nirbheek Chauhan 8481971ff2 pkgconfig: Only warn about deprecation at a location once
See: https://github.com/mesonbuild/meson/pull/4630#issuecomment-459235498
2019-01-31 13:42:58 -05:00
Xavier Claessens d28b75a500 pkgconfig: Avoid deprecation warning when using new syntax
When using pkg.generate(mylib, library : publicdep) it is pretty clear
we don't want to associate publicdep to this generated pkg-config file.
This is a small behaviour break in theory, but also fixes real bug in
the case publicdep is later used to generate another pkg-config file
that does not depend on mylib, that would write a wrong `Requires:
mylib` in the genarated pkg-config file.

This fix unavoidable deprecation warning when glib is cross built
for Android. Glib does `pkg.generate(libglib, libraries : [libintl],
...)` which wrongly associates libintl to the generated glib-2.0.pc, so
when later it generates gio-2.0.pc file that depends on libglib, it will
warn about libintl being associated with libglib. This does not happen
in normal glib build because libintl is usually provided by glibc and is
only an internal library when it fallbacks to a subproject.
2019-01-31 12:48:28 +05:30
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Xavier Claessens 83964f64fa pkgconfig: Fix flag deduplication
This is a regression introduced by 2cbf7caf5, generated pkg-config files
have many duplicated '-pthread' flags.
2019-01-05 21:44:53 +02:00
Niklas Haas 261ab9b214 pkgconfig: Fix link order of library dependencies
Since `_process_libs` appends the lib's dependencies this list already,
the final return value of `_process_libs` will end up after its
dependencies, which is the wrong way around. (The lib must come first,
then its dependencies)

The easiest solution is to simply pre-pend the return value of
`_process_libs` rather than appending it, so that its dependencies come
after the library itself.

Closes #4091.
2018-12-12 10:42:32 -05:00
Xavier Claessens 8612f1543f pkgconfig: Improve and document generator behaviour
- Add libraries from InternalDependency.libraries
- Deprecate association of libraries from the "libraries" keyword
argument to the generated pkg-config file.
2018-12-04 06:49:02 -05:00
Luca Boccassi 80ac40b7e7 pkgconfig: do not generated dependency on itself
If a project generates a single pc file but multiple shared libraries
with dependencies on each other, the generated pc name will be used to
generate a Requires.private dependency, which means the project will
depend on itself. This breaks at least some versions of pkg-config
(0.27 in RHEL7) which cannot handle the recursion and error out.

When adding the dependency using the pc name, check that it's not
on the project itself.

Fixes #4583
2018-12-03 14:58:43 -05:00
Marcel Hollerbach 443a4a8c78 pkgconfig: add support for pkgconfig generation for c#
this adds support for generating pkgconfig files for c#.

The difference to c and cpp is that the -I flag is not known to the c#
compiler, but rather the -r flag which is used to link a .dll file into
the compiled library.

However this opens the question of validating which pkgconfig files can
be generated (depending on the language).

This implements 4409.
2018-11-21 21:36:39 +02:00
Nirbheek Chauhan a1d9adba09 FeatureNew: Make all checks subproject-specific
We now pass the current subproject to every FeatureNew and
FeatureDeprecated call. This requires a bunch of rework to:

1. Ensure that we have access to the subproject in the list of
   arguments when used as a decorator (see _get_callee_args).
2. Pass the subproject to .use() when it's called manually.
3. We also can't do feature checks for new features in
   meson_options.txt because that's parsed before we know the
   meson_version from project()
2018-07-02 19:52:53 +05:30
Nirbheek Chauhan 2cbf7caf5c
Nirbheek/fix pkgconfig library dedup (#3813)
* Add a test case for bad de-dup of -framework args

https://github.com/mesonbuild/meson/issues/3800

* pkgconfig: Don't naively de-dup all arguments

Honestly don't know what I was smoking. Of course the `Libs:` field in
a pkg-config file can have arguments other than -l and -L

Closes https://github.com/mesonbuild/meson/issues/3800

* pkgconfig module: Fix needlessly aggressive de-dup
2018-07-01 12:31:31 +00:00
Salamandar 2fb6018763 Add 0.46.0 features 2018-06-01 14:23:24 +02:00
Salamandar 4741f1e243 Add 0.42.0 features 2018-06-01 14:23:24 +02:00
Salamandar d5207e1c4f Add 0.41.0 features 2018-06-01 14:23:24 +02:00
Nirbheek Chauhan badbfa125c pkgconfig: Don't expose internal libraries in .pc files
Libraries that have been linked with link_whole: are internal
implementation details and should never be exposed to the outside
world in either Libs: or Libs.private:

Closes https://github.com/mesonbuild/meson/issues/3509
2018-05-02 11:46:47 +00:00
Jussi Pakkanen 2b5766980b Keep separator spaces in pkg-config declarations. Closes #3479. 2018-05-02 11:46:47 +00:00
Martin Hostettler 247b1a598a regression: pkgconfig module: Fix Fix regression in Requires.private generation.
The fix for Requires generation in #3406 missed a second code path with the same
problem.

Passing a pkgconfig dependency to requires would produce Q, t, 5, C, o,r, e'
instead of 'Qt5Core'.

This was introduced in 8efd940.
2018-04-20 00:59:06 +03:00
Jussi Pakkanen 998892ed29 Updated all modules to work with the new API. 2018-04-15 13:32:38 +05:30
Martin Hostettler 3f7c6cf3d6 Improve generation of pkg-config files for static only libraries.
Previously pkg-config files generated by the pkgconfig modules for static libraries
with dependencies could only be used in a dependencies with `static: true`.

This was caused by the dependencies only appearing in Libs.private even
if they are needed in the default linking mode. But a user of a
dependency should not have to know if the default linking mode is static
or dynamic; A dependency('somelib') call should always pull in all
needed pieces into the build.

Now for meson build static libraries passed via `libraries` to the generate
method automatically promote dependencies to public.
2018-04-14 23:43:29 +03:00
textshell 0535f38af9 pkgconfig module: Fix regression that Requires.private is generated as 'Q, t, 5, C, o, r, e' instead of Qt5Core. (#3406) 2018-04-14 21:57:12 +03:00
Xavier Claessens da0f0f02e5 pkgconfig generator: Remove duplicates in required versions 2018-04-07 21:35:47 -04:00
Xavier Claessens 142f51a7b5 pkgconfig generator: Fix crash when passing a SharedModule 2018-04-06 21:05:53 -04:00
Xavier Claessens 5eef325ab6 pkgconfig generator: Only skip dependencies when using shared_library()
It is weird and inconsistent to have different pc file depending on
default_library value when using library() or build_target(). We should
skip dependencies only when user explicitly want shared library only.
2018-04-03 15:20:19 -04:00
Matthias Klumpp 6146353f45 Don't crash when using d_module_versions for pkg-config 2018-03-29 20:28:33 +03:00
Xavier Claessens b4aee4675a pkgconfig: Add a simple version of the generator (#3284) 2018-03-29 01:19:42 +03:00
Xavier Claessens 8efd940092 pkgconfig generator: Add required version 2018-03-25 23:20:09 +03:00
Chris Lamb 979eaa804a Make the generated pkgconfig files reproducible.
Whilst working on the Reproducible Builds effort [0], we noticed
that meson creates non-reproducible pkgconfig files as it relies
on Python set ordering.

This was originally filed in Debian as #892515 [1].

 [0] https://reproducible-builds.org/
 [1] https://bugs.debian.org/892515
2018-03-25 18:35:40 +03:00
Jussi Pakkanen e984e1072b
Merge pull request #3251 from mesonbuild/fixpkgconfigdeps
Fix pkg-config dependencies leaking out (debbug 892956)
2018-03-19 23:43:35 +02:00
Jussi Pakkanen cf5f1a83d5 Fix existing tests. 2018-03-19 23:21:56 +02:00
Jussi Pakkanen c385f79737 Do not leak out private dependencies for shared libraries. 2018-03-17 00:44:56 +02:00
Aleksey Filippov 552916d2d2 pkgconfig: allow any non-found dependency requires arguments
On some platforms such as OSX external dependency falls back
to different dependency types if it is not found.
2018-03-13 19:20:40 +02:00
Aleksey Filippov 6e83e41af7 pkgconfig: print requires argument type on error 2018-03-13 19:20:40 +02:00
Aleksey Filippov d6b5d7fe9f Add library with generated_pc and PkgConfigDependency support to pkgconfig.generate() 2018-02-24 23:41:08 +00:00
Aleksey Filippov be6cedb491 Use listify(unholder=True) instead of manual unwrapping 2018-02-24 21:22:04 +00:00
Aleksey Filippov 02bd4be0e6 Fix misprint in pkgconfig comment 2018-02-23 00:24:16 +00:00
Xavier Claessens 6e2e94c645 pkgconfig: Also ignore not found deps passed directly to pc generator
Currently only not found deps implicitly pulled from a Library object
are ignored. We should also ignore not found deps passed directly to
generate() method.

This makes the unit testing more complicated because libfoo pkgconfig
dependency cannot be found when generated from the within the same
meson.build.
2018-01-19 13:45:14 -05:00