aboutsummaryrefslogtreecommitdiff
path: root/docs/meson.build
blob: a14055c68c1ab8fa739258d1f04117ba8c20c034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
project('Meson documentation', version: '1.0')

cur_bdir = meson.current_build_dir()

# Only the script knows which files are being generated
docs_gen = custom_target(
    'gen_docs',
    input: files('markdown/index.md'),
    output: 'gen_docs.stamp',
    command: [
        files('../tools/regenerate_docs.py'),
        '--output-dir', cur_bdir,
        '--dummy-output-file', '@OUTPUT@',
    ],
    build_by_default: true,
    install: false)

sitemap = files('sitemap.txt')

genrefman = find_program('./genrefman.py')
refman_binary = custom_target(
    'gen_refman_bin',
    input: sitemap,
    output: 'reference_manual.bin',
    depfile: 'reman_dep.d',
    command: [
        genrefman,
        '-l', 'yaml',
        '-g', 'pickle',
        '-o', '@OUTPUT@',
        '--depfile', '@DEPFILE@',
        '--force-color',
    ]
)

refman_md = custom_target(
    'gen_refman_md',
    input: refman_binary,
    output: ['configured_sitemap.txt', 'refman_links.json'],
    command: [
        genrefman,
        '-l', 'pickle',
        '-g', 'md',
        '-s', sitemap,
        '-i', '@INPUT@',
        '-o', '@OUTPUT0@',
        '--link-defs', '@OUTPUT1@',
        '--force-color',
        '--no-modules',
    ],
)
sitemap = refman_md[0]

refman_json = custom_target(
    'gen_refman_json',
    build_by_default: true,
    input: refman_binary,
    output: 'reference_manual.json',
    command: [
        genrefman,
        '-l', 'pickle',
        '-g', 'json',
        '-i', '@INPUT@',
        '-o', '@OUTPUT@',
        '--force-color',
    ],
)

refman_man = custom_target(
    'gen_refman_man',
    build_by_default: true,
    input: refman_binary,
    output: 'meson-reference.3',
    command: [
        genrefman,
        '-l', 'pickle',
        '-g', 'man',
        '-i', '@INPUT@',
        '-o', '@OUTPUT@',
        '--force-color',
        '--no-modules',
    ],
)

genrelnotes = custom_target(
    output: ['sitemap-genrelnotes.txt'],
    build_always_stale: true,
    command: [find_program('genrelnotes.py'),
        '--input-sitemap', sitemap,
        '--output-sitemap', '@OUTPUT0@',
        '--output-dir', meson.current_build_dir(),
        '--source-dir', meson.current_source_dir(),
    ]
)
sitemap = genrelnotes[0]

test('validate_docs', find_program('./jsonvalidator.py'), args: [refman_json])

hotdoc_prog = find_program('hotdoc', version: '>=0.13.7')

hotdoc = import('hotdoc')
documentation = hotdoc.generate_doc(meson.project_name(),
    project_version: meson.project_version(),
    sitemap: sitemap,
    build_by_default: true,
    depends: docs_gen,
    index: 'markdown/index.md',
    install: false,
    extra_assets: ['images/'],
    include_paths: ['markdown', cur_bdir],
    default_license: 'CC-BY-SAv4.0',
    html_extra_theme: join_paths('theme', 'extra'),
    git_upload_repository: 'git@github.com:mesonbuild/mesonbuild.github.io.git',
    edit_on_github_repository: 'https://github.com/mesonbuild/meson',
    syntax_highlighting_activate: true,
    keep_markup_in_code_blocks: true,
    extra_extension: meson.current_source_dir() / 'extensions' / 'refman_links.py',
    refman_data_file: refman_md[1],
)

run_target('upload',
    command: [hotdoc_prog, 'run',
      '--conf-file', documentation.config_path(),
      '--git-upload',
      '-vv',
    ],
    depends: documentation,
)