Commit ec479035 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan Committed by Emmanuele Bassi

meson: Add subproject fallbacks for all dependencies

This is needed to build gtk+ and all dependencies from scratch on
Windows with meson subprojects.
parent bf6452b8
......@@ -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')
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment