Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ clean:
distclean: clean
rm -rf dist MANIFEST

SPHINXOPTS += -D version=$(VERSION) -D release=$(VERSION)
sphinx-%: install
mkdir $(BUILD_DIR) && cd $(BUILD_DIR) && $(PYTHON) -m sphinx -b $* $(SPHINXOPTS) ../docs $*
@echo Output has been generated in $(BUILD_DIR)/$*

doc: sphinx-html

check: build install
($(PYTHON) -m pytest src/systemd/test docs $(TESTFLAGS))

Expand Down
14 changes: 14 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ common_c_args = [
]

subdir('src/systemd')

# Docs
sphinx_build = find_program('sphinx-build', disabler: true, required: get_option('docs'))
if get_option('docs')
sphinx_args = ['-Dversion=' + meson.project_version(), '-Drelease=' + meson.project_version()]
input_dir = meson.current_source_dir() / 'docs'
output_dir = meson.current_build_dir() / 'html'
output_file = output_dir / 'index.html'
custom_target('build-docs',
output: 'index.html',
input: files('docs/conf.py'),
command: [sphinx_build, '-b', 'html', sphinx_args, input_dir, output_dir],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it so that it is built by default and installed if docs is true? It's nice if the target is always defined, because then it makes development easier, because one can rebuild the docs on demand but it doesn't interfere with normal development.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and let's call the target docs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so this was mostly me learning a bit more of meson and I was leaning on two ideas:

  • For packaging you probably want a -Ddocs=true option (so this also needs an install target)
  • For development you could get away with just meson -C build build-docs

I'm happy to make this a docs target and default to true, probably should also add an install target then.

However the main blocker for this is building the docs that they need to import systemd and that can't be done from a checkout even with setting PYTHONPATH=build/src. @behrmann was working on moving the tests to a meson target with a virtualenv and an editable install so that would need to be finished first.

)
endif
3 changes: 3 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

option('docs', type : 'boolean', value : false)