[tracker/wip/carlosg/dist-docs: 3/3] build: Ship devhelp docs in tarball




commit 0adb58e29389544331a747f60d9038e58a6d87ac
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Aug 31 21:31:30 2021 +0200

    build: Ship devhelp docs in tarball
    
    Use a dist script to generate those docs and include them in the
    tarball, the meson build definition has been changed to also account
    for this shortcut if building from tarballs.
    
    This avoids the hotdoc dependency and its dependencies (e.g. npm
    modules) when building from tarballs.
    
    Tarball size increased ~400KB, which stands on the acceptable size
    since the tarball is still less than 2MB.

 docs/meson.build                              |  1 -
 docs/reference/libtracker-sparql/dist-docs.sh | 23 +++++++++++++++++++++++
 docs/reference/libtracker-sparql/meson.build  | 12 ++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
---
diff --git a/docs/meson.build b/docs/meson.build
index a57c8eb04..e43b12a8b 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -2,7 +2,6 @@ if get_option('man')
   subdir('manpages')
 endif
 if get_option('docs')
-  hotdoc = import('hotdoc')
   subdir('tools')
   subdir('reference')
 endif
diff --git a/docs/reference/libtracker-sparql/dist-docs.sh b/docs/reference/libtracker-sparql/dist-docs.sh
new file mode 100644
index 000000000..a95dd7373
--- /dev/null
+++ b/docs/reference/libtracker-sparql/dist-docs.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+docs_name=$1
+
+pushd $MESON_BUILD_ROOT
+
+# Ensure the build tree is compiled, we need generated files
+ninja
+
+# Run hotdoc manually
+pushd docs/reference/libtracker-sparql
+hotdoc run --conf-file ${docs_name}-doc.json
+
+# Generate fixed .devhelp2 file
+${MESON_SOURCE_ROOT}/docs/reference/libtracker-sparql/generate-devhelp.sh $1
+
+# And copy the resulting devhelp documentation into the dist location
+mv ${docs_name}-doc/devhelp/ ${MESON_DIST_ROOT}/docs/reference/libtracker-sparql/
+
+# Delete the remaining docs
+rm -rf ${docs_name}-doc/
+
+popd
+popd
diff --git a/docs/reference/libtracker-sparql/meson.build b/docs/reference/libtracker-sparql/meson.build
index c02469989..64254ddf3 100644
--- a/docs/reference/libtracker-sparql/meson.build
+++ b/docs/reference/libtracker-sparql/meson.build
@@ -1,3 +1,14 @@
+fs = import('fs')
+
+if fs.exists('devhelp')
+  # Special case for tarballs, install the pre-generated docs
+  install_subdir('devhelp/books',
+    install_dir: join_paths(datadir, 'devhelp'))
+  subdir_done()
+endif
+
+hotdoc = import('hotdoc')
+
 documents_with_examples = [
   [ 'examples.md.in', 'examples.md' ],
 ]
@@ -85,3 +96,4 @@ hotdoc.generate_doc(docs_name,
 )
 
 meson.add_install_script('install-devhelp.sh', docs_name)
+meson.add_dist_script('dist-docs.sh', docs_name)


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