| 1 |
gidocgen = find_program('gi-docgen', required: get_option('documentation'), native: true) |
| 2 |
|
| 3 |
gidocgen_common_args = [ |
| 4 |
'--quiet', |
| 5 |
'--no-namespace-dir', |
| 6 |
] |
| 7 |
|
| 8 |
if get_option('werror') |
| 9 |
gidocgen_common_args += ['--fatal-warnings'] |
| 10 |
endif |
| 11 |
|
| 12 |
docs_dir = pango_datadir / 'doc' |
| 13 |
|
| 14 |
if get_option('documentation') and not build_gir |
| 15 |
error('API reference requires introspection.') |
| 16 |
endif |
| 17 |
|
| 18 |
pango_content_files = [ |
| 19 |
'pango_rendering.md', |
| 20 |
'pango_markup.md', |
| 21 |
'pango_fonts.md', |
| 22 |
'pango_bidi.md', |
| 23 |
'pango-name.png', |
| 24 |
'layout-light.png', |
| 25 |
'layout-dark.png', |
| 26 |
'pipeline-light.png', |
| 27 |
'pipeline-dark.png', |
| 28 |
'rects1.png', |
| 29 |
'rects2.png', |
| 30 |
'rects3.png', |
| 31 |
'arabic-markup.png', |
| 32 |
'blue-text.png', |
| 33 |
'align-left.png', |
| 34 |
'align-center.png', |
| 35 |
'align-right.png', |
| 36 |
'align-left-justify.png', |
| 37 |
'align-center-justify.png', |
| 38 |
'align-right-justify.png', |
| 39 |
'vertical-light.png', |
| 40 |
'vertical-dark.png', |
| 41 |
'm-south.png', |
| 42 |
'm-west.png', |
| 43 |
'm-north.png', |
| 44 |
'm-east.png', |
| 45 |
'bidi-input-light.png', |
| 46 |
'bidi-input-dark.png', |
| 47 |
'bidi-annotate-light.png', |
| 48 |
'bidi-annotate-dark.png', |
| 49 |
'split-cursor.png', |
| 50 |
'split-cursor-light.png', |
| 51 |
'split-cursor-dark.png', |
| 52 |
'fontmetrics-light.png', |
| 53 |
'fontmetrics-dark.png', |
| 54 |
'caret-metrics-light.png', |
| 55 |
'caret-metrics-dark.png', |
| 56 |
'cursor-positions-light.png', |
| 57 |
'cursor-positions-dark.png', |
| 58 |
'glyphstring-positions-light.png', |
| 59 |
'glyphstring-positions-dark.png', |
| 60 |
'baseline-shift-light.png', |
| 61 |
'baseline-shift-dark.png', |
| 62 |
] |
| 63 |
|
| 64 |
doc_conf = configuration_data() |
| 65 |
doc_conf.set('PANGO_VERSION', meson.project_version()) |
| 66 |
|
| 67 |
if get_option('documentation') |
| 68 |
pango_toml = configure_file(input: 'pango.toml.in', |
| 69 |
output: 'pango.toml', |
| 70 |
configuration: doc_conf) |
| 71 |
|
| 72 |
custom_target('pango-doc', |
| 73 |
input: pango_gir[0], |
| 74 |
output: 'Pango', |
| 75 |
command: [ |
| 76 |
gidocgen, |
| 77 |
'generate', |
| 78 |
gidocgen_common_args, |
| 79 |
'--add-include-path=@0@'.format(meson.current_build_dir() / '../pango'), |
| 80 |
'--config', pango_toml, |
| 81 |
'--output-dir=@OUTPUT@', |
| 82 |
'--content-dir=@0@'.format(meson.current_source_dir()), |
| 83 |
'@INPUT@', |
| 84 |
], |
| 85 |
depend_files: [ pango_toml, pango_content_files], |
| 86 |
build_by_default: true, |
| 87 |
install: true, |
| 88 |
install_dir: docs_dir, |
| 89 |
) |
| 90 |
|
| 91 |
if build_pangoft2 |
| 92 |
pangoft2_toml = configure_file(input: 'pangoft2.toml.in', |
| 93 |
output: 'pangoft2.toml', |
| 94 |
configuration: doc_conf) |
| 95 |
|
| 96 |
custom_target('pangoft-doc', |
| 97 |
input: pangoft2_gir[0], |
| 98 |
output: 'PangoFT2', |
| 99 |
command: [ |
| 100 |
gidocgen, |
| 101 |
'generate', |
| 102 |
gidocgen_common_args, |
| 103 |
'--add-include-path=@0@'.format(meson.current_build_dir() / '../pango'), |
| 104 |
'--config', pangoft2_toml, |
| 105 |
'--output-dir=@OUTPUT@', |
| 106 |
'--content-dir=@0@'.format(meson.current_source_dir()), |
| 107 |
'@INPUT@', |
| 108 |
], |
| 109 |
depend_files: [ pangoft2_toml, 'pango-name.png' ], |
| 110 |
build_by_default: true, |
| 111 |
install: true, |
| 112 |
install_dir: docs_dir, |
| 113 |
) |
| 114 |
endif |
| 115 |
|
| 116 |
if xft_dep.found() and fontconfig_dep.found() |
| 117 |
pangoxft_toml = configure_file(input: 'pangoxft.toml.in', |
| 118 |
output: 'pangoxft.toml', |
| 119 |
configuration: doc_conf) |
| 120 |
|
| 121 |
custom_target('pangoxft-doc', |
| 122 |
input: pangoxft_gir[0], |
| 123 |
output: 'PangoXft', |
| 124 |
command: [ |
| 125 |
gidocgen, |
| 126 |
'generate', |
| 127 |
gidocgen_common_args, |
| 128 |
'--add-include-path=@0@'.format(meson.current_build_dir() / '../pango'), |
| 129 |
'--config', pangoxft_toml, |
| 130 |
'--output-dir=@OUTPUT@', |
| 131 |
'--content-dir=@0@'.format(meson.current_source_dir()), |
| 132 |
'@INPUT@', |
| 133 |
], |
| 134 |
depend_files: [ pangoxft_toml, 'pango-name.png' ], |
| 135 |
build_by_default: true, |
| 136 |
install: true, |
| 137 |
install_dir: docs_dir, |
| 138 |
) |
| 139 |
endif |
| 140 |
|
| 141 |
if cairo_dep.found() |
| 142 |
pangocairo_content_files = [ |
| 143 |
'pango_cairo.md', |
| 144 |
'pango-name.png', |
| 145 |
'rotated-text.png', |
| 146 |
] |
| 147 |
|
| 148 |
pangocairo_toml = configure_file(input: 'pangocairo.toml.in', |
| 149 |
output: 'pangocairo.toml', |
| 150 |
configuration: doc_conf) |
| 151 |
|
| 152 |
custom_target('pangocairo-doc', |
| 153 |
input: pangocairo_gir[0], |
| 154 |
output: 'PangoCairo', |
| 155 |
command: [ |
| 156 |
gidocgen, |
| 157 |
'generate', |
| 158 |
gidocgen_common_args, |
| 159 |
'--add-include-path=@0@'.format(meson.current_build_dir() / '../pango'), |
| 160 |
'--config', pangocairo_toml, |
| 161 |
'--output-dir=@OUTPUT@', |
| 162 |
'--content-dir=@0@'.format(meson.current_source_dir()), |
| 163 |
'@INPUT@', |
| 164 |
], |
| 165 |
depend_files: [ pangocairo_toml, pangocairo_content_files ], |
| 166 |
build_by_default: true, |
| 167 |
install: true, |
| 168 |
install_dir: docs_dir, |
| 169 |
) |
| 170 |
endif |
| 171 |
|
| 172 |
if fontconfig_dep.found() |
| 173 |
pangoot_toml = configure_file(input: 'pangoot.toml.in', |
| 174 |
output: 'pangoot.toml', |
| 175 |
configuration: doc_conf) |
| 176 |
|
| 177 |
custom_target('pangoot-doc', |
| 178 |
input: pangoot_gir[0], |
| 179 |
output: 'PangoOT', |
| 180 |
command: [ |
| 181 |
gidocgen, |
| 182 |
'generate', |
| 183 |
gidocgen_common_args, |
| 184 |
'--add-include-path=@0@'.format(meson.current_build_dir() / '../pango'), |
| 185 |
'--config', pangoot_toml, |
| 186 |
'--output-dir=@OUTPUT@', |
| 187 |
'--content-dir=@0@'.format(meson.current_source_dir()), |
| 188 |
'@INPUT@', |
| 189 |
], |
| 190 |
depend_files: [ pangoot_toml, 'pango-name.png' ], |
| 191 |
build_by_default: true, |
| 192 |
install: true, |
| 193 |
install_dir: docs_dir, |
| 194 |
) |
| 195 |
|
| 196 |
pangofc_toml = configure_file(input: 'pangofc.toml.in', |
| 197 |
output: 'pangofc.toml', |
| 198 |
configuration: doc_conf) |
| 199 |
|
| 200 |
custom_target('pangofc-doc', |
| 201 |
input: pangofc_gir[0], |
| 202 |
output: 'PangoFc', |
| 203 |
command: [ |
| 204 |
gidocgen, |
| 205 |
'generate', |
| 206 |
gidocgen_common_args, |
| 207 |
'--add-include-path=@0@'.format(meson.current_build_dir() / '../pango'), |
| 208 |
'--config', pangofc_toml, |
| 209 |
'--output-dir=@OUTPUT@', |
| 210 |
'--content-dir=@0@'.format(meson.current_source_dir()), |
| 211 |
'@INPUT@', |
| 212 |
], |
| 213 |
depend_files: [ pangofc_toml, 'pango-name.png' ], |
| 214 |
build_by_default: true, |
| 215 |
install: true, |
| 216 |
install_dir: docs_dir, |
| 217 |
) |
| 218 |
endif |
| 219 |
endif |
| 220 |
|
| 221 |
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages')) |
| 222 |
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation')) |
| 223 |
|
| 224 |
rst_files = [ |
| 225 |
[ 'pango-view', '1' ], |
| 226 |
[ 'pango-list', '1' ], |
| 227 |
[ 'pango-segmentation', '1' ], |
| 228 |
] |
| 229 |
|
| 230 |
rst2x_flags = [ |
| 231 |
'--syntax-highlight=none', |
| 232 |
] |
| 233 |
|
| 234 |
if get_option('man-pages') |
| 235 |
|
| 236 |
foreach rst: rst_files |
| 237 |
man_name = rst[0] |
| 238 |
man_section = rst.get(1, '1') |
| 239 |
|
| 240 |
custom_target('man-@0@'.format(man_name), |
| 241 |
input: '@[email protected]'.format(man_name), |
| 242 |
output: '@0@.@1@'.format(man_name, man_section), |
| 243 |
command: [ |
| 244 |
rst2man, |
| 245 |
rst2x_flags, |
| 246 |
'@INPUT@', |
| 247 |
], |
| 248 |
capture: true, |
| 249 |
install: true, |
| 250 |
install_dir: get_option('mandir') / 'man@0@'.format(man_section), |
| 251 |
install_tag: 'doc', |
| 252 |
) |
| 253 |
endforeach |
| 254 |
endif |
| 255 |
|
| 256 |
if get_option('documentation') |
| 257 |
|
| 258 |
foreach rst: rst_files |
| 259 |
man_name = rst[0] |
| 260 |
|
| 261 |
custom_target( |
| 262 |
input: '@[email protected]'.format(man_name), |
| 263 |
output: '@[email protected]'.format(man_name), |
| 264 |
command: [ |
| 265 |
rst2html5, |
| 266 |
rst2x_flags, |
| 267 |
'@INPUT@', |
| 268 |
], |
| 269 |
capture: true, |
| 270 |
install: true, |
| 271 |
install_dir: docs_dir / 'Pango', |
| 272 |
install_tag: 'doc', |
| 273 |
) |
| 274 |
endforeach |
| 275 |
endif |