meson.build 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. data_conf = configuration_data()
  2. data_conf.set('BINDIR', path_bindir)
  3. data_conf.set('LIBEXECDIR', path_libexecdir)
  4. data_conf.set('SYSCONFDIR', path_sysconfdir)
  5. data_conf.set('GAMEMODE_PREFIX', path_prefix)
  6. data_conf.set('GAMEMODE_VERSION', meson.project_version())
  7. # Pull in the example config
  8. config_example = run_command(
  9. 'cat',
  10. join_paths(meson.source_root(), 'example', 'gamemode.ini'),
  11. check: true,
  12. ).stdout().strip()
  13. data_conf.set('GAMEMODE_EXAMPLE_CONFIG', config_example)
  14. if sd_bus_provider == 'systemd'
  15. # Install systemd user unit
  16. configure_file(
  17. input: 'gamemoded.service.in',
  18. output: 'gamemoded.service',
  19. configuration: data_conf,
  20. install_dir: path_systemd_unit_dir,
  21. )
  22. # Install the sysusers.d file
  23. install_data(
  24. files('gamemode.conf'),
  25. install_dir: path_systemd_sysusers_dir,
  26. )
  27. endif
  28. # Install the D-BUS service file
  29. configure_file(
  30. input: 'com.feralinteractive.GameMode.service.in',
  31. output: 'com.feralinteractive.GameMode.service',
  32. configuration: data_conf,
  33. install_dir: path_dbus_service_dir,
  34. )
  35. # Install the Polkit action file in all cases
  36. configure_file(
  37. input: 'com.feralinteractive.GameMode.policy.in',
  38. output: 'com.feralinteractive.GameMode.policy',
  39. configuration: data_conf,
  40. install_dir: path_polkit_action_dir,
  41. )
  42. # Install the helper run script
  43. install_data(
  44. files('gamemoderun'),
  45. install_dir: path_bindir,
  46. install_mode: 'rwxr-xr-x',
  47. )
  48. # Install script to find processes with gamemode lib in runtime
  49. install_data(
  50. files('gamemodelist'),
  51. install_dir: path_bindir,
  52. install_mode: 'rwxr-xr-x',
  53. )
  54. # Configure and install man pages
  55. gamemoded_manpage = configure_file(
  56. input: files('gamemoded.8.in'),
  57. output: 'gamemoded.8',
  58. configuration: data_conf,
  59. )
  60. install_man(
  61. gamemoded_manpage,
  62. install_dir: join_paths(path_mandir, 'man8')
  63. )
  64. gamemoderun_manpage = configure_file(
  65. input: files('gamemoderun.1.in'),
  66. output: 'gamemoderun.1',
  67. configuration: data_conf,
  68. )
  69. install_man(
  70. gamemoderun_manpage,
  71. install_dir: join_paths(path_mandir, 'man1')
  72. )
  73. gamemodelist_manpage = configure_file(
  74. input: files('gamemodelist.1.in'),
  75. output: 'gamemodelist.1',
  76. configuration: data_conf,
  77. )
  78. install_man(
  79. gamemodelist_manpage,
  80. install_dir: join_paths(path_mandir, 'man1')
  81. )
  82. if with_examples
  83. example_manpage = configure_file(
  84. input: files('gamemode-simulate-game.1.in'),
  85. output: 'gamemode-simulate-game.1',
  86. configuration: data_conf,
  87. )
  88. install_man(
  89. example_manpage,
  90. install_dir: join_paths(path_mandir, 'man1')
  91. )
  92. endif
  93. # Install metainfo
  94. metainfo_file = files('io.github.feralinteractive.gamemode.metainfo.xml')
  95. install_data(
  96. metainfo_file,
  97. install_dir: path_metainfo,
  98. )
  99. # Validate metainfo
  100. appstreamcli = find_program(
  101. 'appstreamcli',
  102. required: false
  103. )
  104. if appstreamcli.found()
  105. test(
  106. 'validate metainfo file',
  107. appstreamcli,
  108. args: ['validate', '--no-net', '--pedantic', metainfo_file],
  109. )
  110. endif