From fda2fbd33084a388effc844ab73fd4f2c297efb1 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 5 Mar 2020 15:44:46 +0000 Subject: [PATCH 1/2] build: Add -Dui option to Meson MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the UI components (libmalcontent-ui and malcontent-control) to be disabled in the build so that a dependency cycle with flatpak can be avoided (by building malcontent twice, once with `-Dui=disabled` and then again with `-Dui=enabled`). The dependency graph is: malcontent-control → libmalcontent-ui → flatpak → libmalcontent which becomes cyclic if libmalcontent-ui and libmalcontent can only be built at the same time. Signed-off-by: Philip Withnall Fixes: #16 --- meson.build | 8 ++++++-- meson_options.txt | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 8ef161a..bb9091b 100644 --- a/meson.build +++ b/meson.build @@ -127,9 +127,13 @@ test_env = [ subdir('accounts-service') subdir('libmalcontent') -subdir('libmalcontent-ui') +if get_option('ui').enabled() + subdir('libmalcontent-ui') +endif subdir('malcontent-client') -subdir('malcontent-control') +if get_option('ui').enabled() + subdir('malcontent-control') +endif subdir('pam') subdir('po') diff --git a/meson_options.txt b/meson_options.txt index 06329d4..9d32658 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -9,3 +9,9 @@ option( type: 'string', description: 'directory for PAM modules' ) +option( + 'ui', + type: 'feature', + value: 'enabled', + description: 'enable UI library' +) From 6125cc3a852680c086a1b962a8c795152ce6a80a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 5 Mar 2020 22:02:43 +0000 Subject: [PATCH 2/2] build: Add an option to build against libmalcontent from the system Rather than building it again; this is the second half of resolving the dependency cycle from the previous commit. Signed-off-by: Philip Withnall Fixes: #16 --- meson.build | 9 ++++++++- meson_options.txt | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index bb9091b..9b2d44b 100644 --- a/meson.build +++ b/meson.build @@ -126,7 +126,14 @@ test_env = [ ] subdir('accounts-service') -subdir('libmalcontent') +if not get_option('use_system_libmalcontent') + subdir('libmalcontent') +else + libmalcontent_api_version = '0' + libmalcontent_dep = dependency('malcontent-' + libmalcontent_api_version, version: meson.project_version()) + libmalcontent_gir = ['Malcontent-' + libmalcontent_api_version, + 'Malcontent-' + libmalcontent_api_version + '.typelib'] +endif if get_option('ui').enabled() subdir('libmalcontent-ui') endif diff --git a/meson_options.txt b/meson_options.txt index 9d32658..d516c70 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -15,3 +15,9 @@ option( value: 'enabled', description: 'enable UI library' ) +option( + 'use_system_libmalcontent', + type: 'boolean', + value: false, + description: 'use installed libmalcontent rather than building it; used in distros to break a dependency cycle' +)