summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-05-22 00:14:54 +0200
committerAylur <[email protected]>2024-05-22 00:14:54 +0200
commit2f8354f13466bcccb031953923b91918e6cacc97 (patch)
tree9b1f597c6db30c376e3b72fa0f2f922b49201e51
parentf81468a398a0b1363b77d1052498554f7bd2682a (diff)
update meson format
-rw-r--r--flake.lock6
-rw-r--r--meson.build5
-rw-r--r--meson_options.txt13
-rw-r--r--src/astal.vala6
-rw-r--r--src/cli.vala (renamed from src/client.vala.in)0
-rw-r--r--src/config.vala.in6
-rw-r--r--src/meson.build86
7 files changed, 73 insertions, 49 deletions
diff --git a/flake.lock b/flake.lock
index df4c399..e6e6355 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
- "lastModified": 1715266358,
- "narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=",
+ "lastModified": 1716293225,
+ "narHash": "sha256-pU9ViBVE3XYb70xZx+jK6SEVphvt7xMTbm6yDIF4xPs=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "f1010e0469db743d14519a1efd37e23f8513d714",
+ "rev": "3eaeaeb6b1e08a016380c279f8846e0bd8808916",
"type": "github"
},
"original": {
diff --git a/meson.build b/meson.build
index 63de369..e5be5e2 100644
--- a/meson.build
+++ b/meson.build
@@ -14,4 +14,9 @@ project(
# math
add_project_arguments(['-X', '-lm'], language: 'vala')
+assert(
+ get_option('lib') or get_option('cli'),
+ 'Either lib or cli option must be set to true.',
+)
+
subdir('src')
diff --git a/meson_options.txt b/meson_options.txt
index 8eff355..f110242 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,11 @@
-option('typelib', type: 'boolean', value: true, description: 'Needed files for runtime bindings')
-option('cli_client', type: 'boolean', value: true, description: 'Minimal cli client for Astal applications')
+option(
+ 'lib',
+ type: 'boolean',
+ value: true,
+)
+
+option(
+ 'cli',
+ type: 'boolean',
+ value: true,
+)
diff --git a/src/astal.vala b/src/astal.vala
index e9d1484..fe6558c 100644
--- a/src/astal.vala
+++ b/src/astal.vala
@@ -97,14 +97,13 @@ public class Application : Gtk.Application {
}
try {
- SocketAddress _;
service = new SocketService();
service.add_address(
new UnixSocketAddress(socket),
SocketType.STREAM,
SocketProtocol.DEFAULT,
null,
- out _);
+ null);
service.incoming.connect((conn) => {
_socket_request.begin(conn);
@@ -151,8 +150,7 @@ public errordomain WindowError {
public async string read_sock(SocketConnection conn) {
try {
var stream = new DataInputStream(conn.input_stream);
- size_t size;
- return yield stream.read_upto_async("\x04", -1, Priority.DEFAULT, null, out size);
+ return yield stream.read_upto_async("\x04", -1, Priority.DEFAULT, null, null);
} catch (Error err) {
critical(err.message);
return err.message;
diff --git a/src/client.vala.in b/src/cli.vala
index 82a99a4..82a99a4 100644
--- a/src/client.vala.in
+++ b/src/cli.vala
diff --git a/src/config.vala.in b/src/config.vala.in
new file mode 100644
index 0000000..88bfe9c
--- /dev/null
+++ b/src/config.vala.in
@@ -0,0 +1,6 @@
+namespace Astal {
+ public const int MAJOR_VERSION = @MAJOR_VERSION@;
+ public const int MINOR_VERSION = @MINOR_VERSION@;
+ public const int MICRO_VERSION = @MICRO_VERSION@;
+ public const string VERSION = "@VERSION@";
+}
diff --git a/src/meson.build b/src/meson.build
index 2227075..f6b0db0 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]
-astal_gir = 'Astal-' + api_version + '.gir'
-astal_typelib = 'Astal-' + api_version + '.typelib'
-astal_so = 'libastal.so.' + meson.project_version()
+gir = 'Astal-' + api_version + '.gir'
+typelib = 'Astal-' + api_version + '.typelib'
+so = 'libastal.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'),
@@ -14,7 +25,8 @@ deps = [
dependency('gtk-layer-shell-0'),
]
-sources = files(
+sources = [
+ config,
'widget/box.vala',
'widget/button.vala',
'widget/centerbox.vala',
@@ -27,58 +39,52 @@ sources = files(
'process.vala',
'time.vala',
'variable.vala',
-)
+]
-libastal = library(
- meson.project_name(),
- sources,
- dependencies: deps,
- vala_header: meson.project_name() + '.h',
- vala_vapi: meson.project_name() + '.vapi',
- vala_gir: astal_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',
- libraries: libastal,
- 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(
- astal_typelib,
+ typelib,
command: [
find_program('g-ir-compiler'),
'--output', '@OUTPUT@',
'--shared-library', get_option('prefix') / get_option('libdir') / '@PLAINNAME@',
- meson.current_build_dir() / astal_gir,
+ meson.current_build_dir() / gir,
],
- input: libastal,
- output: astal_typelib,
- depends: libastal,
+ input: lib,
+ output: typelib,
+ depends: lib,
install: true,
install_dir: get_option('libdir') / 'girepository-1.0',
)
endif
-if get_option('cli_client')
+if get_option('cli')
executable(
meson.project_name(),
- configure_file(
- input: 'client.vala.in',
- output: 'client.vala',
- configuration: {
- 'VERSION': meson.project_version(),
- },
- ),
+ ['cli.vala', sources],
dependencies: deps,
install: true,
)