[gdk-pixbuf] meson: Add subproject fallbacks for all dependencies



commit ec4790359b0ac0afdf1bb2cd8064266e9e2ec170
Author: Nirbheek Chauhan <nirbheek centricular com>
Date:   Fri Nov 30 16:32:21 2018 +0530

    meson: Add subproject fallbacks for all dependencies
    
    This is needed to build gtk+ and all dependencies from scratch on
    Windows with meson subprojects.

 docs/meson.build |  6 +++++-
 meson.build      | 33 +++++++++++++++++++++++++--------
 2 files changed, 30 insertions(+), 9 deletions(-)
---
diff --git a/docs/meson.build b/docs/meson.build
index 4a40cf1e8..0d90b4755 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -4,7 +4,11 @@ configure_file(input: 'version.xml.in',
                output: 'version.xml',
                configuration: version_xml)
 
-glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+if gobject_dep.type_name() == 'pkgconfig'
+  glib_prefix = gobject_dep.get_pkgconfig_variable('prefix')
+else
+  glib_prefix = get_option('prefix')
+endif
 glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
 docpath = join_paths(gdk_pixbuf_datadir, 'gtk-doc', 'html')
 
diff --git a/meson.build b/meson.build
index 3deff3302..6c5fa36cb 100644
--- a/meson.build
+++ b/meson.build
@@ -57,7 +57,14 @@ gdk_pixbuf_loaderdir = join_paths(gdk_pixbuf_libdir, 'gdk-pixbuf-@0@/@1@/loaders
 
 # Dependencies
 glib_req_version = '>= 2.38.0'
-gio_dep = dependency('gio-2.0', version: glib_req_version)
+glib_dep = dependency('glib-2.0', version: glib_req_version,
+                      fallback : ['glib', 'libglib_dep'])
+gobject_dep = dependency('gobject-2.0', version: glib_req_version,
+                         fallback : ['glib', 'libgobject_dep'])
+gmodule_dep = dependency('gmodule-no-export-2.0', version: glib_req_version,
+                         fallback : ['glib', 'libgmodule_dep'])
+gio_dep = dependency('gio-2.0', version: glib_req_version,
+                     fallback : ['glib', 'libgio_dep'])
 
 # Configurations
 gdk_pixbuf_conf = configuration_data()
@@ -184,11 +191,6 @@ if host_machine.system() == 'darwin'
   gdk_pixbuf_conf.set('OS_DARWIN', 1)
 endif
 
-# Dependencies
-gobject_dep = dependency('gobject-2.0', version: glib_req_version)
-gmodule_dep = dependency('gmodule-no-export-2.0')
-gio_dep = dependency('gio-2.0')
-
 # On non-Windows/macOS systems we always required shared-mime-info and GIO
 # shared_mime_dep = []
 shared_mime_dep = []
@@ -211,10 +213,15 @@ if medialib_dep.found()
   endif
 endif
 
-gdk_pixbuf_deps = [ mathlib_dep, gobject_dep, gmodule_dep, gio_dep, shared_mime_dep, medialib_dep ]
+gdk_pixbuf_deps = [ mathlib_dep, glib_dep, gobject_dep, gmodule_dep, gio_dep,
+                    shared_mime_dep, medialib_dep ]
 
 # Check if we can build shared modules
-build_modules = gmodule_dep.get_pkgconfig_variable('gmodule_supported') == 'true'
+if gmodule_dep.type_name() == 'pkgconfig'
+  build_modules = gmodule_dep.get_pkgconfig_variable('gmodule_supported') == 'true'
+else
+  build_modules = subproject('glib').get_variable('g_module_impl') != '0'
+endif
 gdk_pixbuf_conf.set('USE_GMODULE', build_modules)
 
 # Check which loaders should be built into gdk-pixbuf
@@ -269,6 +276,16 @@ if get_option('png')
         endif
       endif
     endif
+
+    # Finally, look for the dependency in a fallback subproject if allowed by
+    # the --wrap-mode option. We don't directly call subproject() here because
+    # that will bypass --wrap-mode and cause issues for distro packagers.
+    # See: https://mesonbuild.com/Reference-manual.html#dependency
+    png_dep = dependency('', required: false, fallback: ['libpng', 'png_dep'])
+    if png_dep.found()
+      enabled_loaders += 'png'
+      loaders_deps += png_dep
+    endif
   endif
 endif
 


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