[evince/wip/chpe/build-fixes-2: 6/6] build: Fix dependency tracking




commit 6c422905dd05fbe4924e0d60f88e12f06c88cccb
Author: Christian Persch <chpe src gnome org>
Date:   Wed Nov 17 00:41:59 2021 +0100

    build: Fix dependency tracking
    
    The executables must declare their dependency on
    libevdocument/libevview, so that a rebuild works correctly.

 libdocument/meson.build |  4 +--
 libview/meson.build     |  4 +--
 previewer/meson.build   | 27 +++++++++++---------
 shell/meson.build       | 66 +++++++++++++++++++------------------------------
 thumbnailer/meson.build | 16 ++++++++----
 5 files changed, 55 insertions(+), 62 deletions(-)
---
diff --git a/libdocument/meson.build b/libdocument/meson.build
index e09de7fcb..cb518af63 100644
--- a/libdocument/meson.build
+++ b/libdocument/meson.build
@@ -150,9 +150,9 @@ libevdocument = shared_library(
 )
 
 libevdocument_dep = declare_dependency(
-  sources: [enum_sources[1], version_header],
+  sources: headers + [enum_sources[1]] + [version_header],
   include_directories: libdocument_inc,
-  dependencies: common_deps,
+  dependencies: deps,
   link_with: libevdocument,
 )
 
diff --git a/libview/meson.build b/libview/meson.build
index 74c86d51d..78e722911 100644
--- a/libview/meson.build
+++ b/libview/meson.build
@@ -94,9 +94,9 @@ libevview = shared_library(
 )
 
 libevview_dep = declare_dependency(
-  sources: enum_sources[1],
+  sources: headers + [enum_sources[1]],
   include_directories: libview_inc,
-  dependencies: libevdocument_dep,
+  dependencies: deps,
   link_with: libevview,
 )
 
diff --git a/previewer/meson.build b/previewer/meson.build
index 38ae6680d..0bc3dd616 100644
--- a/previewer/meson.build
+++ b/previewer/meson.build
@@ -1,7 +1,9 @@
-sources = files(
-  'ev-previewer.c',
+previewer_sources = files(
   'ev-previewer-toolbar.c',
+  'ev-previewer-toolbar.h',
   'ev-previewer-window.c',
+  'ev-previewer-window.h',
+  'ev-previewer.c',
 )
 
 resource_data = files(
@@ -10,28 +12,29 @@ resource_data = files(
   'previewer.ui',
 )
 
-sources += gnome.compile_resources(
+previewer_sources += gnome.compile_resources(
   'ev-previewer-resources',
   'previewer.gresource.xml',
   source_dir: data_dir,
   c_name: 'ev_previewer',
   dependencies: resource_data,
-  export: true,
 )
 
-deps = [libevmisc_dep]
+previewer_deps = [
+  libevdocument_dep,
+  libevmisc_dep,
+  libevview_dep,
+]
 
 if enable_gtk_unix_print
-  deps += gtk_unix_print_dep
+  previewer_deps += gtk_unix_print_dep
 endif
 
-program = 'evince-previewer'
-
-executable(
-  program,
-  sources,
+previewer = executable(
+  'evince-previewer',
+  previewer_sources,
   include_directories: top_inc,
-  dependencies: deps,
+  dependencies: previewer_deps,
   link_args: common_ldflags,
   install: true,
 )
diff --git a/shell/meson.build b/shell/meson.build
index 7cbc48f2e..e517963b8 100644
--- a/shell/meson.build
+++ b/shell/meson.build
@@ -1,6 +1,4 @@
-shell_inc = include_directories('.')
-
-sources = files(
+evince_sources = files(
   'ev-annotation-properties-dialog.c',
   'ev-annotations-toolbar.c',
   'ev-application.c',
@@ -31,6 +29,7 @@ sources = files(
   'ev-sidebar-page.c',
   'ev-sidebar-thumbnails.c',
   'ev-zoom-action.c',
+  'main.c',
 )
 
 resource_data = files(
@@ -40,20 +39,21 @@ resource_data = files(
   'help-overlay.ui',
 )
 
-sources += gnome.compile_resources(
+evince_sources += gnome.compile_resources(
   'ev-resources',
   'evince.gresource.xml',
   source_dir: data_dir,
   c_name: ev_code_prefix.to_lower(),
   dependencies: resource_data,
-  export: true,
 )
 
-deps = [
+evince_deps = [
   gdk_pixbuf_dep,
   gnome_desktop_dep,
   hdy_dep,
   libevmisc_dep,
+  libevdocument_dep,
+  libevview_dep,
   libevproperties_dep,
   libdazzle_dep,
   libgd_dep,
@@ -61,7 +61,7 @@ deps = [
   m_dep,
 ]
 
-cflags = [
+evince_cflags = [
   '-DBINDIR="@0@"'.format(ev_bindir),
   '-DGNOMEDATADIR="@0@"'.format(ev_datadir),
   '-DEVINCE_COMPILATION',
@@ -69,27 +69,27 @@ cflags = [
   '-DGTK_MULTIHEAD_SAFE',
 ]
 
-ldflags = common_ldflags
+evince_ldflags = common_ldflags
 
 if ev_platform == 'win32'
   resource = 'evince-icon.o'
 
-  ldflag += custom_target(
+  evince_ldflag += custom_target(
     resource,
     input: 'evince-icon.rc',
     output: resource,
     command: [find_program('windres'), '@INPUT@', '-I', data_dir, '@OUTPUT@'],
   )
 else
-  deps += adwaita_icon_theme_dep
+  evince_deps += adwaita_icon_theme_dep
 endif
 
 if enable_dbus
-  sources += files('ev-media-player-keys.c')
+  evince_sources += files('ev-media-player-keys.c')
 
   gdbus = 'ev-gdbus'
 
-  sources += gnome.gdbus_codegen(
+  evince_sources += gnome.gdbus_codegen(
     gdbus + '-generated',
     gdbus + '.xml',
     interface_prefix: ev_namespace,
@@ -100,43 +100,27 @@ if enable_dbus
 endif
 
 if enable_keyring
-  deps += libsecret_dep
+  evince_deps += libsecret_dep
 endif
 
-libshell = shared_library(
-  'shell' + ev_major_version.to_string(),
-  version: ev_view_version,
-  sources: sources,
-  include_directories: top_inc,
-  dependencies: deps,
-  c_args: cflags,
-)
-
-libshell_dep = declare_dependency(
-  include_directories: shell_inc,
-  link_with: libshell,
-)
-
-executable(
+evince = executable(
   'evince',
-  'main.c',
+  sources: evince_sources,
   include_directories: top_inc,
-  dependencies: deps,
-  c_args: cflags,
-  objects: libshell.extract_all_objects(),
-  link_args: ldflags,
+  dependencies: evince_deps,
+  c_args: evince_cflags,
   install: true,
 )
 
 if enable_dbus
-  sources = files('ev-daemon.c')
+  evinced_sources = files('ev-daemon.c')
 
   gdbus = 'ev-daemon-gdbus'
 
   # The D-Bus interface names are in lowercase, which does not match
   # the application name nor the namespace. However, we keep the
   # interface prefix in lowercase for backward compatibility.
-  sources += gnome.gdbus_codegen(
+  evinced_sources += gnome.gdbus_codegen(
     gdbus + '-generated',
     gdbus + '.xml',
     interface_prefix: ev_namespace.to_lower(),
@@ -145,22 +129,22 @@ if enable_dbus
     autocleanup: 'objects',
   )
 
-  deps = [
+  evinced_deps = [
     gio_dep,
     gio_unix_dep,
   ]
 
-  cflags = [
+  evinced_cflags = [
     '-DBINDIR="@0@"'.format(ev_bindir),
     '-DEVINCE_COMPILATION',
   ]
 
-  executable(
+  evinced = executable(
     'evinced',
-    sources,
+    evinced_sources,
     include_directories: top_inc,
-    dependencies: deps,
-    c_args: cflags,
+    dependencies: evinced_deps,
+    c_args: evinced_cflags,
     install: true,
     install_dir: ev_libexecdir,
   )
diff --git a/thumbnailer/meson.build b/thumbnailer/meson.build
index 12d8ecd83..9e884f38e 100644
--- a/thumbnailer/meson.build
+++ b/thumbnailer/meson.build
@@ -8,13 +8,19 @@ configure_file(
   install_dir: join_paths(ev_datadir, 'thumbnailers'),
 )
 
-program = 'evince-thumbnailer'
+thumbnailer_sources = files(
+  'evince-thumbnailer.c',
+)
+
+thumbnailer_deps = [
+  libevdocument_dep,
+]
 
-executable(
-  program,
-  program + '.c',
+thumbnailer = executable(
+  'evince-thumbnailer',
+  sources: thumbnailer_sources,
   include_directories: top_inc,
-  dependencies: libevdocument_dep,
+  dependencies: thumbnailer_deps,
   link_args: common_ldflags,
   install: true,
 )


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