mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-20 06:50:06 +01:00
meson: hook up the protocol documentation via meson
Since we want the generated documentation to be useful on-disk, drop the baseURL and switch to relativeURLs = true for hugo. This is arguably a bit nasty in that it git clones the theme into the build directory. But oh well...
This commit is contained in:
parent
248d08c6a5
commit
2cf6df9cd0
8 changed files with 54 additions and 11 deletions
|
|
@ -280,9 +280,8 @@ pages:
|
||||||
MESON_ARGS: "-Ddocumentation=true"
|
MESON_ARGS: "-Ddocumentation=true"
|
||||||
script:
|
script:
|
||||||
- .gitlab-ci/meson-build.sh
|
- .gitlab-ci/meson-build.sh
|
||||||
- ./doc/hugo/generate-protocol-docs.sh -v --scanner "$PWD/proto/ei-scanner" --protocol "$PWD/proto/protocol.xml" --index-page "$PWD/README.md" --template-dir "$PWD/doc/hugo" --output-dir "$PWD/_hugo"
|
- rm -rf public/
|
||||||
- cd _hugo/ei && hugo && cd ../..
|
- mv "$MESON_BUILDDIR"/doc/protocol/ei/public/ public/
|
||||||
- mv _hugo/ei/public/ public/
|
|
||||||
- mkdir -p public/api
|
- mkdir -p public/api
|
||||||
- mv "$MESON_BUILDDIR"/doc/html/ public/api
|
- mv "$MESON_BUILDDIR"/doc/html/ public/api
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -307,9 +307,8 @@ pages:
|
||||||
MESON_ARGS: "-Ddocumentation=true"
|
MESON_ARGS: "-Ddocumentation=true"
|
||||||
script:
|
script:
|
||||||
- .gitlab-ci/meson-build.sh
|
- .gitlab-ci/meson-build.sh
|
||||||
- ./doc/hugo/generate-protocol-docs.sh -v --scanner "$PWD/proto/ei-scanner" --protocol "$PWD/proto/protocol.xml" --index-page "$PWD/README.md" --template-dir "$PWD/doc/hugo" --output-dir "$PWD/_hugo"
|
- rm -rf public/
|
||||||
- cd _hugo/ei && hugo && cd ../..
|
- mv "$MESON_BUILDDIR"/doc/protocol/ei/public/ public/
|
||||||
- mv _hugo/ei/public/ public/
|
|
||||||
- mkdir -p public/api
|
- mkdir -p public/api
|
||||||
- mv "$MESON_BUILDDIR"/doc/html/ public/api
|
- mv "$MESON_BUILDDIR"/doc/html/ public/api
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
subdir('api')
|
subdir('api')
|
||||||
|
subdir('protocol')
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
baseURL = 'https://libinput.pages.freedesktop.org/libei/'
|
# baseURL = 'https://libinput.pages.freedesktop.org/libei/'
|
||||||
languageCode = 'en-us'
|
languageCode = 'en-us'
|
||||||
title = 'ei protocol documentation'
|
title = 'ei protocol documentation'
|
||||||
theme = 'hugo-theme-relearn'
|
theme = 'hugo-theme-relearn'
|
||||||
|
relativeURLs = true
|
||||||
|
|
@ -2,13 +2,10 @@
|
||||||
#
|
#
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
REPO_BASE_DIR="$PWD"
|
||||||
|
|
||||||
SCANNER="$PWD/ei-scanner"
|
|
||||||
PROTOFILE="$PWD/protocol.xml"
|
|
||||||
TEMPLATEDIR="$PWD"
|
|
||||||
OUTDIR="$PWD"
|
OUTDIR="$PWD"
|
||||||
SITENAME="ei"
|
SITENAME="ei"
|
||||||
INDEXPAGE=""
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
@ -36,6 +33,10 @@ while [[ $# -gt 0 ]]; do
|
||||||
INDEXPAGE="$2"
|
INDEXPAGE="$2"
|
||||||
shift 2;
|
shift 2;
|
||||||
;;
|
;;
|
||||||
|
--git-repo)
|
||||||
|
REPO_BASE_DIR="$2"
|
||||||
|
shift 2;
|
||||||
|
;;
|
||||||
**)
|
**)
|
||||||
echo "Unknown argument: $1"
|
echo "Unknown argument: $1"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -43,6 +44,22 @@ while [[ $# -gt 0 ]]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ -z "$SCANNER" ]]; then
|
||||||
|
SCANNER="$REPO_BASE_DIR/proto/ei-scanner"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$PROTOFILE" ]]; then
|
||||||
|
PROTOFILE="$REPO_BASE_DIR/proto/protocol.xml"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$TEMPLATEDIR" ]]; then
|
||||||
|
TEMPLATEDIR="$REPO_BASE_DIR/doc/protocol/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$INDEXPAGE" ]]; then
|
||||||
|
INDEXPAGE="$REPO_BASE_DIR/README.md"
|
||||||
|
fi
|
||||||
|
|
||||||
SITEDIR="$OUTDIR/$SITENAME"
|
SITEDIR="$OUTDIR/$SITENAME"
|
||||||
if [[ -e "$SITEDIR" ]]; then
|
if [[ -e "$SITEDIR" ]]; then
|
||||||
echo "$SITEDIR already exists, updating"
|
echo "$SITEDIR already exists, updating"
|
||||||
|
|
@ -84,4 +101,6 @@ done < <($SCANNER --component=ei "$PROTOFILE" - <<EOF
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hugo
|
||||||
|
|
||||||
popd > /dev/null || exit 1
|
popd > /dev/null || exit 1
|
||||||
24
doc/protocol/meson.build
Normal file
24
doc/protocol/meson.build
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
if not get_option('documentation')
|
||||||
|
subdir_done()
|
||||||
|
endif
|
||||||
|
|
||||||
|
hugo = find_program('hugo', required : false)
|
||||||
|
if not hugo.found()
|
||||||
|
error('Program "hugo" not found or not executable. Try building with -Ddocumentation=false')
|
||||||
|
endif
|
||||||
|
|
||||||
|
hugo_script = find_program('generate-protocol-docs.sh')
|
||||||
|
|
||||||
|
src_hugo = files(
|
||||||
|
'config.toml',
|
||||||
|
'chapter.md.tmpl',
|
||||||
|
'interface.md.tmpl',
|
||||||
|
)
|
||||||
|
|
||||||
|
custom_target('hugo',
|
||||||
|
input : src_hugo + [protocol_xml],
|
||||||
|
output : [ 'doc' ],
|
||||||
|
command : [ hugo_script, '--git-repo', meson.project_source_root(), '--output-dir', meson.current_build_dir() ],
|
||||||
|
install : false,
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
Loading…
Add table
Reference in a new issue