aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-03-29 15:46:12 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2018-04-03 15:20:19 -0400
commit5eef325ab61820ca0c3fa5673afc917dde2aa1ef (patch)
tree00de9cfcff5183367b153fa6da9260cc8033aeed /mesonbuild
parentcf0e997167e2a9657be58a1ae49b7a4f566d6083 (diff)
downloadmeson-5eef325ab61820ca0c3fa5673afc917dde2aa1ef.zip
meson-5eef325ab61820ca0c3fa5673afc917dde2aa1ef.tar.gz
meson-5eef325ab61820ca0c3fa5673afc917dde2aa1ef.tar.bz2
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.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter.py6
-rw-r--r--mesonbuild/modules/pkgconfig.py22
2 files changed, 15 insertions, 13 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 42a57d3..6bd0b97 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -605,6 +605,8 @@ class StaticLibraryHolder(BuildTargetHolder):
class SharedLibraryHolder(BuildTargetHolder):
def __init__(self, target, interp):
super().__init__(target, interp)
+ # Set to True only when called from self.func_shared_lib().
+ target.shared_library_only = False
class SharedModuleHolder(BuildTargetHolder):
def __init__(self, target, interp):
@@ -2486,7 +2488,9 @@ root and issuing %s.
@permittedKwargs(permitted_kwargs['shared_library'])
def func_shared_lib(self, node, args, kwargs):
- return self.build_target(node, args, kwargs, SharedLibraryHolder)
+ holder = self.build_target(node, args, kwargs, SharedLibraryHolder)
+ holder.held_object.shared_library_only = True
+ return holder
@permittedKwargs(permitted_kwargs['shared_module'])
def func_shared_module(self, node, args, kwargs):
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index ef74d63..c587f84 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -105,26 +105,24 @@ class DependenciesHelper:
if obj.found():
processed_libs += obj.get_link_args()
processed_cflags += obj.get_compile_args()
- elif isinstance(obj, build.SharedLibrary):
+ elif isinstance(obj, build.SharedLibrary) and obj.shared_library_only:
+ # Do not pull dependencies for shared libraries because they are
+ # only required for static linking. Adding private requires has
+ # the side effect of exposing their cflags, which is the
+ # intended behaviour of pkg-config but force Debian to add more
+ # than needed build deps.
+ # See https://bugs.freedesktop.org/show_bug.cgi?id=105572
processed_libs.append(obj)
if public:
if not hasattr(obj, 'generated_pc'):
obj.generated_pc = self.name
- elif isinstance(obj, build.StaticLibrary):
- # Due to a "feature" in pkgconfig, it leaks out private dependencies.
- # Thus we will not add them to the pc file unless the target
- # we are processing is a static library.
- #
- # This way (hopefully) "pkgconfig --libs --static foobar" works
- # and "pkgconfig --cflags/--libs foobar" does not have any trace
- # of dependencies that the build file creator has not explicitly
- # added to the dependency list.
+ elif isinstance(obj, (build.SharedLibrary, build.StaticLibrary)):
processed_libs.append(obj)
+ self.add_priv_libs(obj.get_dependencies())
+ self.add_priv_libs(obj.get_external_deps())
if public:
if not hasattr(obj, 'generated_pc'):
obj.generated_pc = self.name
- self.add_priv_libs(obj.get_dependencies())
- self.add_priv_libs(obj.get_external_deps())
elif isinstance(obj, str):
processed_libs.append(obj)
else: