summaryrefslogtreecommitdiff
path: root/doc/meson.build
blob: 06b66e5579be2a4e13f3af96b8df0d2f479596c8 (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
if not get_option('html_manual')
  subdir_done()
endif

sphinx = find_program('sphinx-build', required: get_option('documentation'))
if not sphinx.found()
  subdir_done()
endif

if get_option('html_manual')
  sphinx_output = custom_target(
    'HTML documentation',
    output: 'html',
    input: [
      'index.rst', 'user.rst', 'developer.rst',
      'plugins.rst',
      'protocol.rst',
      'conf.py',
    ],
    command: [sphinx, '-q', '-b', 'html', '-d', '@OUTDIR@/doctrees', meson.current_source_dir(), '@OUTPUT@'],
    build_by_default: true,
    install: true,
    install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()),
  )

  custom_target(
    'upload',
    input: sphinx_output,
    output: 'upload',
    build_always_stale: true,
    command: [
      'rsync', '-vpruz', '--delete', meson.current_build_dir() + '/',
      'www.musicpd.org:/var/www/mpd/doc/',
      '--chmod=Dug+rwx,Do+rx,Fug+rw,Fo+r',
      '--include=html', '--include=html/**',
      '--exclude=*',
    ],
  )
endif

if get_option('manpages')
  manpages = custom_target(
    'Manpage documentation',
    output: 'man',
    input: ['mpd.1.rst', 'mpd.conf.5.rst', 'conf.py'],
    command: [sphinx, '-q', '-b', 'man', '-d', '@OUTDIR@/man_doctrees', meson.current_source_dir(), '@OUTPUT@'],
    build_by_default: true,
  )

  install_data(join_paths(manpages.full_path(), 'mpd.1'), install_dir: join_paths(get_option('mandir'), 'man1'))
  install_data(join_paths(manpages.full_path(), 'mpd.conf.5'), install_dir: join_paths(get_option('mandir'), 'man5'))
endif