[gimp] devel-docs: generate Python API (GObject Introspected) documentation.



commit 4b392171811e97d0e6601d4b54cb13f0a5476be8
Author: Jehan <jehan girinstud io>
Date:   Fri Jan 29 15:22:36 2021 +0100

    devel-docs: generate Python API (GObject Introspected) documentation.
    
    So much easier to write in autotools! Anyway here it is, also with a new
    option --enable-g-ir-doc (by default set to false).

 configure.ac                     | 20 ++++++++++++++++++++
 devel-docs/Makefile.am           |  1 +
 devel-docs/g-ir-docs/Makefile.am | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index f0d36369a2..4ec183c227 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2709,6 +2709,22 @@ AM_CONDITIONAL(ENABLE_GTK_DOC, test "x$enable_gtk_doc" = xyes)
 AC_ARG_ENABLE(gtk-doc-app, [  --enable-gtk-doc-app    build developer documentation for app (default=no)], , 
enable_gtk_doc_app=no)
 AM_CONDITIONAL(ENABLE_GTK_DOC_APP, test "x$enable_gtk_doc_app" = xyes)
 
+########################################
+# Checks for gir-doc-tool and yelp-build
+########################################
+
+AC_ARG_ENABLE(g-ir-doc, [  --enable-g-ir-doc       build GObject Introspection documentation (default=no)], 
, enable_g_ir_doc=no)
+
+if test "x$enable_g_ir_doc" = xyes; then
+  AC_CHECK_PROGS(GIR_DOC_TOOL, g-ir-doc-tool, no)
+  AC_CHECK_PROGS(YELP_BUILD, yelp-build, no)
+  if test "x$GIR_DOC_TOOL" = "xno" || test "x$YELP_BUILD" = "xno"; then
+    add_deps_error([g-ir-doc], [Could not find g-ir-doc-tool or yelp-build in your PATH.])
+    enable_g_ir_doc="no (g-ir-doc-tool or yelp-build missing)"
+  fi
+fi
+
+AM_CONDITIONAL(ENABLE_G_IR_DOC, test "x$enable_g_ir_doc" = xyes)
 
 #############################
 # Check for Windows installer
@@ -3039,6 +3055,7 @@ modules/Makefile
 devel-docs/Makefile
 devel-docs/version
 devel-docs/app/Makefile
+devel-docs/g-ir-docs/Makefile
 devel-docs/libgimp/Makefile
 devel-docs/libgimpbase/Makefile
 devel-docs/libgimpconfig/Makefile
@@ -3205,6 +3222,9 @@ Tests:
   Test appdata               $have_appstream_util
   Test desktop file          $have_desktop_file_validate
 
+Documentation:
+  GObject Introspection:     $enable_g_ir_doc
+
 Bug report URL: $with_bug_report_url
 
$override_bug_report_url$warning_vector_icons_windows$warning_glib_networking$warning_gcc$warning_python$warning_javascript$warning_lua$warning_libheif$warning_libmypaint"
 
diff --git a/devel-docs/Makefile.am b/devel-docs/Makefile.am
index 8022e63796..c29ea14d49 100644
--- a/devel-docs/Makefile.am
+++ b/devel-docs/Makefile.am
@@ -5,6 +5,7 @@ app = app
 endif
 
 SUBDIRS = \
+       g-ir-docs       \
        tools           \
        libgimpbase     \
        libgimpcolor    \
diff --git a/devel-docs/g-ir-docs/Makefile.am b/devel-docs/g-ir-docs/Makefile.am
new file mode 100644
index 0000000000..467947e946
--- /dev/null
+++ b/devel-docs/g-ir-docs/Makefile.am
@@ -0,0 +1,34 @@
+if ENABLE_G_IR_DOC
+
+Gimp-pythondocs: $(top_builddir)/libgimp/Gimp-@GIMP_API_VERSION@.gir
+       $(GIR_DOC_TOOL) -I "$(prefix)/share/gir-1.0/"                   \
+               -I "$(top_builddir)/libgimp" --language=Python          \
+               -o "$(builddir)/pages/Python/Gimp-$(GIMP_API_VERSION)"  \
+               $^
+       $(YELP_BUILD) cache                                                             \
+               -o "$(builddir)/pages/Python/Gimp-$(GIMP_API_VERSION)/index.cache"      \
+               "$(builddir)/pages/Python/Gimp-$(GIMP_API_VERSION)/"
+       mkdir -p "$(builddir)/html/Python/Gimp-$(GIMP_API_VERSION)"
+       $(YELP_BUILD) html                                              \
+               -o "$(builddir)/html/Python/Gimp-$(GIMP_API_VERSION)"   \
+               "$(builddir)/pages/Python/Gimp-$(GIMP_API_VERSION)/"
+       echo "Python Gimp module documentation: $(builddir)/html/Python/Gimp-$(GIMP_API_VERSION)"
+
+GimpUi-pythondocs: $(top_builddir)/libgimp/GimpUi-@GIMP_API_VERSION@.gir
+       $(GIR_DOC_TOOL) -I "$(prefix)/share/gir-1.0/"                           \
+               -I "$(top_builddir)/libgimp" --language=Python                  \
+               -o "$(builddir)/pages/Python/GimpUi-$(GIMP_API_VERSION)"        \
+               $^
+       $(YELP_BUILD) cache                                                             \
+               -o "$(builddir)/pages/Python/GimpUi-$(GIMP_API_VERSION)/index.cache"    \
+               "$(builddir)/pages/Python/GimpUi-$(GIMP_API_VERSION)/"
+       mkdir -p "$(builddir)/html/Python/GimpUi-$(GIMP_API_VERSION)"
+       $(YELP_BUILD) html                                              \
+               -o "$(builddir)/html/Python/GimpUi-$(GIMP_API_VERSION)" \
+               "$(builddir)/pages/Python/GimpUi-$(GIMP_API_VERSION)/"
+       echo "Python GimpUi module documentation: $(builddir)/html/Python/Gimp-$(GIMP_API_VERSION)"
+
+.PHONY: Gimp-pythondocs GimpUi-pythondocs
+all-local: Gimp-pythondocs GimpUi-pythondocs
+
+endif


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