summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/apps/application.vala4
l---------lib/apps/gir.py1
-rw-r--r--lib/apps/meson.build46
-rw-r--r--lib/gir.py26
-rw-r--r--lib/notifd/meson.build4
5 files changed, 56 insertions, 25 deletions
diff --git a/lib/apps/application.vala b/lib/apps/application.vala
index 7e20b06..ea22e7a 100644
--- a/lib/apps/application.vala
+++ b/lib/apps/application.vala
@@ -5,7 +5,7 @@ public class AstalApps.Application : Object {
public DesktopAppInfo app { get; construct set; }
/**
- * The number of times [[email protected]] was called on this Application.
+ * The number of times [[email protected]] was called on this Application.
*/
public int frequency { get; set; default = 0; }
@@ -32,7 +32,7 @@ public class AstalApps.Application : Object {
/**
* `Exec` field from the desktop file.
- * Note that if you want to launch this Application you should use the [[email protected]] method.
+ * Note that if you want to launch this Application you should use the [[email protected]] method.
*/
public string executable { owned get { return app.get_string("Exec"); } }
diff --git a/lib/apps/gir.py b/lib/apps/gir.py
new file mode 120000
index 0000000..b5b4f1d
--- /dev/null
+++ b/lib/apps/gir.py
@@ -0,0 +1 @@
+../gir.py \ No newline at end of file
diff --git a/lib/apps/meson.build b/lib/apps/meson.build
index b83b216..eb7a90b 100644
--- a/lib/apps/meson.build
+++ b/lib/apps/meson.build
@@ -39,35 +39,41 @@ deps = [
dependency('json-glib-1.0'),
]
-sources = [
- config,
- 'apps.vala',
+sources = [config] + files(
'application.vala',
+ 'apps.vala',
'cli.vala',
'fuzzy.vala',
-]
+)
if get_option('lib')
lib = library(
meson.project_name(),
sources,
dependencies: deps,
+ vala_args: ['--vapi-comments'],
vala_header: meson.project_name() + '.h',
vala_vapi: meson.project_name() + '-' + api_version + '.vapi',
- vala_gir: gir,
version: meson.project_version(),
install: true,
- install_dir: [true, true, true, true],
+ install_dir: [true, true, true],
)
- import('pkgconfig').generate(
- 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',
+ pkgs = []
+ foreach dep : deps
+ pkgs += ['--pkg=' + dep.name()]
+ endforeach
+
+ gir_tgt = custom_target(
+ gir,
+ command: [find_program('python3'), files('gir.py'), meson.project_name(), gir]
+ + pkgs
+ + sources,
+ input: sources,
+ depends: lib,
+ output: gir,
+ install: true,
+ install_dir: get_option('datadir') / 'gir-1.0',
)
custom_target(
@@ -80,10 +86,20 @@ if get_option('lib')
],
input: lib,
output: typelib,
- depends: lib,
+ depends: [lib, gir_tgt],
install: true,
install_dir: get_option('libdir') / 'girepository-1.0',
)
+
+ import('pkgconfig').generate(
+ 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',
+ )
endif
if get_option('cli')
diff --git a/lib/gir.py b/lib/gir.py
index 8ec786f..ccfbbc1 100644
--- a/lib/gir.py
+++ b/lib/gir.py
@@ -10,7 +10,7 @@ import sys
import subprocess
-def fix_gir(gir: str):
+def fix_gir(name: str, gir: str):
namespaces = {
"": "http://www.gtk.org/introspection/core/1.0",
"c": "http://www.gtk.org/introspection/c/1.0",
@@ -28,16 +28,28 @@ def fix_gir(gir: str):
html.unescape(doc.text).replace("<para>", "").replace("</para>", "")
)
+ if (inc := root.find("c:include", namespaces)) is not None:
+ inc.set("name", f"{name}.h")
+ else:
+ print("no c:include tag found", file=sys.stderr)
+ exit(1)
+
tree.write(gir, encoding="utf-8", xml_declaration=True)
-def valadoc(gir: str, args: list[str]):
- subprocess.run(["valadoc", "-o", "docs", "--gir", gir, *args])
+def valadoc(name: str, gir: str, args: list[str]):
+ cmd = ["valadoc", "-o", "docs", "--package-name", name, "--gir", gir, *args]
+ try:
+ subprocess.run(cmd, check=True, text=True, capture_output=True)
+ except subprocess.CalledProcessError as e:
+ print(e.stderr, file=sys.stderr)
+ exit(1)
if __name__ == "__main__":
- gir = sys.argv[1]
- args = sys.argv[2:]
+ name = sys.argv[1]
+ gir = sys.argv[2]
+ args = sys.argv[3:]
- valadoc(gir, args)
- fix_gir(gir)
+ valadoc(name, gir, args)
+ fix_gir(name, gir)
diff --git a/lib/notifd/meson.build b/lib/notifd/meson.build
index e09a371..3d4de95 100644
--- a/lib/notifd/meson.build
+++ b/lib/notifd/meson.build
@@ -68,7 +68,9 @@ if get_option('lib')
gir_tgt = custom_target(
gir,
- command: [find_program('python3'), files('gir.py'), gir] + pkgs + sources,
+ command: [find_program('python3'), files('gir.py'), meson.project_name(), gir]
+ + pkgs
+ + sources,
input: sources,
depends: lib,
output: gir,