[eog] build: Improve dependency handling



commit d1984b0ee8a98dccfab0cd8c70f40e5ed64b7c74
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Feb 27 09:48:12 2018 +0100

    build: Improve dependency handling
    
    There are a set of dependencies which are used for building the
    shared libraries and another set for those using the library.
    
    This two sets has been split and a new set has been created with
    common dependencies.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=793719

 meson.build     |   41 +++++++++++++++++++++--------------------
 src/meson.build |   26 +++++++++++++++++++++++---
 2 files changed, 44 insertions(+), 23 deletions(-)
---
diff --git a/meson.build b/meson.build
index 015e220..da6bbbf 100644
--- a/meson.build
+++ b/meson.build
@@ -88,18 +88,20 @@ have_version_script = host_machine.system().contains('linux') and cc.has_argumen
 glib_req_version = '>= 2.53.4'
 peas_req_version = '>= 0.7.4'
 
-eog_deps = [
-  dependency('gtk+-3.0', version: '>= 3.22.0'),
-  dependency('glib-2.0', version: glib_req_version),
-  dependency('gio-2.0', version: glib_req_version),
-  dependency('gio-unix-2.0', version: glib_req_version),
-  dependency('gnome-desktop-3.0', version: '>= 2.91.2'),
+gio_unix_dep = dependency('gio-unix-2.0', version: glib_req_version)
+gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 2.91.2')
+libpeas_gtk_dep = dependency('libpeas-gtk-1.0', version: peas_req_version)
+
+# runtime dependencies
+dependency('gsettings-desktop-schemas', version: '>= 2.91.92')
+dependency('shared-mime-info', version: '>= 0.20')
+
+common_deps = [
   dependency('gdk-pixbuf-2.0', version: '>= 2.36.5'),
-  dependency('shared-mime-info', version: '>= 0.20'),
-  dependency('gsettings-desktop-schemas', version: '>= 2.91.92'),
-  dependency('libpeas-1.0', version: peas_req_version),
-  dependency('libpeas-gtk-1.0', version: peas_req_version),
-  cc.find_library('m')
+  dependency('gio-2.0', version: glib_req_version),
+  dependency('glib-2.0', version: glib_req_version),
+  dependency('gtk+-3.0', version: '>= 3.22.0'),
+  dependency('libpeas-1.0', version: peas_req_version)
 ]
 
 # ZLIB support (required)
@@ -107,8 +109,6 @@ if not cc.has_header('zlib.h') or not (cc.has_function('inflate') and cc.has_fun
   zlib_dep = cc.find_library('z', required: false)
   assert(zlib_dep.found() and cc.has_function('inflate', dependencies: zlib_dep) and 
cc.has_function('crc32', dependencies: zlib_dep),
          'No sufficient zlib library found on your system')
-
-  eog_deps += zlib_dep
 endif
 
 # EXIF (optional)
@@ -118,21 +118,21 @@ if enable_libexif
   assert(libexif_dep.found() and cc.has_header('libexif/exif-data.h', dependencies: libexif_dep),
          'libexif support requested but library not found. Please use -Dlibexif=false')
 
-  eog_deps += libexif_dep
+  common_deps += libexif_dep
   config_h.set10('HAVE_EXIF', true)
 endif
 
 # Little CMS (optional)
 enable_cms = get_option('cms')
 if enable_cms
-  eog_deps += dependency('lcms2')
+  common_deps += dependency('lcms2')
   config_h.set10('HAVE_LCMS', true)
 endif
 
 # Exempi (optional)
 enable_xmp = get_option('xmp')
 if enable_xmp
-  eog_deps += dependency('exempi-2.0', version: '>= 1.99.5')
+  common_deps += dependency('exempi-2.0', version: '>= 1.99.5')
   config_h.set10('HAVE_EXEMPI', true)
 endif
 
@@ -163,22 +163,23 @@ config_h.set('HAVE_LIBJPEG', enable_libjpeg)
 # introspection support
 enable_introspection = get_option('introspection')
 if enable_introspection
-  eog_deps += dependency('gobject-introspection-1.0', version: '>= 0.6.7')
+  gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7')
 endif
 config_h.set('HAVE_INTROSPECTION', enable_introspection)
 
 # RSVG (optional for scaling svg image)
 enable_librsvg = get_option('librsvg')
 if enable_librsvg
-  eog_deps += dependency('librsvg-2.0', version: '>= 2.36.2')
+  common_deps += dependency('librsvg-2.0', version: '>= 2.36.2')
 endif
 config_h.set('HAVE_RSVG', enable_librsvg)
 
 # libX11 (required for TotemScrSaver and Color Profiling)
 gdk_dep = dependency('gdk-3.0', required: false)
 
-if enable_cms or (gdk_dep.found() and gdk_dep.get_pkgconfig_variable('targets').contains('x11'))
-  eog_deps += dependency('x11')
+enable_x11 = enable_cms or (gdk_dep.found() and gdk_dep.get_pkgconfig_variable('targets').contains('x11'))
+if enable_x11
+  x11_dep = dependency('x11')
 endif
 
 gnome = import('gnome')
diff --git a/src/meson.build b/src/meson.build
index c61d623..d18a8ab 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -129,7 +129,13 @@ sources += gnome.genmarshal(
   internal: true
 )
 
-deps = eog_deps
+deps = common_deps + [
+  gio_unix_dep,
+  gnome_desktop_dep,
+  libpeas_gtk_dep,
+  zlib_dep,
+  cc.find_library('m')
+]
 
 libeog_cflags = cflags + [
   '-DEOG_PLUGIN_DIR="@0@"'.format(eog_pluginsdir),
@@ -145,10 +151,18 @@ if have_version_script
   ldflags += '-Wl,--version-script,@0@'.format(symbol_map)
 endif
 
+if enable_introspection
+  deps += gir_dep
+endif
+
 if enable_libjpeg
   deps += libjpegutils_dep
 endif
 
+if enable_x11
+  deps += x11_dep
+endif
+
 libeog = shared_library(
   meson.project_name(),
   sources: sources,
@@ -164,7 +178,7 @@ libeog = shared_library(
 libeog_dep = declare_dependency(
   link_with: libeog,
   include_directories: src_inc,
-  dependencies: eog_deps
+  dependencies: common_deps
 )
 
 pkg.generate(
@@ -181,11 +195,17 @@ pkg.generate(
   ]
 )
 
+deps = [libeog_dep]
+
+if enable_introspection
+  deps += gir_dep
+endif
+
 eog = executable(
   meson.project_name(),
   'main.c',
   include_directories: top_inc,
-  dependencies: libeog_dep,
+  dependencies: deps,
   c_args: cflags,
   install: true,
   install_rpath: eog_pkglibdir


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