pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
gnome = import('gnome')

gnome.compile_resources('confy',
  'confy.gresource.xml',
  gresource_bundle: true,
  install: true,
  install_dir: pkgdatadir,
)

python = import('python')
python3 = python.find_installation('python3')
pythondir = python3.get_install_dir()
moduledir = join_paths(pythondir, 'confy')

conf = configuration_data()
conf.set('PYTHON', python3.path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)
conf.set('pythondir', pythondir)

configure_file(
  input: 'confy.in',
  output: 'confy',
  configuration: conf,
  install: true,
  install_dir: get_option('bindir')
)

configure_file(
  input: 'config.py.in',
  output: 'config.py',
  configuration: conf,
  install: true,
  install_dir: moduledir
)

confy_sources = [
  '__init__.py',
  'main.py',
  'window.py',
  'widgets.py',
  'pages.py',
  'models.py',
  'local.py',
  'settings.py',
  'fetcher.py',
  'preferences.py',
]

install_data(confy_sources, install_dir: moduledir)

subdir('migrations')
subdir('remotes')

