[gnome-subtitles/meson-port] Improving meson build files



commit c035a84914ee23ee1842d479a258ac74dd6693ff
Author: Pedro Castro <pedro gnomesubtitles org>
Date:   Sun Jun 5 15:11:49 2022 +0100

    Improving meson build files

 README.md                       | 27 ++++++++++++-------------
 build-aux/meson.build           |  2 +-
 build-aux/meson_post_install.py | 44 ++++++++++++++++++++++++++++-------------
 gnome-subtitles.csproj          | 27 +++++++++++--------------
 meson.build                     |  2 ++
 meson_options.txt               |  8 +++-----
 6 files changed, 61 insertions(+), 49 deletions(-)
---
diff --git a/README.md b/README.md
index 9dbccbb..145ebe6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Gnome Subtitles
 
-http://gnomesubtitles.org
+https://gnomesubtitles.org
 
 Gnome Subtitles is a subtitle editor for the GNOME desktop. It supports the most
 common text-based subtitle formats and allows for subtitle editing, translation
@@ -9,7 +9,6 @@ and synchronization.
 
 ## Dependencies
 
-
 Run time dependencies:
 - mono-runtime         >= 4.0
 - libmono-i18n4.0-all  >= 4.0
@@ -25,6 +24,7 @@ Run time dependencies:
 - gtkspell3            >= 3.0
 
 Build time dependencies:
+- meson                        >= 0.53
 - pkg-config, intltool, autoconf, automake, libtool and yelp-tools
 - libgtk-3-dev         >= 3.12
 - mono-devel           >= 4.0
@@ -33,28 +33,27 @@ Build time dependencies:
 - libgstreamer-plugins-base1.0-dev >= 1.0
 
 
-## Packaging Notes
+## Building
 
-Check the NEWS file for dependency changes and other packaging notes.
+       meson build && meson compile -C build
 
 
-## Hacking Gnome Subtitles
+## Installing
 
-Get the latest code from the GNOME Git repository:
+       meson install -C build
 
-       git gitlab gnome org:GNOME/gnome-subtitles.git
 
-Install all required run time and build time dependencies (see above) plus the following which
-are required to run autogen.sh:
+## Hacking
 
-       gnome-common
-       gtk-doc-tools
+Build the solution with Meson (see Building above) to compile all dependencies
+and make them available to Monodevelop. This only needs to be done once.
+Fire up Monodevelop and open the solution file 'gnome-subtitles.sln'.
 
-Run the build tools to make sure necessary libraries are compiled and placed on the 'build' dir:
 
-       ./autogen.sh && make
+## License
 
-Fire up Monodevelop and open solution file 'gnome-subtitles.sln'.
+Gnome Subtitles is released under the GNU General Public License (GPL) version 2 or
+later, see the file [COPYING](COPYING) for more information.
 
 
 ## Need help?
diff --git a/build-aux/meson.build b/build-aux/meson.build
index 19e482b..669f031 100644
--- a/build-aux/meson.build
+++ b/build-aux/meson.build
@@ -1,4 +1,4 @@
-meson.add_install_script('meson_post_install.py', get_option('libdir'))
+meson.add_install_script('meson_post_install.py', get_option('libdir'), 
get_option('install_gtk_sharp').to_string(), get_option('install_gst_sharp').to_string())
 
 configure_file(
        input: 'gnome-subtitles.in',
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
index 9f5ae70..b9f4edc 100644
--- a/build-aux/meson_post_install.py
+++ b/build-aux/meson_post_install.py
@@ -6,28 +6,44 @@ import subprocess
 import sys
 
 libdir = sys.argv[1]
+install_gtk_sharp = (sys.argv[2] == 'true')
+install_gst_sharp = (sys.argv[3] == 'true')
 
 #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', 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
+#Install gtk-sharp and gst-sharp libs
 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'
-]
+cs_libs = []
+
+if install_gtk_sharp:
+       print('Installing gtk-sharp libs')
+       cs_libs += [
+               os.path.join(os.environ['MESON_SOURCE_ROOT'], 'build-aux/') + 'cairo-sharp.dll.config',
+               build_path_subprojects + 'gtk-sharp/Source/atk/atk-sharp.dll',
+               build_path_subprojects + 'gtk-sharp/Source/atk/atk-sharp.dll.config',
+               build_path_subprojects + 'gtk-sharp/Source/cairo/cairo-sharp.dll',
+               build_path_subprojects + 'gtk-sharp/Source/gdk/gdk-sharp.dll',
+               build_path_subprojects + 'gtk-sharp/Source/gdk/gdk-sharp.dll.config',
+               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 + 'gtk-sharp/Source/pango/pango-sharp.dll',
+               build_path_subprojects + 'gtk-sharp/Source/pango/pango-sharp.dll.config',
+       ]
+
+if install_gst_sharp:
+       print('Installing gstreamer-sharp libs')
+       cs_libs += [
+               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/gnome-subtitles.csproj b/gnome-subtitles.csproj
index b418e96..52994c7 100644
--- a/gnome-subtitles.csproj
+++ b/gnome-subtitles.csproj
@@ -30,31 +30,28 @@
     <PlatformTarget>x86</PlatformTarget>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="System" />
     <Reference Include="Mono.Posix" />
-    <Reference Include="atk-sharp">
-      <HintPath>build\atk-sharp.dll</HintPath>
-    </Reference>
-    <Reference Include="gdk-sharp">
-      <HintPath>build\gdk-sharp.dll</HintPath>
+    <Reference Include="cairo-sharp">
+      <HintPath>build\subprojects\gtk-sharp\Source\cairo\cairo-sharp.dll</HintPath>
     </Reference>
     <Reference Include="gio-sharp">
-      <HintPath>build\gio-sharp.dll</HintPath>
+      <HintPath>build\subprojects\gtk-sharp\Source\gio\gio-sharp.dll</HintPath>
     </Reference>
     <Reference Include="glib-sharp">
-      <HintPath>build\glib-sharp.dll</HintPath>
+      <HintPath>build\subprojects\gtk-sharp\Source\glib\glib-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="gtk-sharp">
+      <HintPath>build\subprojects\gtk-sharp\Source\gtk\gtk-sharp.dll</HintPath>
     </Reference>
     <Reference Include="gstreamer-sharp">
-      <HintPath>build\gstreamer-sharp.dll</HintPath>
+      <HintPath>build\subprojects\gstreamer-sharp\sources\gstreamer-sharp.dll</HintPath>
     </Reference>
-    <Reference Include="gtk-sharp">
-      <HintPath>build\gtk-sharp.dll</HintPath>
+    <Reference Include="gdk-sharp">
+      <HintPath>build\subprojects\gtk-sharp\Source\gdk\gdk-sharp.dll</HintPath>
     </Reference>
+    <Reference Include="System" />
     <Reference Include="pango-sharp">
-      <HintPath>build\pango-sharp.dll</HintPath>
-    </Reference>
-    <Reference Include="cairo-sharp">
-      <HintPath>build\cairo-sharp.dll</HintPath>
+      <HintPath>build\subprojects\gtk-sharp\Source\pango\pango-sharp.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
diff --git a/meson.build b/meson.build
index bc659db..dcd8e63 100644
--- a/meson.build
+++ b/meson.build
@@ -23,5 +23,7 @@ subdir('po')
 subdir('src')
 subdir('build-aux')
 
+summary('Install gtk-sharp', get_option('install_gtk_sharp'))
+summary('Install gstreamer-sharp', get_option('install_gst_sharp'))
 summary('Require all tests', get_option('require_all_tests'))
 
diff --git a/meson_options.txt b/meson_options.txt
index 992f336..0ed38fe 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,4 @@
-option(
-       'require_all_tests',
-       type: 'boolean', value: false,
-       description: 'Require all tests to be run'
-)
+option('install_gtk_sharp', type: 'boolean', value: true, description: 'Install GtkSharp libs (from 
https://github.com/GLibSharp/GtkSharp)')
+option('install_gst_sharp', type: 'boolean', value: true, description: 'Install GStreamerSharp libs (from 
https://gstreamer.freedesktop.org/modules/gstreamer-sharp.html)')
+option('require_all_tests', type: 'boolean', value: false, description: 'Require all tests to be run')
 


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