diff options
| author | L. E. Segovia <amy@amyspark.me> | 2025-01-21 23:14:23 +0000 |
|---|---|---|
| committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2025-01-30 15:19:33 +0530 |
| commit | c616f1ed50ffcd8f513d888c2dace105476a9168 (patch) | |
| tree | 70de2f3b7d2f75f1e069334779b2fa7c55583de6 /mesonbuild/dependencies/python.py | |
| parent | d25fcbb5fc733c2a4cb01b79566e64b84736367d (diff) | |
| download | meson-c616f1ed50ffcd8f513d888c2dace105476a9168.tar.gz | |
Python: Work around missing rpath in Xcode python3-embed
This enables generating Python bindings and linking against
`python3-embed` without resorting to later `install_name_tool` changes,
as the pkg-config module provided by Xcode doesn't say that
Python3.framework requires a rpath entry:
$ otool -L /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Python3
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Python3:
@rpath/Python3.framework/Versions/3.9/Python3 (compatibility version 3.9.0, current version 3.9.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1933.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
Diffstat (limited to 'mesonbuild/dependencies/python.py')
| -rw-r--r-- | mesonbuild/dependencies/python.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index c978ad62e..f45b4f908 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -327,6 +327,12 @@ class PythonPkgConfigDependency(PkgConfigDependency, _PythonDependencyBase): if not self.link_libpython and mesonlib.version_compare(self.version, '< 3.8'): self.link_args = [] + # But not Apple, because it's a framework + if self.env.machines.host.is_darwin() and 'PYTHONFRAMEWORKPREFIX' in self.variables: + framework_prefix = self.variables['PYTHONFRAMEWORKPREFIX'] + # Add rpath, will be de-duplicated if necessary + if framework_prefix.startswith('/Applications/Xcode.app/'): + self.link_args += ['-rpath,' + framework_prefix] class PythonFrameworkDependency(ExtraFrameworkDependency, _PythonDependencyBase): |
