meson.build 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 file in all cases
  52. configure_file(
  53. input: 'polkit/actions/com.feralinteractive.GameMode.policy.in',
  54. output: 'com.feralinteractive.GameMode.policy',
  55. configuration: data_conf,
  56. install_dir: path_polkit_action_dir,
  57. )
  58. # Install the helper run script
  59. install_data(
  60. files('gamemoderun'),
  61. install_dir: path_bindir,
  62. install_mode: 'rwxr-xr-x',
  63. )
  64. # Install script to find processes with gamemode lib in runtime
  65. install_data(
  66. files('gamemodelist'),
  67. install_dir: path_bindir,
  68. install_mode: 'rwxr-xr-x',
  69. )
  70. # Configure and install man pages
  71. gamemoded_manpage = configure_file(
  72. input: files('gamemoded.8.in'),
  73. output: 'gamemoded.8',
  74. configuration: data_conf,
  75. )
  76. install_man(
  77. gamemoded_manpage,
  78. install_dir: join_paths(path_mandir, 'man8')
  79. )
  80. gamemoderun_manpage = configure_file(
  81. input: files('gamemoderun.1.in'),
  82. output: 'gamemoderun.1',
  83. configuration: data_conf,
  84. )
  85. install_man(
  86. gamemoderun_manpage,
  87. install_dir: join_paths(path_mandir, 'man1')
  88. )
  89. gamemodelist_manpage = configure_file(
  90. input: files('gamemodelist.1.in'),
  91. output: 'gamemodelist.1',
  92. configuration: data_conf,
  93. )
  94. install_man(
  95. gamemodelist_manpage,
  96. install_dir: join_paths(path_mandir, 'man1')
  97. )
  98. if with_examples
  99. example_manpage = configure_file(
  100. input: files('gamemode-simulate-game.1.in'),
  101. output: 'gamemode-simulate-game.1',
  102. configuration: data_conf,
  103. )
  104. install_man(
  105. example_manpage,
  106. install_dir: join_paths(path_mandir, 'man1')
  107. )
  108. endif
  109. # Install metainfo
  110. metainfo_file = files('io.github.feralinteractive.gamemode.metainfo.xml')
  111. install_data(
  112. metainfo_file,
  113. install_dir: path_metainfo,
  114. )
  115. # Validate metainfo
  116. appstreamcli = find_program(
  117. 'appstreamcli',
  118. required: false
  119. )
  120. if appstreamcli.found()
  121. test(
  122. 'validate metainfo file',
  123. appstreamcli,
  124. args: ['validate', '--no-net', '--pedantic', metainfo_file],
  125. )
  126. endif