[{"id":35453,"web_url":"https://patchwork.libcamera.org/comment/35453/","msgid":"<175527050022.1721288.9760450117470260222@ping.linuxembedded.co.uk>","date":"2025-08-15T15:08:20","subject":"Re: [RFC PATCH v2] Documentation: Fix documentation generation when\n\tsubproject","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-08-15 15:39:05)\n> The paths of the doxygen tag files for sphinxcontrib-doxygen must be\n> absolute or relative the the current working directory. However, when\n> libcamera is built as a subproject, the current working directory\n> is the top-level build directory. Thus the paths for the tag files\n> will not be correct.\n> \n> Fix that by using `configure_file()` to generate the final sphinx\n> configuration with the appropriate paths queried from meson.\n> \n> Fixes: 0382d215d (\"Documentation: Use Sphinx doxylink to generate links to doxygen\")\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n> changes in v2:\n>         * variables in alphabetical order\n>         * import 'fs' module explicitly\n> \n> v1: https://patchwork.libcamera.org/patch/24044/\n> ---\n>  Documentation/{conf.py => conf.py.in} |  6 +++---\n>  Documentation/meson.build             | 17 +++++++++++++++--\n>  2 files changed, 18 insertions(+), 5 deletions(-)\n>  rename Documentation/{conf.py => conf.py.in} (95%)\n> \n> diff --git a/Documentation/conf.py b/Documentation/conf.py.in\n> similarity index 95%\n> rename from Documentation/conf.py\n> rename to Documentation/conf.py.in\n> index f50be60a1..097e579b5 100644\n> --- a/Documentation/conf.py\n> +++ b/Documentation/conf.py.in\n> @@ -74,11 +74,11 @@ pygments_style = None\n> \n>  doxylink = {\n>      'doxy-pub': (\n> -        'Documentation/api-html/tagfile.xml',\n> +        '@TOP_BUILDDIR@/Documentation/api-html/tagfile.xml',\n>          '../api-html/',\n>      ),\n>      'doxy-int': (\n> -        'Documentation/internal-api-html/tagfile.xml',\n> +        '@TOP_BUILDDIR@/Documentation/internal-api-html/tagfile.xml',\n>          '../internal-api-html/',\n>      ),\n>  }\n> @@ -89,7 +89,7 @@ doxylink = {\n>  # a list of builtin themes.\n>  #\n>  html_theme = 'theme'\n> -html_theme_path = ['.']\n> +html_theme_path = ['@THEME_DIR@']\n> \n>  # Theme options are theme-specific and customize the look and feel of a theme\n>  # further.  For a list of options available for each theme, see the\n> diff --git a/Documentation/meson.build b/Documentation/meson.build\n> index b898ba3a0..10aaf613e 100644\n> --- a/Documentation/meson.build\n> +++ b/Documentation/meson.build\n> @@ -142,11 +142,21 @@ if sphinx.found()\n>                .format(mod, version, min_version))\n>      endif\n> \n> +    sphinx_conf = configure_file(input : 'conf.py.in',\n> +                                 output : 'conf.py',\n> +                                 configuration : {\n> +                                    'THEME_DIR': meson.current_source_dir(),\n> +                                    'TOP_BUILDDIR': meson.project_build_root(),\n> +                                 })\n> +\n> +    fs = import('fs')\n> +    sphinx_conf_dir = fs.parent(sphinx_conf)\n> +\n>      docs_sources = [\n>          'camera-sensor-model.rst',\n>          'code-of-conduct.rst',\n>          'coding-style.rst',\n> -        'conf.py',\n> +        sphinx_conf,\n\nalmost caught me - that's a variable not a path ;-)\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>          'contributing.rst',\n>          'design/ae.rst',\n>          'documentation-contents.rst',\n> @@ -171,6 +181,7 @@ if sphinx.found()\n> \n>      custom_target('documentation',\n>                    command : [sphinx, '-D', release, '-q', '-W', '-b', 'html',\n> +                             '-c', sphinx_conf_dir,\n>                               meson.current_source_dir(), '@OUTPUT@'],\n>                    input : docs_sources,\n>                    output : 'html',\n> @@ -184,7 +195,9 @@ if sphinx.found()\n>                    install_tag : 'doc')\n> \n>      custom_target('documentation-linkcheck',\n> -                  command : [sphinx, '-W', '-b', 'linkcheck', meson.current_source_dir(), '@OUTPUT@'],\n> +                  command : [sphinx, '-W', '-b', 'linkcheck',\n> +                             '-c', sphinx_conf_dir,\n> +                             meson.current_source_dir(), '@OUTPUT@'],\n>                    build_always_stale : true,\n>                    input : docs_sources,\n>                    output : 'linkcheck')\n> --\n> 2.50.1","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id ABD14BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Aug 2025 15:08:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CA12369257;\n\tFri, 15 Aug 2025 17:08:24 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CF39F61443\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Aug 2025 17:08:22 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A74CB605;\n\tFri, 15 Aug 2025 17:07:27 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Dv5AuDNp\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755270447;\n\tbh=f9VCPu0j5h+fkWWt4XR4PMsDZZHTOECw3MIAUP5x10c=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=Dv5AuDNpw4nh8jOTONgFz9wjJDkrvqQhScnK+TxGwByQHJauBGpzyHK+GhPAKZUZ3\n\tgTGKy91spml+nMSvsk321kpLR8unxip0eud2hLAjInJQU8xhjkwAjPSvgmepWdai1q\n\tVJUcFgHR9AQ4ea6TNOKW1bm40ffbyPYaWUVZRFIw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250815143905.2247112-1-barnabas.pocze@ideasonboard.com>","References":"<20250815143905.2247112-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [RFC PATCH v2] Documentation: Fix documentation generation when\n\tsubproject","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 15 Aug 2025 16:08:20 +0100","Message-ID":"<175527050022.1721288.9760450117470260222@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]