diff options
author | Aylur <[email protected]> | 2024-05-22 00:06:27 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-05-22 00:06:27 +0200 |
commit | cf9125cf31fb5b58be273395726c21041517d64f (patch) | |
tree | 4476119fa5be377b585bd86d46f9d98493924f99 /src | |
parent | 81c4e3a12d05a3550f1d8c942f0d919b4688c3bc (diff) |
refactor meson
into a reusable format that can easily be copied
Diffstat (limited to 'src')
-rw-r--r-- | src/cli.vala (renamed from src/cli.vala.in) | 4 | ||||
-rw-r--r-- | src/config.vala.in | 6 | ||||
-rw-r--r-- | src/meson.build | 89 | ||||
-rw-r--r-- | src/proxy.vala | 1 |
4 files changed, 55 insertions, 45 deletions
diff --git a/src/cli.vala.in b/src/cli.vala index f49a056..e9001f5 100644 --- a/src/cli.vala.in +++ b/src/cli.vala @@ -6,7 +6,7 @@ static string invoke; static int close_n; static int get_n; -private const OptionEntry[] options = { +const OptionEntry[] options = { { "version", 'v', OptionFlags.NONE, OptionArg.NONE, ref version, null, null }, { "help", 'h', OptionFlags.NONE, OptionArg.NONE, ref help, null, null }, { "daemon", 'd', OptionFlags.NONE, OptionArg.NONE, ref daemonize, null, null }, @@ -48,7 +48,7 @@ int main(string[] argv) { var notifd = new AstalNotifd.Notifd(); if (version) { - print("@VERSION@"); + print(AstalNotifd.VERSION); return 0; } diff --git a/src/config.vala.in b/src/config.vala.in new file mode 100644 index 0000000..7db3963 --- /dev/null +++ b/src/config.vala.in @@ -0,0 +1,6 @@ +namespace AstalNotifd { + const int MAJOR_VERSION = @MAJOR_VERSION@; + const int MINOR_VERSION = @MINOR_VERSION@; + const int MICRO_VERSION = @MICRO_VERSION@; + const string VERSION = "@VERSION@"; +} diff --git a/src/meson.build b/src/meson.build index e965647..b1d326c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,8 +1,19 @@ version_split = meson.project_version().split('.') api_version = version_split[0] + '.' + version_split[1] -notifd_gir = 'AstalNotifd-' + api_version + '.gir' -notifd_typelib = 'AstalNotifd-' + api_version + '.typelib' -notifd_so = 'libastal-notifd.so.' + meson.project_version() +gir = 'AstalNotifd-' + api_version + '.gir' +typelib = 'AstalNotifd-' + api_version + '.typelib' +so = 'libastal-notifd.so.' + meson.project_version() + +config = configure_file( + input: 'config.vala.in', + output: 'config.vala', + configuration: { + 'VERSION': meson.project_version(), + 'MAJOR_VERSION': version_split[0], + 'MINOR_VERSION': version_split[1], + 'MICRO_VERSION': version_split[2], + }, +) deps = [ dependency('glib-2.0'), @@ -12,64 +23,58 @@ deps = [ dependency('gdk-pixbuf-2.0'), ] -sources = files( +sources = [ + config, 'daemon.vala', 'notifd.vala', - 'proxy.vala', 'notification.vala', -) + 'proxy.vala', +] -libnotifd = library( - meson.project_name(), - sources, - dependencies: deps, - vala_header: meson.project_name() + '.h', - vala_vapi: meson.project_name() + '.vapi', - vala_gir: notifd_gir, - version: meson.project_version(), - install: true, - install_dir: [true, true, true, true], -) +if get_option('lib') + lib = library( + meson.project_name(), + sources, + dependencies: deps, + vala_header: meson.project_name() + '.h', + vala_vapi: meson.project_name() + '.vapi', + vala_gir: gir, + version: meson.project_version(), + install: true, + install_dir: [true, true, true, true], + ) -import('pkgconfig').generate( - description: 'libastal-notifd', - libraries: libnotifd, - name: meson.project_name(), - filebase: meson.project_name() + '-' + api_version, - version: meson.project_version(), - subdirs: meson.project_name(), - requires: 'gio-2.0', - install_dir: get_option('libdir') / 'pkgconfig', -) + import('pkgconfig').generate( + description: 'libastal-notifd', + libraries: lib, + name: meson.project_name(), + filebase: meson.project_name() + '-' + api_version, + version: meson.project_version(), + subdirs: meson.project_name(), + requires: deps, + install_dir: get_option('libdir') / 'pkgconfig', + ) -if get_option('typelib') custom_target( - notifd_typelib, + typelib, command: [ find_program('g-ir-compiler'), '--output', '@OUTPUT@', '--shared-library', get_option('prefix') / get_option('libdir') / '@PLAINNAME@', - meson.current_build_dir() / notifd_gir, + meson.current_build_dir() / gir, ], - input: libnotifd, - output: notifd_typelib, - depends: libnotifd, + input: lib, + output: typelib, + depends: lib, install: true, install_dir: get_option('libdir') / 'girepository-1.0', ) endif -if get_option('cli_client') - cli = configure_file( - input: 'cli.vala.in', - output: 'cli.vala', - configuration: { - 'VERSION': meson.project_version(), - }, - ) +if get_option('cli') executable( meson.project_name(), - [cli, sources], + ['cli.vala', sources], dependencies: deps, install: true, ) diff --git a/src/proxy.vala b/src/proxy.vala index 1f5870d..b5686fe 100644 --- a/src/proxy.vala +++ b/src/proxy.vala @@ -9,7 +9,6 @@ internal interface IDaemon : Object { public signal void notified(uint id); public signal void resolved(uint id, ClosedReason reason); - public signal void action_invoked(uint id, string action); public abstract void emit_notified(uint id); public abstract void emit_resolved(uint id, ClosedReason reason); |