
# Configure_file is just here to rename the files
manconf = configuration_data()
manconf.set('PIKA_VERSION',   pika_version)
manconf.set('pikadatadir',    prefix / pikadatadir)
manconf.set('pikalocaledir',  prefix / localedir)
manconf.set('pikaplugindir',  prefix / pikaplugindir)
manconf.set('manpage_pikadir', '$XDG_CONFIG_HOME/' + pikadir / pika_app_version)
manconf.set('pikasysconfdir', prefix / pikasysconfdir)
manconf.set('mypaint_brushes_dir', mypaint_brushes_dir)


man_files = [
  configure_file(
    input : 'pikatool.1.in',
    output: 'pikatool-' + pika_app_version + '.1',
    configuration: manconf,
  ),
  configure_file(
    input : 'pikarc.5.in',
    output: 'pikarc-' + pika_app_version + '.5',
    configuration: manconf,
  ),
]

if enable_console_bin
  man_files += configure_file(
    input : 'pika.1.in',
    output: 'pika-console-' + pika_app_version + '.1',
    configuration: manconf,
  )
endif

man_files +=  configure_file(
  input : 'pika.1.in',
  output: 'pika-' + pika_app_version + '.1',
  configuration: manconf,
)

install_man(man_files)

if enable_default_bin and meson.version().version_compare('>=0.61.0')
  install_symlink('pikatool.1',
    pointing_to: 'pikatool-' + pika_app_version + '.1',
    install_dir: get_option('mandir') + '/man1'
  )
  install_symlink('pikarc.5',
    pointing_to: 'pikarc-' + pika_app_version + '.5',
    install_dir: get_option('mandir') + '/man5'
  )
  if enable_console_bin
    install_symlink('pika-console.1',
      pointing_to: 'pika-console-' + pika_app_version + '.1',
      install_dir: get_option('mandir') + '/man1'
    )
  endif
  install_symlink('pika.1',
    pointing_to: 'pika-' + pika_app_version + '.1',
    install_dir: get_option('mandir') + '/man1'
  )
endif
