aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2023-10-03 08:17:35 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2023-10-03 21:18:47 +0900
commit7b84fdf6ea53848b7c466903ea003eacd2e7343b (patch)
tree064e815889983dccbca42c672587830c81802b65
parentb35ab4513d804ac99b2b7fd67d940dd474fef774 (diff)
downloadlibhinoko-7b84fdf6ea53848b7c466903ea003eacd2e7343b.tar.gz
meson: subproject support
Current declaration in meson files does not allow user applications to use libhinawa by meson subproject. This is inconvenient. This commit declares libhinawa dependency for exposing purpose. The dependency is available by meson wrap in subproject. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--README.rst35
-rw-r--r--doc/meson.build8
-rw-r--r--meson.build5
-rw-r--r--src/hinoko.h2
-rw-r--r--src/meson.build8
-rw-r--r--tests/meson.build12
6 files changed, 65 insertions, 5 deletions
diff --git a/README.rst b/README.rst
index ae71c55..8f46a3e 100644
--- a/README.rst
+++ b/README.rst
@@ -2,7 +2,7 @@
The libhinoko project
=====================
-2023/07/17
+2023/10/01
Takashi Sakamoto
Introduction
@@ -90,6 +90,39 @@ Supplemental information for language bindings
* `hinoko-rs <https://git.kernel.org/pub/scm/libs/ieee1394/hinoko-rs.git/>`_ includes crates to
use these libraries.
+Meson subproject
+================
+
+This is a sample of wrap file to satisfy dependency on libhinoko by
+`Meson subprojects <https://mesonbuild.com/Subprojects.html>`_.
+
+::
+
+ $ cat subproject/hinoko.wrap
+ [wrap-git]
+ directory = hinoko
+ url = https://git.kernel.org/pub/scm/libs/ieee1394/libhinoko.git
+ revision = v0.9.0
+ depth = 1
+
+ [provide]
+ hinoko = hinoko_dep
+
+After installation of the wrap file, the dependency can be solved by ``hinoko`` name since it is
+common in both pkg-config and the wrap file. The implicit or explicit fallback to subproject is
+available.
+
+::
+
+ $ cat meson.build
+ hinoko_dependency = dependency('hinoko',
+ version: '>=0.9.0'
+ )
+
+In the case of subproject, the wrap file for ``hinawa`` should be installed as well, since
+``hinoko`` depends on it. For ``hinawa.wrap``, please refer to README of
+[libhinawa](https://git.kernel.org/pub/scm/libs/ieee1394/libhinawa.git/).
+
Loss of backward compatibility between v0.8/v0.9 releases
=========================================================
diff --git a/doc/meson.build b/doc/meson.build
index 39cc5b9..4de409a 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -18,6 +18,11 @@ dependency('gi-docgen',
)
gidocgen = find_program('gi-docgen')
+subproject_dependent_args = []
+if hinawa_is_subproject
+ subproject_dependent_args = ['--add-include-path', hinawa_gir_dir]
+endif
+
doc_dir = meson.project_name()
custom_target('hinoko-doc',
@@ -26,13 +31,14 @@ custom_target('hinoko-doc',
command: [
gidocgen,
'generate',
+ subproject_dependent_args,
'--no-namespace-dir',
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
- depend_files: [ ext_contents ],
+ depend_files: ext_contents,
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc'),
diff --git a/meson.build b/meson.build
index da2355a..12f3ecf 100644
--- a/meson.build
+++ b/meson.build
@@ -13,6 +13,11 @@ hinawa_dependency = dependency('hinawa',
version: '>=2.6.0'
)
+hinawa_is_subproject = hinawa_dependency.type_name() != 'pkgconfig'
+if hinawa_is_subproject
+ hinawa_gir_dir = join_paths(meson.build_root(), 'subprojects', 'libhinawa', 'src')
+endif
+
subdir('src')
subdir('tests')
diff --git a/src/hinoko.h b/src/hinoko.h
index 045b825..529ef41 100644
--- a/src/hinoko.h
+++ b/src/hinoko.h
@@ -8,7 +8,7 @@
#include <linux/firewire-cdev.h>
#include <linux/firewire-constants.h>
-#include <libhinawa/hinawa.h>
+#include <hinawa.h>
#include <hinoko_sigs_marshal.h>
diff --git a/src/meson.build b/src/meson.build
index 6efcb7f..804df57 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -101,3 +101,11 @@ hinoko_gir = gnome.generate_gir(myself,
# For test.
builddir = meson.current_build_dir()
+
+# For wrap dependency system.
+hinoko_dep = declare_dependency(
+ link_with: myself,
+ dependencies: dependencies,
+ sources: headers + marshallers + enums + hinoko_gir,
+ include_directories: include_directories('.')
+)
diff --git a/tests/meson.build b/tests/meson.build
index af32b19..0f399e3 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -10,9 +10,16 @@ tests = [
'hinoko-functions',
]
+ld_library_paths = [builddir]
+gi_typelib_path = [builddir]
+if hinawa_is_subproject
+ ld_library_paths += hinawa_gir_dir
+ gi_typelib_path += hinawa_gir_dir
+endif
+
envs = environment()
-envs.append('LD_LIBRARY_PATH', builddir, separator : ':')
-envs.append('GI_TYPELIB_PATH', builddir, separator : ':')
+envs.append('LD_LIBRARY_PATH', ld_library_paths, separator : ':')
+envs.append('GI_TYPELIB_PATH', gi_typelib_path, separator : ':')
foreach test : tests
name = test
@@ -20,5 +27,6 @@ foreach test : tests
prog = find_program(script)
test(name, prog,
env: envs,
+ depends: hinoko_gir,
)
endforeach