git: 837447eabc74 - main - devel/glib20: fix up DOCS generation

From: Adriaan de Groot <adridg_at_FreeBSD.org>
Date: Sun, 17 Apr 2022 13:07:15 UTC
The branch main has been updated by adridg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=837447eabc7465795a0832db23f4862b6289fb7c

commit 837447eabc7465795a0832db23f4862b6289fb7c
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2022-04-17 11:56:19 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2022-04-17 13:07:12 +0000

    devel/glib20: fix up DOCS generation
    
    Try to resolve build issues when generating DOCS. On some systems --
    embarrassingly parallel ones, but also seemingly i386 -- the build
    happens in a wrong order. This is explained in the comment now
    added to the Makefile.
    
    A simple way to trigger the build problem (before this patch) is this:
    - configure the port
    - switch to the build-dir
    - run `ninja -j48 gio-doc`
    
    Dependencies for gio-doc are incomplete, and the build fails.
    
    I tried to solve this at Meson-level, but all my "obvious" changes
    to `meson.build` like adding a dependency on `libgdbus_example_objectmanager`
    to gio/meson.build got me Meson-time errors. Either no extra dependency
    in the resulting Ninja files, or an error that the type of the dependency
    was wrong. The ugly way to fix it is to tell ninja -- which does have
    a general idea about dependencies between targets -- about it.
---
 devel/glib20/Makefile | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/devel/glib20/Makefile b/devel/glib20/Makefile
index f643570a17bd..33bb3c4993fc 100644
--- a/devel/glib20/Makefile
+++ b/devel/glib20/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	glib
 DISTVERSION=	2.70.4
-PORTREVISION=	4
+PORTREVISION=	5
 PORTEPOCH=	2
 CATEGORIES=	devel
 MASTER_SITES=	GNOME
@@ -79,6 +79,20 @@ pre-configure-FAM_ALTBACKEND-on:
 	@${CP} ${FILESDIR}/kqueue_fnm.c ${WRKSRC}/gio/kqueue/kqueue_fnm.c
 	@${CP} ${FILESDIR}/kqueue_fnm.h ${WRKSRC}/gio/kqueue/kqueue_fnm.h
 
+# The generation of GIO documentation depends on a types-document
+# generated as part of the dbus-object-manager example. With an
+# embarrassingly parallel build, failures like this can happen:
+#
+# Building documentation for gdbus-object-manager-example
+# ERROR: Error in gtkdoc helper script:
+# FileNotFoundError: [Errno 2] No such file or directory: '_build/docs/reference/gio/gdbus-object-manager-example/gdbus-object-manager-example.types'
+#
+# Meson does not seem to provide a way to express that dependency.
+#
+# Hack it into the generated ninja build instead.
+post-configure-DOCS-on:
+	@${REINPLACE_CMD} -e '\+^build docs/reference/gio/gdbus-object-manager-example/gdbus-object-manager-example-decl.txt:+s+$$+ || gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.so+' ${BUILD_WRKSRC}/build.ninja
+
 post-patch:
 	${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g ; \
 		s|/usr/share/locale/locale|${LOCALBASE}/share/locale/locale|g' \