1 # Extract list of man pages (one man page per symbol) from lib/libfribidi.def
2 python3 = import('python3').find_python()
4 result = run_command(python3,
5 '-c', 'import sys; print(open(sys.argv[1], "r").read())',
6 files('../lib/fribidi.def'))
8 if result.returncode() != 0
9 error('Could not extract list of symbols from fribidi.def.')
14 syms = result.stdout().strip().split('\n')
16 # for consistency with autotools build and because we don't pass -v to c2man
17 if sym != 'fribidi_unicode_version' and sym != 'fribidi_version_info'
18 gen_man_pages += ['@0@.3'.format(sym)]
22 # check if we have a tarball which contains the generated files
23 result = run_command(python3, '-c', '''import os.path; import sys
24 sys.exit(0 if os.path.isfile('@0@') else 1)'''.format(join_paths(meson.current_source_dir(), gen_man_pages[0])))
25 have_man_pages = result.returncode() == 0
26 message('Have pre-generated man pages: @0@'.format(have_man_pages))
29 install_man(gen_man_pages)
31 c2man = find_program('c2man', required: false)
33 error('c2man is required to build documentation from git. Or disable with -Ddocs=false')
37 c2man_incs += ['-I' + join_paths(meson.source_root(), 'lib')]
38 c2man_incs += ['-I' + join_paths(meson.build_root(), 'lib')]
39 c2man_incs += ['-I' + join_paths(meson.source_root(), 'gen.tab')]
40 c2man_incs += ['-I' + join_paths(meson.build_root(), 'gen.tab')]
42 custom_target('man pages',
43 command: [c2man, '-T', 'n', '-M', 'Programmer\'s Manual', c2man_incs,
44 '-D__FRIBIDI_DOC', '-DDONT_HAVE_FRIBIDI_CONFIG_H',
45 '-o@0@'.format(meson.current_build_dir()),
47 depends: [fribidi_unicode_version_h],
48 output: gen_man_pages,
49 install_dir: join_paths(get_option('prefix'), get_option('mandir'), 'man3'),