summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2022-02-03 21:07:57 +1100
committerMatthew Waters <matthew@centricular.com>2022-02-04 15:17:01 +1100
commitbc1f72b6b844d1e6da66b94743c2db222ff24224 (patch)
tree184c105dca6edf5199db4ec501488c79d5cddfc5
parente105cd97e1f0899aa9a5907bbece6bab9a25ed6a (diff)
moltenvk: ship correctly for macos universal1.20.0
libvulkan.dylib and libvulkan.1.dylib don't seem to respond well to XCode 12.0 build tools modifying the binary as our current build set up requires. Luckily we don't actually need them so disable that for now. We also need to remove the @rpath entry in libMoltenVK.dylib's id to avoid dependant libraries from using that name as their link name and then causing our relocation/merge to create a libgstvulkan/applemedia that links against a non-existent @rpath/libMoltenVK.dylib. Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/796>
-rw-r--r--packages/gstreamer-1.0-system.package4
-rw-r--r--recipes/moltenvk.recipe40
2 files changed, 30 insertions, 14 deletions
diff --git a/packages/gstreamer-1.0-system.package b/packages/gstreamer-1.0-system.package
index ba28517d..912207fe 100644
--- a/packages/gstreamer-1.0-system.package
+++ b/packages/gstreamer-1.0-system.package
@@ -20,6 +20,7 @@ class Package(custom.GStreamer, package.Package):
platform_files = {
Platform.IOS : ['moltenvk:libs'],
+ Platform.DARWIN : ['moltenvk:libs'],
}
def prepare(self):
@@ -31,6 +32,3 @@ class Package(custom.GStreamer, package.Package):
if self.config.target_arch in (Architecture.X86, Architecture.X86_64, Architecture.ARM64, Architecture.UNIVERSAL):
self.files.append('angle-uwp:libs')
self.files_devel.append('angle-uwp:headers')
- if self.config.target_platform == Platform.DARWIN and \
- self.config.target_arch == Architecture.X86_64:
- self.platform_files[Platform.DARWIN] = ['moltenvk:libs']
diff --git a/recipes/moltenvk.recipe b/recipes/moltenvk.recipe
index d08e0ea2..dfa1022a 100644
--- a/recipes/moltenvk.recipe
+++ b/recipes/moltenvk.recipe
@@ -44,13 +44,22 @@ class Recipe(recipe.Recipe):
self.files_bins = []
if self.config.target_platform == Platform.DARWIN:
- self.files_libs += ['libvulkan']
+ # FIXME: libvulkan.dylib doesn't currently work with the
+ # id/signature modifications we do later and may need to be rebuilt
+ #self.files_libs += ['libvulkan']
# no libvulkan.a
self.library_type = LibraryType.SHARED
async def install(self):
- # only copy once for the only architecture supported by the libraries
+ # only copy once for the architectures supported by the libraries
+ if self.config.target_platform not in (Platform.IOS, Platform.DARWIN):
+ return;
+
if self.config.target_platform == Platform.IOS and self.config.target_arch != Architecture.ARM64:
+ return;
+
+ if self.config.target_platform == Platform.DARWIN \
+ and self.config.target_arch not in [Architecture.ARM64, Architecture.X86_64]:
return
srcdir = self.config.moltenvk_prefix
@@ -80,10 +89,10 @@ class Recipe(recipe.Recipe):
if self.config.target_platform == Platform.DARWIN:
to_copy += [
- (os.path.join(srcdir, 'macOS', 'lib', 'libvulkan.dylib'),
- libvulkan, False),
- (os.path.join(srcdir, 'macOS', 'lib', 'libvulkan.1.dylib'),
- libvulkan, False),
+ #(os.path.join(srcdir, 'macOS', 'lib', 'libvulkan.dylib'),
+ # libvulkan, False),
+ #(os.path.join(srcdir, 'macOS', 'lib', 'libvulkan.1.dylib'),
+ # libvulkan1, False),
(os.path.join(srcdir, 'MoltenVK', 'dylib', 'macOS', 'libMoltenVK.dylib'),
libmoltenvk_shared, False),
(os.path.join(srcdir, 'MoltenVK', 'MoltenVK.xcframework', 'macos-arm64_x86_64', 'libMoltenVK.a'),
@@ -105,16 +114,25 @@ class Recipe(recipe.Recipe):
os.makedirs(os.path.dirname(dest))
shutil.copy(src, dest)
- # The SDK provides universal binaries, we need to convert them into thin binaries so
- # that the merge step can merge them back
if self.config.target_platform == Platform.DARWIN:
binaries = [os.path.join(bindir, x) for x in self.files_bins]
- for f in binaries + [libvulkan, libmoltenvk_shared, libmoltenvk_static]:
+ for f in [libmoltenvk_shared]: # libvulkan, libvulkan1
+ # Because we are editing the binary, we need to the remove the signature.
+ # The process would crash otherwise as not loadable
+ await shell.async_call(['codesign', '--remove-signature', f], logfile=self.logfile)
+ # we need to remove the @rpath from the libname
+ await shell.async_call(['install_name_tool', '-id', f, f], logfile=self.logfile)
+ # The SDK provides universal binaries, we need to convert them into thin binaries so
+ # that the merge step can merge them back
await shell.async_call(['lipo', '-thin', self.config.target_arch, f, '-output', f], logfile=self.logfile)
+ # no need to change id for static libraries
+ for f in binaries + [libmoltenvk_static]:
# Because we are editing the binary, we need to the remove the signature.
- # The process would crash otherwise as not being
+ # The process would crash otherwise as not loadable
await shell.async_call(['codesign', '--remove-signature', f], logfile=self.logfile)
-
+ # The SDK provides universal binaries, we need to convert them into thin binaries so
+ # that the merge step can merge them back
+ await shell.async_call(['lipo', '-thin', self.config.target_arch, f, '-output', f], logfile=self.logfile)
LibtoolLibrary('vulkan', None, None, None, libdir,
self.config.target_platform).save()