[packaging/craft-blueprints-kde] libs/gstreamer: gstreamer: move plugins out of Frameworks on macOS so codesign works

Linus Jahn <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 5756a322d8d4faf9c8b2f769f59a1ae3e2b5907d by Linus Jahn.
Committed on 17/07/2026 at 22:44.
Pushed by lnj into branch 'master'.

gstreamer: move plugins out of Frameworks on macOS so codesign works

GStreamer installs its plugins to lib/gstreamer-1.0. When an app using
gstreamer is bundled into a macOS .app, MacBasePackager moves the whole
lib/ directory into Contents/Frameworks. `codesign --deep` then walks into
Contents/Frameworks/gstreamer-1.0, tries to interpret that plain directory
of plugin dylibs as a bundle, and fails the whole signature with:

    <app>/Contents/MacOS/<app>: bundle format unrecognized, invalid, or unsuitable
    In subcomponent: <app>/Contents/Frameworks/gstreamer-1.0

Plugin dylib directories under Contents/PlugIns sign fine (that is where
Qt's plugins live). Relocate the plugins to plugins/ in postInstall on
macOS so the packager places them in Contents/PlugIns/gstreamer-1.0 instead.

Consumers must point GST_PLUGIN_SYSTEM_PATH at the new location at runtime;
on macOS this only affects gstreamer-based bundles (currently Kaidan).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

M  +18   -0    libs/gstreamer/gstreamer.py

https://invent.kde.org/packaging/craft-blueprints-kde/-/commit/5756a322d8d4faf9c8b2f769f59a1ae3e2b5907d

diff --git a/libs/gstreamer/gstreamer.py b/libs/gstreamer/gstreamer.py
index 79411c88a..bb06d8cf6 100644
--- a/libs/gstreamer/gstreamer.py
+++ b/libs/gstreamer/gstreamer.py
@@ -3,6 +3,8 @@
 # SPDX-License-Identifier: CC0-1.0
 
 import info
+import utils
+from CraftCore import CraftCore
 from Package.MesonPackageBase import MesonPackageBase
 from Utils import CraftHash
 
@@ -30,3 +32,19 @@ class Package(MesonPackageBase):
             f"-Dtests={self.subinfo.options.dynamic.buildTests.asEnabledDisabled}",
         ]
         self.subinfo.options.configure.ldflags += " -lintl"
+
+    def postInstall(self):
+        if not super().postInstall():
+            return False
+        if CraftCore.compiler.isMacOS:
+            # GStreamer installs its plugins to lib/gstreamer-1.0. When the app is bundled,
+            # craft moves the whole lib/ directory into the .app's Contents/Frameworks, where
+            # codesign --deep rejects the plain plugin directory ("bundle format unrecognized,
+            # invalid, or unsuitable"). Move the plugins to plugins/ so they end up in
+            # Contents/PlugIns/gstreamer-1.0 instead (like Qt's plugins, which sign fine).
+            # Consumers must point GST_PLUGIN_SYSTEM_PATH at that directory at runtime.
+            plugins = self.imageDir() / "lib/gstreamer-1.0"
+            if plugins.is_dir():
+                if not utils.mergeTree(plugins, self.imageDir() / "plugins/gstreamer-1.0"):
+                    return False
+        return True
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.