[gnome-subtitles/meson-port] Bundle gtk# and gst# libs when installing gnome subtitles



commit 41936cdfd3f00f5362bf695734b543f5cbe19cde
Author: Pedro Castro <pedro gnomesubtitles org>
Date:   Fri Jun 3 08:39:56 2022 +0100

    Bundle gtk# and gst# libs when installing gnome subtitles

 build-aux/cairo-sharp.dll.config |  3 +++
 build-aux/meson.build            |  2 +-
 build-aux/meson_post_install.py  | 26 ++++++++++++++++++++++++--
 meson.build                      |  2 +-
 4 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/build-aux/cairo-sharp.dll.config b/build-aux/cairo-sharp.dll.config
new file mode 100644
index 0000000..7ee8a33
--- /dev/null
+++ b/build-aux/cairo-sharp.dll.config
@@ -0,0 +1,3 @@
+<configuration>
+  <dllmap dll="cairo-2.dll" target="libcairo.so.2"/>
+</configuration>
diff --git a/build-aux/meson.build b/build-aux/meson.build
index 077bd2d..ca80012 100644
--- a/build-aux/meson.build
+++ b/build-aux/meson.build
@@ -1,4 +1,4 @@
-meson.add_install_script('meson_post_install.py')
+meson.add_install_script('meson_post_install.py', get_option('libdir'))
 
 configure_file(
        input: 'gnome-subtitles.in',
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
index 98eef0e..9f5ae70 100644
--- a/build-aux/meson_post_install.py
+++ b/build-aux/meson_post_install.py
@@ -1,11 +1,33 @@
 #!/usr/bin/env python3
 
 import os
+import shutil
 import subprocess
+import sys
 
-schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
+libdir = sys.argv[1]
 
+#Install gsettings schemas (TODO use meson's gnome module instead for installing schemas (since 0.57))
 if not os.environ.get('DESTDIR'):
        print('Compiling gsettings schemas...')
-       subprocess.call(['glib-compile-schemas', schemadir])
+       subprocess.call(['glib-compile-schemas', os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 
'glib-2.0', 'schemas')])
 
+#Copy gtk# and gst# .dll and .config files to gnome subtitles' lib dir
+build_path_subprojects = os.path.join(os.environ['MESON_BUILD_ROOT'], 'subprojects/')
+cs_libs = [
+       os.path.join(os.environ['MESON_SOURCE_ROOT'], 'build-aux/') + 'cairo-sharp.dll.config',
+       build_path_subprojects + 'gtk-sharp/Source/cairo/cairo-sharp.dll',
+       build_path_subprojects + 'gtk-sharp/Source/gio/gio-sharp.dll',
+       build_path_subprojects + 'gtk-sharp/Source/gio/gio-sharp.dll.config',
+       build_path_subprojects + 'gtk-sharp/Source/glib/glib-sharp.dll',
+       build_path_subprojects + 'gtk-sharp/Source/glib/glib-sharp.dll.config',
+       build_path_subprojects + 'gtk-sharp/Source/gtk/gtk-sharp.dll',
+       build_path_subprojects + 'gtk-sharp/Source/gtk/gtk-sharp.dll.config',
+       build_path_subprojects + 'gstreamer-sharp/sources/gstreamer-sharp.dll',
+       build_path_subprojects + 'gstreamer-sharp/sources/gstreamer-sharp.dll.config'
+]
+
+dst = os.path.join(os.environ.get('DESTDIR') + os.environ['MESON_INSTALL_PREFIX'], libdir, 'gnome-subtitles')
+print('Copying gtk# and gst# .dll and .config files to ' + dst)
+for lib in cs_libs:
+       shutil.copy2(lib, dst)
diff --git a/meson.build b/meson.build
index b8a82d2..bc659db 100644
--- a/meson.build
+++ b/meson.build
@@ -14,7 +14,7 @@ dependency('gstreamer-video-1.0', version : '>= 1.0')
 dependency('gstreamer-plugins-base-1.0', version : '>= 1.0')
 dependency('gstreamer-pbutils-1.0', version : '>= 1.0')
 
-gst_sharp = subproject('gstreamer-sharp', default_options: ['install=true'])
+gst_sharp = subproject('gstreamer-sharp')
 gst_sharp_dep = gst_sharp.get_variable('gst_sharp_dep')
 gtk_sharp_dep = gst_sharp.get_variable('gtk_sharp_dep')
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]