mirror of
https://github.com/zoriya/astal.git
synced 2026-06-02 18:20:48 +00:00
refactor meson
into a reusable format that can easily be copied
This commit is contained in:
Generated
+3
-3
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1715961556,
|
||||
"narHash": "sha256-+NpbZRCRisUHKQJZF3CT+xn14ZZQO+KjxIIanH3Pvn4=",
|
||||
"lastModified": 1716137900,
|
||||
"narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4a6b83b05df1a8bd7d99095ec4b4d271f2956b64",
|
||||
"rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -11,4 +11,9 @@ project(
|
||||
],
|
||||
)
|
||||
|
||||
assert(
|
||||
get_option('lib') or get_option('cli'),
|
||||
'Either lib or cli option must be set to true.',
|
||||
)
|
||||
|
||||
subdir('src')
|
||||
|
||||
+11
-2
@@ -1,2 +1,11 @@
|
||||
option('typelib', type: 'boolean', value: true, description: 'Needed files for runtime bindings')
|
||||
option('cli_client', type: 'boolean', value: true, description: 'cli client for notifd')
|
||||
option(
|
||||
'lib',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
)
|
||||
|
||||
option(
|
||||
'cli',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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@";
|
||||
}
|
||||
+47
-42
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user