summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2024-03-28 03:04:22 +0900
committerSeungha Yang <seungha@centricular.com>2024-03-28 23:58:45 +0900
commit4a3613f3c57eaeb8b9ed6fc026a645af4fdefa66 (patch)
tree5d9668ecaf97f1488fc1ff446dbd4672f67eec2e
parentc34f33f91f90ff10fb8761b88b701a3afb7358d9 (diff)
gst-plugins-bad: Ship webview2 plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1428>
-rw-r--r--recipes/gst-plugins-bad-1.0.recipe4
-rw-r--r--recipes/webview2.recipe44
2 files changed, 48 insertions, 0 deletions
diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe
index ab961c81..a0253da0 100644
--- a/recipes/gst-plugins-bad-1.0.recipe
+++ b/recipes/gst-plugins-bad-1.0.recipe
@@ -79,6 +79,7 @@ class Recipe(custom.GStreamer):
'sndfile': 'disabled',
'teletext': 'disabled',
'voamrwbenc': 'disabled',
+ 'webview2': 'disabled',
'wic': 'disabled',
'win32ipc': 'disabled',
'wildmidi': 'disabled',
@@ -531,6 +532,9 @@ class Recipe(custom.GStreamer):
# D3D12 needs newer SDK than system installed one with helper library
self.deps.append('directx-headers')
self.enable_plugin('d3d12', 'sys')
+ # Download webview2 nuget package
+ self.deps.append('webview2')
+ self.enable_plugin('webview2', 'sys')
else:
# mingw does not ship DirectXMath headers
self.deps += ['directxmath']
diff --git a/recipes/webview2.recipe b/recipes/webview2.recipe
new file mode 100644
index 00000000..6399a429
--- /dev/null
+++ b/recipes/webview2.recipe
@@ -0,0 +1,44 @@
+# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
+import shutil
+from pathlib import Path
+
+class Recipe(recipe.Recipe):
+ name = 'webview2'
+ version = '1.0.2420.47'
+ licenses = [{License.BSD_like: ['LICENSE.txt']}]
+ btype = BuildType.CUSTOM
+ stype = SourceType.TARBALL
+ url = 'https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/%(version)s'
+ tarball_name = '%(name)s-%(version)s.zip'
+ tarball_is_bomb = True
+ tarball_checksum = '8e5a7307d71507edbbe02cac27215d71058bbd82cd256cef60f06b945907610a'
+ library_type = LibraryType.STATIC
+
+ files_libs = ['WebView2LoaderStatic']
+ files_headers = ['include/WebView2.h', 'include/WebView2EnvironmentOptions.h']
+
+ can_msvc = True
+
+ def install(self):
+ bdir = Path(self.build_dir) / 'build/native'
+ if self.config.target_arch == Architecture.ARM64:
+ libdir = bdir / 'arm64'
+ elif self.config.target_arch == Architecture.X86_64:
+ libdir = bdir / 'x64'
+ elif self.config.target_arch == Architecture.X86:
+ libdir = bdir / 'x86'
+ else:
+ raise AssertionError
+
+ if self.config.target_platform != Platform.WINDOWS:
+ raise InvalidRecipeError(self, "webview2 only works on Windows")
+
+ # Copy libraries
+ for f in self.files_libs:
+ shutil.copy2(str(libdir / (f + '.lib')), self.config.libdir)
+
+ # Copy headers
+ for d in self.files_headers:
+ dst = Path(self.config.prefix) / d
+ src = bdir / d
+ shutil.copy2(str(src), str(dst))