Skip to contentSkip to conversation

glib-2.0: no need to depend on target gtk-doc

PATCH New [email protected] 1 participant 9 messages Jan 10, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 glib-2.0: no need to depend on target gtk-doc

From: Ross Burton <[email protected]>

The meson.build looks for a target gtk-doc, but it should be looking for the native package.

Fixing this means we can drop the need for a target gtk-doc package.

---
 .../glib-2.0/glib-2.0/native-gtkdoc.patch     | 21 +++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0_2.78.3.bb |  1 +
 meta/recipes-core/glib-2.0/glib.inc           |  2 --
 3 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/native-gtkdoc.patch
meta/recipes-core/glib-2.0/glib-2.0/native-gtkdoc.patch new file +21 -0
new file mode 100644
index 00000000000..f56c2b85640
@@ -0,0 +1,21 @@
+docs/reference: depend on a native gtk-doc
+
+In a cross-compiled environment we don't need a target gtk-doc, but a
+native gtk-doc.
+
+Upstream-Status: Backport [f3ff370d1b24f8afb51cd4e865593d5b678188a9]
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git a/docs/reference/meson.build b/docs/reference/meson.build
+index c417ffecb..67c1dda56 100644
+--- a/docs/reference/meson.build
++++ b/docs/reference/meson.build
+@@ -42,7 +42,7 @@ ignore_decorators = '|'.join(ignore_decorators)
+ if get_option('gtk_doc')
+   # Check we have the minimum gtk-doc version required. Older versions won't
+   # generate correct documentation.
+-  dependency('gtk-doc', version : '>=1.32.1',
++  dependency('gtk-doc', version : '>=1.32.1', native: true,
+     fallback : ['gtk-doc', 'dummy_dep'],
+     default_options : ['tests=false'])
+ 
meta/recipes-core/glib-2.0/glib-2.0_2.78.3.bb +1 -0
index 13d4b38e22e..2729b2a5963 100644
@@ -14,6 +14,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://0001-Do-not-write-bindir-into-pkg-config-files.patch \
            file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
            file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
+           file://native-gtkdoc.patch \
            "
 SRC_URI:append:class-native = " file://relocate-modules.patch \ 
                                 file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \
meta/recipes-core/glib-2.0/glib.inc +0 -2
index eb292c51d44..ae6fc519922 100644
@@ -30,8 +30,6 @@ LEAD_SONAME = "libglib-2.0.*"
 
 inherit meson gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache manpages
 
-DEPENDS:append:class-target = "${@' gtk-doc' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
-
 GTKDOC_MESON_OPTION = "gtk_doc"
 
 S = "${WORKDIR}/glib-${PV}"
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/9 autotools: append to EXTRA_AUTORECONF

From: Ross Burton <[email protected]>

Inherit order may mean that this class is inherited after assignments, so extend instead of assign EXTRA_AUTORECONF.

---
 meta/classes-recipe/autotools.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/autotools.bbclass +1 -1
index 1663307b061..12881a31ec9 100644
@@ -37,7 +37,7 @@ inherit siteinfo
 export CONFIG_SITE
 
 acpaths ?= "default"
-EXTRA_AUTORECONF = "--exclude=autopoint --exclude=gtkdocize"
+EXTRA_AUTORECONF += "--exclude=autopoint --exclude=gtkdocize"
 
 export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/9 autotools: don't exclude gtkdocize

In reply to [email protected]

From: Ross Burton <[email protected]>

gtkdocize can now be ran successfully from autoreconf, so there's no need to exclude it and run it manually.

---
 meta/classes-recipe/autotools.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/autotools.bbclass +1 -1
index 12881a31ec9..ca76cde0e74 100644
@@ -37,7 +37,7 @@ inherit siteinfo
 export CONFIG_SITE
 
 acpaths ?= "default"
-EXTRA_AUTORECONF += "--exclude=autopoint --exclude=gtkdocize"
+EXTRA_AUTORECONF += "--exclude=autopoint"
 
 export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 4/9 gtk-doc: fix DEPENDS

In reply to [email protected]

From: Ross Burton <[email protected]>

The use of xmlto and six was removed many years ago, instead depend directly on docbook-xml and docbook-xsl.

---
 meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb +1 -1
index 2e8ab1c771a..f2f37610f9e 100644
@@ -16,7 +16,7 @@ PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "api-documentation",
 # into its scripts. This means that target gtk-doc package is broken;
 # hopefully no one minds because its scripts are not used for anything during build
 # and shouldn't be used on targets.
-PACKAGECONFIG[working-scripts] = ",,libxslt-native xmlto-native python3-six python3-pygments"
+PACKAGECONFIG[working-scripts] = ",,libxslt-native docbook-xml-dtd4-native docbook-xsl-stylesheets python3-pygments"
 PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,glib-2.0"
 
 CACHED_CONFIGUREVARS += "ac_cv_path_XSLTPROC=xsltproc"
Signature · 1 line
2.34.1
#4 lore raw

PATCH 5/9 gtk-doc: remove obsolete logic

In reply to [email protected]

From: Ross Burton <[email protected]>

This manual disabling of gtk-doc for autotools and meson in native and nativesdk builds is replicating logic above for target builds.

Instead, use one assignment for all builds, as we explicitly disable gtk-doc in native builds and it can be useful in nativesdk.

---
 meta/classes-recipe/gtk-doc.bbclass | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
meta/classes-recipe/gtk-doc.bbclass +2 -9
index 68fa2cc7451..c980c6bb52d 100644
@@ -25,16 +25,9 @@ GTKDOC_MESON_ENABLE_FLAG ?= 'true'
 GTKDOC_MESON_DISABLE_FLAG ?= 'false'
 
 # Auto enable/disable based on GTKDOC_ENABLED
-EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GTKDOC_ENABLED', 'True', '--enable-gtk-doc --enable-gtk-doc-html --disable-gtk-doc-pdf', \
+EXTRA_OECONF:prepend = "${@bb.utils.contains('GTKDOC_ENABLED', 'True', '--enable-gtk-doc --enable-gtk-doc-html --disable-gtk-doc-pdf', \
                                                                                     '--disable-gtk-doc', d)} "
-EXTRA_OEMESON:prepend:class-target = "-D${GTKDOC_MESON_OPTION}=${@bb.utils.contains('GTKDOC_ENABLED', 'True', '${GTKDOC_MESON_ENABLE_FLAG}', '${GTKDOC_MESON_DISABLE_FLAG}', d)} "
-
-# When building native recipes, disable gtkdoc, as it is not necessary,
-# pulls in additional dependencies, and makes build times longer
-EXTRA_OECONF:prepend:class-native = "--disable-gtk-doc "
-EXTRA_OECONF:prepend:class-nativesdk = "--disable-gtk-doc "
-EXTRA_OEMESON:prepend:class-native = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
-EXTRA_OEMESON:prepend:class-nativesdk = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
+EXTRA_OEMESON:prepend = "-D${GTKDOC_MESON_OPTION}=${@bb.utils.contains('GTKDOC_ENABLED', 'True', '${GTKDOC_MESON_ENABLE_FLAG}', '${GTKDOC_MESON_DISABLE_FLAG}', d)} "
 
 # Even though gtkdoc is disabled on -native, gtk-doc package is still
 # needed for m4 macros.
Signature · 1 line
2.34.1
#5 lore raw

PATCH 6/9 gtk-doc: don't use docdir set in environment in gtkdocize

In reply to [email protected]

From: Ross Burton <[email protected]>

The gtkdocize script was accidentally respecting $docdir from the environment as the default documentation directory. This is a problem as bitbake.conf exports $docdir, resulting in configure failures.

---
 ...01-Don-t-use-docdir-from-environment.patch | 24 +++++++++++++++++++
 meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb  |  1 +
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-gnome/gtk-doc/files/0001-Don-t-use-docdir-from-environment.patch
meta/recipes-gnome/gtk-doc/files/0001-Don-t-use-docdir-from-environment.patch new file +24 -0
new file mode 100644
index 00000000000..f40124877c3
@@ -0,0 +1,24 @@
+From 72dfeec0e49478b0bfb471c4155044391bad8e6c Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Fri, 8 Dec 2023 10:35:25 +0000
+Subject: [PATCH] Don't use docdir from environment
+
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gtk-doc/-/merge_requests/73]
+Signed-off-by: Ross Burton <[email protected]>
+---
+ buildsystems/autotools/gtkdocize.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/buildsystems/autotools/gtkdocize.in b/buildsystems/autotools/gtkdocize.in
+index 83127bf..76dcbfd 100755
+--- a/buildsystems/autotools/gtkdocize.in
++++ b/buildsystems/autotools/gtkdocize.in
+@@ -39,7 +39,7 @@ set - $args
+ 
+ # assume working directory if srcdir is not set
+ test "$srcdir" || srcdir=.
+-test "$docdir" || docdir="$srcdir"
++docdir="$srcdir"
+ 
+ # detect configure script
+ no_configure_found=0
meta/recipes-gnome/gtk-doc/gtk-doc_1.33.2.bb +1 -0
index f2f37610f9e..4fd5a6e9256 100644
@@ -26,6 +26,7 @@ SRC_URI += "file://0001-Do-not-hardocode-paths-to-perl-python-in-scripts.patch \
            file://0001-Do-not-error-out-if-xsltproc-is-not-found.patch \
            file://conditionaltests.patch \
            file://no-clobber.patch \
+           file://0001-Don-t-use-docdir-from-environment.patch \
            "
 SRC_URI:append:class-native = " file://pkg-config-native.patch"
 
Signature · 1 line
2.34.1
#6 lore raw

PATCH 7/9 gtk-doc: don't manually call gtkdocize

In reply to [email protected]

From: Ross Burton <[email protected]>

The autoreconf call will now call gtkdocize if needed, so we don't need to run it manually here.

This obsoletes GTKDOC_DOCDIR. If this is needed then the replacement is to ensure that the configure.ac has a call to GTK_DOC_CHECK which passes --docdir.

For example, this is the change required for kmod:

-GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat]) +GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat --docdir libkmod/docs])

---
 meta/classes-recipe/gtk-doc.bbclass | 10 ----------
 1 file changed, 10 deletions(-)
meta/classes-recipe/gtk-doc.bbclass +0 -10
index c980c6bb52d..9d3911966bb 100644
@@ -33,21 +33,11 @@ EXTRA_OEMESON:prepend = "-D${GTKDOC_MESON_OPTION}=${@bb.utils.contains('GTKDOC_E
 # needed for m4 macros.
 DEPENDS:append = " gtk-doc-native"
 
-# The documentation directory, where the infrastructure will be copied.
-# gtkdocize has a default of "." so to handle out-of-tree builds set this to $S.
-GTKDOC_DOCDIR ?= "${S}"
-
 export STAGING_DIR_HOST
 
 inherit python3native pkgconfig qemu
 DEPENDS:append = "${@' qemu-native' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
 
-do_configure:prepend () {
-	# Need to use ||true as this is only needed if configure.ac both exists
-	# and uses GTK_DOC_CHECK.
-	gtkdocize --srcdir ${S} --docdir ${GTKDOC_DOCDIR} || true
-}
-
 do_compile:prepend:class-target () {
     if [ ${GTKDOC_ENABLED} = True ]; then
         # Write out a qemu wrapper that will be given to gtkdoc-scangobj so that it
Signature · 1 line
2.34.1
#7 lore raw

PATCH 8/9 kmod: fix configure with autopoint calling gtkdocize

In reply to [email protected]

From: Ross Burton <[email protected]>

GTKDOC_DOCDIR is obsolete now, so fix the build by passing the documentation directory in the GTK_DOC_CHECK call.

---
 meta/recipes-kernel/kmod/kmod/gtkdocdir.patch | 33 +++++++++++++++++++
 meta/recipes-kernel/kmod/kmod_31.bb           |  3 +-
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-kernel/kmod/kmod/gtkdocdir.patch
meta/recipes-kernel/kmod/kmod/gtkdocdir.patch new file +33 -0
new file mode 100644
index 00000000000..a34ea466e8e
@@ -0,0 +1,33 @@
+From dd59095f70f774f6d1e767010e25b35ef6db4c4b Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Fri, 8 Dec 2023 22:35:45 +0000
+Subject: [PATCH] configure: set docdir in GTK_DOC_CHECK
+
+By passing --docdir in the GTK_DOC_CHECK arguments (to match
+autogen.sh) autoreconf will work out of the box.
+
+Without this autoreconf fails due to the documentation not being in
+./docs, the default location.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-modules/[email protected]/T/#u]
+Signed-off-by: Ross Burton <[email protected]>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index de01e08..67696c4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -255,7 +255,7 @@ AS_IF([test "x$enable_coverage" = "xyes"], [
+ AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
+ 
+ m4_ifdef([GTK_DOC_CHECK], [
+-GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
++GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat --docdir libkmod/docs])
+ ], [
+ AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
+ 
+-- 
+2.34.1
+
meta/recipes-kernel/kmod/kmod_31.bb +1 -2
index c11ce456f21..6ae83a7c66c 100644
@@ -21,6 +21,7 @@ SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git;branch=master
            file://depmod-search.conf \
            file://avoid_parallel_tests.patch \
            file://0001-Use-portable-implementation-for-basename-API.patch \
+           file://gtkdocdir.patch \
            "
 
 S = "${WORKDIR}/git"
@@ -36,8 +37,6 @@ PACKAGECONFIG[xz] = "--with-xz,--without-xz,xz"
 PACKAGECONFIG[zlib] = "--with-zlib,--without-zlib,zlib"
 PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd"
 
-GTKDOC_DOCDIR = "${S}/libkmod/docs"
-
 PROVIDES += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
 RPROVIDES:${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
 RCONFLICTS:${PN} += "module-init-tools-insmod-static module-init-tools-depmod module-init-tools"
Signature · 1 line
2.34.1
#8 lore raw

PATCH 9/9 util-linux: enable gtk-doc

In reply to [email protected]

From: Ross Burton <[email protected]>

Now that we've solved the util-linux - gtk-doc - xmlto - util-linux dependency loop, we can enable gtk-doc in util-linux.

We explicitly disable it in util-linux-libuuuid as this doesn't have API documentation.

---
 meta/recipes-core/util-linux/util-linux-libuuid_2.39.2.bb | 3 +++
 meta/recipes-core/util-linux/util-linux_2.39.2.bb         | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)
meta/recipes-core/util-linux/util-linux-libuuid_2.39.2.bb +3 -0
index 5d759aed94b..ec04c1d3843 100644
@@ -6,7 +6,10 @@ require util-linux.inc
 inherit autotools gettext pkgconfig
 
 S = "${WORKDIR}/util-linux-${PV}"
+
+EXTRA_AUTORECONF += "--exclude=gtkdocize"
 EXTRA_OECONF += "--disable-all-programs --enable-libuuid"
+
 LICENSE = "BSD-3-Clause"
 
 do_install:append() {
meta/recipes-core/util-linux/util-linux_2.39.2.bb +1 -2
index 8c081674017..9fd3a5f5258 100644
@@ -1,7 +1,6 @@
 require util-linux.inc
 
-#gtk-doc is not enabled as it requires xmlto which requires util-linux
-inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest
+inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest gtk-doc
 DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid"
 
 PACKAGES =+ "${PN}-swaponoff"
Signature · 1 line
2.34.1