[json-glib] build: Add the API reference to the dist archive



commit 77770fc807d47cfcf3de28635d4c96b3fc35180c
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Aug 23 22:08:49 2021 +0100

    build: Add the API reference to the dist archive
    
    We can use a dist script to include the generated documentation into the
    dist archive, as well as including gi-docgen.

 build-aux/dist-docs.py | 22 ++++++++++++++++++++++
 meson.build            |  4 ++++
 2 files changed, 26 insertions(+)
---
diff --git a/build-aux/dist-docs.py b/build-aux/dist-docs.py
new file mode 100644
index 0000000..7bd71c6
--- /dev/null
+++ b/build-aux/dist-docs.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+
+from pathlib import PurePath
+
+
+references = [
+    'docs/json-glib/json-glib-1.0',
+]
+
+sourceroot = os.environ.get('MESON_SOURCE_ROOT')
+buildroot = os.environ.get('MESON_BUILD_ROOT')
+distroot = os.environ.get('MESON_DIST_ROOT')
+
+for reference in references:
+    src_path = os.path.join(buildroot, reference)
+    if os.path.isdir(src_path):
+        dst_path = os.path.join(distroot, reference)
+        shutil.copytree(src_path, dst_path)
diff --git a/meson.build b/meson.build
index e1914e2..fd51588 100644
--- a/meson.build
+++ b/meson.build
@@ -155,6 +155,10 @@ subdir('json-glib')
 subdir('po')
 subdir('doc')
 
+if not meson.is_subproject()
+    meson.add_dist_script('build-aux/dist-docs.py')
+endif
+
 summary({
     'prefix': get_option('prefix'),
     'includedir': json_includedir,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]