git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Toon Claes <toon@iotcl.com>
Cc: git@vger.kernel.org
Subject: Re: How to use Meson (was: [PATCH 00/10] meson: wire up missing HTML documentation])
Date: Fri, 3 Jan 2025 09:35:29 +0100	[thread overview]
Message-ID: <Z3ehR4uaG_j3iWy7@pks.im> (raw)
In-Reply-To: <874j2gl46v.fsf@iotcl.com>

On Fri, Jan 03, 2025 at 08:58:00AM +0100, Toon Claes wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > Yup, you are always expected to set up the top-level source directory,
> > not any of the subdirectories. The build instructions are then processed
> > linearly in Meson, so variables declared before a call to `subdir()`
> > would be accessible in the subdirectory, as well.
> 
> With Makefiles I can build individual targets (like `make docs`), or run
> `make` in the docs/ subdir, is something like that also possible with
> Meson? Or are you always configuring what to build in `meson configure`
> and building all that with `meson compile`?

You can in theory. It's already possible to build individual parts of
Git, e.g.:

    # We need to discern these two `git` targets because the same name
    # is defined once as a static library and once as an executable.
    $ meson compile git:static_library
    $ meson compile git:executable
    $ meson compile Documentation/git-add.1

We can also have a target equivalent to `make docs` by adding
`alias_target()`s to Meson. I ain't got these wired up yet, but it could
look like the patch at the end of this mail. And then you can simply say
`meson compile docs`. It does require you to have docs configured
though, otherwise the 'Documentation/' subdirectory does not get pulled
included in the first place.

Patrick

diff --git a/Documentation/meson.build b/Documentation/meson.build
index 2a26fa8a5f..4f8e2e7ebb 100644
--- a/Documentation/meson.build
+++ b/Documentation/meson.build
@@ -204,6 +204,8 @@ manpages = {
   'gitworkflows.txt' : 7,
 }
 
+docs_target = []
+
 docs_backend = get_option('docs_backend')
 if docs_backend == 'auto'
   if find_program('asciidoc', required: false).found()
@@ -364,10 +366,12 @@ foreach manpage, category : manpages
       install: true,
       install_dir: get_option('mandir') / 'man' + category.to_string(),
     )
+
+    docs_target += manpage_target
   endif
 
   if get_option('docs').contains('html')
-    custom_target(
+    docs_target += custom_target(
       command: asciidoc_common_options + [
         '--backend=' + asciidoc_html,
         '--doctype=manpage',
@@ -419,7 +423,7 @@ if get_option('docs').contains('html')
     depends: documentation_deps,
   )
 
-  custom_target(
+  docs_target += custom_target(
     command: [
       xsltproc,
       '--xinclude',
@@ -447,7 +451,7 @@ if get_option('docs').contains('html')
   ]
 
   foreach article : articles
-    custom_target(
+    docs_target += custom_target(
       command: asciidoc_common_options + [
         '--backend=' + asciidoc_html,
         '--out-file=@OUTPUT@',
@@ -502,3 +506,5 @@ if configured_manpages != actual_manpages
     error('Man page configured, but not found:\n\n - ' + '\n - '.join(superfluous_manpage))
   endif
 endif
+
+alias_target('docs', docs_target)

  reply	other threads:[~2025-01-03  8:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13  8:48 [PATCH 00/10] meson: wire up missing HTML documentation Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 01/10] meson: wire up support for AsciiDoctor Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 02/10] meson: properly wire up dependencies for our docs Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 03/10] meson: fix generation of merge tools Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 04/10] meson: generate HTML pages for all man page categories Patrick Steinhardt
2024-12-23 11:52   ` Toon Claes
2024-12-27 13:58     ` Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 05/10] Documentation: inline user-manual.conf Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 06/10] meson: generate user manual Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 07/10] Documentation: refactor "api-index.sh" for out-of-tree builds Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 08/10] Documentation: refactor "howto-index.sh" " Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 09/10] meson: generate articles Patrick Steinhardt
2024-12-13  8:48 ` [PATCH 10/10] meson: install static files for HTML documentation Patrick Steinhardt
2024-12-23 11:51 ` [PATCH 00/10] meson: wire up missing " Toon Claes
2024-12-27 13:58   ` Patrick Steinhardt
2025-01-03  7:58     ` How to use Meson (was: [PATCH 00/10] meson: wire up missing HTML documentation]) Toon Claes
2025-01-03  8:35       ` Patrick Steinhardt [this message]
2024-12-27 13:59 ` [PATCH v2 00/12] meson: wire up missing HTML documentation Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 01/12] meson: wire up support for AsciiDoctor Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 02/12] meson: properly wire up dependencies for our docs Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 03/12] meson: fix generation of merge tools Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 04/12] meson: generate HTML pages for all man page categories Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 05/12] Documentation: inline user-manual.conf Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 06/12] meson: generate user manual Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 07/12] Documentation: refactor "api-index.sh" for out-of-tree builds Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 08/12] Documentation: refactor "howto-index.sh" " Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 09/12] meson: generate articles Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 10/12] meson: install static files for HTML documentation Patrick Steinhardt
2024-12-27 13:59   ` [PATCH v2 11/12] t/Makefile: make "check-meson" work with Dash Patrick Steinhardt
2025-01-02 15:37     ` Jonathan Nieder
2025-01-02 15:41       ` Junio C Hamano
2025-01-03  0:05         ` Junio C Hamano
2024-12-27 13:59   ` [PATCH v2 12/12] Documentation: wire up sanity checks for Meson Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z3ehR4uaG_j3iWy7@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=toon@iotcl.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).