meson.build 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. data_conf.set('GAMEMODE_PRIVILEGED_GROUP', with_privileged_group)
  8. # Pull in the example config
  9. config_example = run_command(
  10. 'cat',
  11. join_paths(meson.source_root(), 'example', 'gamemode.ini'),
  12. check: true,
  13. ).stdout().strip()
  14. data_conf.set('GAMEMODE_EXAMPLE_CONFIG', config_example)
  15. if sd_bus_provider == 'systemd'
  16. if with_systemd_unit
  17. # Install systemd user unit
  18. configure_file(
  19. input: 'systemd/user/gamemoded.service.in',
  20. output: 'gamemoded.service',
  21. configuration: data_conf,
  22. install_dir: path_systemd_unit_dir,
  23. )
  24. endif
  25. if with_systemd_group
  26. # Install the sysusers.d file
  27. configure_file(
  28. input: 'systemd/sysusers.d/gamemode.conf.in',
  29. output: 'gamemode.conf',
  30. configuration: data_conf,
  31. install_dir: path_systemd_group_dir,
  32. )
  33. endif
  34. endif
  35. if with_pam_renicing
  36. # Install the limits.d configuration file
  37. configure_file(
  38. input: 'pam_limits/10-gamemode.conf.in',
  39. output: '10-gamemode.conf',
  40. configuration: data_conf,
  41. install_dir: '/etc/security/limits.d',
  42. )
  43. endif
  44. # Install the D-BUS service file
  45. configure_file(
  46. input: 'dbus/com.feralinteractive.GameMode.service.in',
  47. output: 'com.feralinteractive.GameMode.service',
  48. configuration: data_conf,
  49. install_dir: path_dbus_service_dir,
  50. )
  51. # Install the Polkit action & rule files for the privileged gamemode group
  52. if with_privileged_group != ''
  53. configure_file(
  54. input: 'polkit/actions/com.feralinteractive.GameMode.policy.in',
  55. output: 'com.feralinteractive.GameMode.policy',
  56. configuration: data_conf,
  57. install_dir: path_polkit_action_dir,
  58. )
  59. configure_file(
  60. input: 'polkit/rules.d/gamemode.rules.in',
  61. output: 'gamemode.rules',
  62. configuration: data_conf,
  63. install_dir: path_polkit_rule_dir,
  64. )
  65. endif
  66. # Install the helper run script
  67. install_data(
  68. files('gamemoderun'),
  69. install_dir: path_bindir,
  70. install_mode: 'rwxr-xr-x',
  71. )
  72. # Install script to find processes with gamemode lib in runtime
  73. install_data(
  74. files('gamemodelist'),
  75. install_dir: path_bindir,
  76. install_mode: 'rwxr-xr-x',
  77. )
  78. # Configure and install man pages
  79. gamemoded_manpage = configure_file(
  80. input: files('gamemoded.8.in'),
  81. output: 'gamemoded.8',
  82. configuration: data_conf,
  83. )
  84. install_man(
  85. gamemoded_manpage,
  86. install_dir: join_paths(path_mandir, 'man8')
  87. )
  88. gamemoderun_manpage = configure_file(
  89. input: files('gamemoderun.1.in'),
  90. output: 'gamemoderun.1',
  91. configuration: data_conf,
  92. )
  93. install_man(
  94. gamemoderun_manpage,
  95. install_dir: join_paths(path_mandir, 'man1')
  96. )
  97. gamemodelist_manpage = configure_file(
  98. input: files('gamemodelist.1.in'),
  99. output: 'gamemodelist.1',
  100. configuration: data_conf,
  101. )
  102. install_man(
  103. gamemodelist_manpage,
  104. install_dir: join_paths(path_mandir, 'man1')
  105. )
  106. if with_examples
  107. example_manpage = configure_file(
  108. input: files('gamemode-simulate-game.1.in'),
  109. output: 'gamemode-simulate-game.1',
  110. configuration: data_conf,
  111. )
  112. install_man(
  113. example_manpage,
  114. install_dir: join_paths(path_mandir, 'man1')
  115. )
  116. endif
  117. # Install metainfo
  118. metainfo_file = files('io.github.feralinteractive.gamemode.metainfo.xml')
  119. install_data(
  120. metainfo_file,
  121. install_dir: path_metainfo,
  122. )
  123. # Validate metainfo
  124. appstreamcli = find_program(
  125. 'appstreamcli',
  126. required: false
  127. )
  128. if appstreamcli.found()
  129. test(
  130. 'validate metainfo file',
  131. appstreamcli,
  132. args: ['validate', '--no-net', '--pedantic', metainfo_file],
  133. )
  134. endif