diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-11-30 16:32:21 +0530 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2019-02-28 16:41:04 +0000 |
commit | ec4790359b0ac0afdf1bb2cd8064266e9e2ec170 (patch) | |
tree | fb2efc93fbc45ccdd952ba83f062f1b134b5349d | |
parent | bf6452b804601f8af5d7994c6be8847ac64e9d83 (diff) | |
download | gdk-pixbuf-ec4790359b0ac0afdf1bb2cd8064266e9e2ec170.tar.gz |
meson: Add subproject fallbacks for all dependencies
This is needed to build gtk+ and all dependencies from scratch on
Windows with meson subprojects.
-rw-r--r-- | docs/meson.build | 6 | ||||
-rw-r--r-- | 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 |