]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: generate alsatimer library
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 9 Feb 2020 03:20:53 +0000 (12:20 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 11 Feb 2020 04:28:18 +0000 (13:28 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/meson.build
src/timer/alsatimer.map [new file with mode: 0644]
src/timer/meson.build [new file with mode: 0644]

index 058c71cb906a4a637aa7f40fb69c6a69cb2d3d5a..d81a3f28c136e9ef0fedaa8b18d0f7d7c0d8201d 100644 (file)
@@ -1 +1,2 @@
 subdir('ctl')
+subdir('timer')
diff --git a/src/timer/alsatimer.map b/src/timer/alsatimer.map
new file mode 100644 (file)
index 0000000..72ece8a
--- /dev/null
@@ -0,0 +1,4 @@
+ALSA_GOBJECT_0_0_0 {
+  local:
+    *;
+};
diff --git a/src/timer/meson.build b/src/timer/meson.build
new file mode 100644 (file)
index 0000000..3061201
--- /dev/null
@@ -0,0 +1,109 @@
+#
+# Metadata part.
+#
+
+path = 'timer'
+name = 'alsatimer'
+namespace = 'ALSATimer'
+has_enumerations = false
+has_marshaller = false
+
+sources = files()
+
+headers = files()
+
+privates = files()
+
+#
+# Common part except for identifier of dependency.
+#
+
+# Depends on glib-2.0 and gobject-2.0
+gobject = dependency('gobject-2.0',
+  version: '>=2.34.0'
+)
+
+libudev = dependency('libudev')
+
+dependencies = [
+  gobject,
+  libudev,
+]
+
+# Generate enumerations for GObject fashion.
+if has_enumerations
+  enum_header = '@0@-enum-types.h'.format(name)
+  enums = gnome.mkenums_simple('@0@-enums'.format(name),
+    sources: enum_header,
+    symbol_prefix: name,
+    identifier_prefix: namespace,
+    install_header: true,
+    install_dir: join_paths(get_option('includedir'), meson.project_name(), path),
+    header_prefix: '#include <@0@-enum-types.h>'.format(join_paths(path, name)),
+  )
+  sources += enums
+  headers += enum_header
+endif
+
+# Generate marshallers for GObject signals.
+if has_marshaller
+  signal_marshallers = gnome.genmarshal('@0@-sigs-marshal'.format(name),
+    prefix: '@0@_sigs_marshal'.format(name),
+    sources: '@0@-sigs-marshal.list'.format(name),
+    stdinc: true,
+    install_header: true,
+    install_dir: join_paths(get_option('includedir'), meson.project_name(), path),
+  )
+  sources += signal_marshallers
+endif
+
+# Constrain public APIs by linker option.
+mapfile_name = '@0@.map'.format(name)
+mapfile_path = join_paths(meson.current_source_dir(), mapfile_name)
+linker_flag = '-Wl,--version-script,@0@'.format(mapfile_path)
+
+library = library(name,
+  sources: sources + headers + privates,
+  version: meson.project_version(),
+  soversion: meson.project_version().split('.')[0],
+  install: true,
+  dependencies: dependencies,
+  link_args : linker_flag,
+  link_depends : mapfile_name,
+  include_directories: include_directories('..'),
+)
+
+install_headers(headers,
+  subdir: join_paths(meson.project_name(), path),
+)
+
+# Generate pkg-config file for development.
+pkg = import('pkgconfig')
+pkg.generate(library,
+  name: name,
+  description: 'GObject instrospection library with API for asound.h and asequencer.h',
+  subdirs: meson.project_name(),
+)
+
+# Generate metadata for gobject introspection.
+gnome.generate_gir(library,
+  sources: sources + headers,
+  nsversion: '0.0',
+  namespace: namespace,
+  symbol_prefix: '@0@_'.format(name),
+  identifier_prefix: namespace,
+  export_packages: name,
+  dependencies: dependencies,
+  includes: [
+    'GLib-2.0',
+    'GObject-2.0',
+  ],
+  install: true,
+)
+
+# For documentation of gtk-doc.
+alsatimer_dir = include_directories('.')
+alsatimer_dependency = declare_dependency(
+  link_with: library,
+  dependencies: dependencies,
+)