meson.build 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. project(
  2. 'gnome-settings-daemon', 'c',
  3. version: '3.28.1',
  4. license: [ 'GPL2+', 'LGPLv2+' ],
  5. meson_version: '>= 0.44.0'
  6. )
  7. gsd_version = meson.project_version()
  8. version_array = gsd_version.split('.')
  9. gsd_major_version = version_array[0].to_int()
  10. gsd_api_version_minor = 0
  11. gsd_api_version = '@0@.@1@'.format(gsd_major_version, gsd_api_version_minor)
  12. gsd_api_name = '@0@-@1@'.format(meson.project_name(), gsd_api_version)
  13. gsd_prefix = get_option('prefix')
  14. gsd_bindir = join_paths(gsd_prefix, get_option('bindir'))
  15. gsd_datadir = join_paths(gsd_prefix, get_option('datadir'))
  16. gsd_includedir = join_paths(gsd_prefix, get_option('includedir'))
  17. gsd_libdir = join_paths(gsd_prefix, get_option('libdir'))
  18. gsd_libexecdir = join_paths(gsd_prefix, get_option('libexecdir'))
  19. gsd_localedir = join_paths(gsd_prefix, get_option('localedir'))
  20. gsd_sysconfdir = join_paths(gsd_prefix, get_option('sysconfdir'))
  21. gsd_pkgdatadir = join_paths(gsd_datadir, meson.project_name())
  22. gsd_pkgincludedir = join_paths(gsd_includedir, gsd_api_name)
  23. gsd_pkglibdir = join_paths(gsd_libdir, gsd_api_name)
  24. gsd_schemadir = join_paths(gsd_datadir, 'glib-2.0', 'schemas')
  25. gsd_xdg_autostart = join_paths(gsd_sysconfdir, 'xdg', 'autostart')
  26. gsd_buildtype = get_option('buildtype')
  27. host_is_darwin = host_machine.system().contains('darwin')
  28. host_is_linux = host_machine.system().contains('linux')
  29. host_is_linux_not_s390 = host_is_linux and not host_machine.cpu().contains('s390')
  30. cc = meson.get_compiler('c')
  31. config_h = configuration_data()
  32. # defines
  33. set_defines = [
  34. ['PACKAGE_NAME', meson.project_name()],
  35. ['PACKAGE_VERSION', gsd_version],
  36. # i18n
  37. ['GETTEXT_PACKAGE', meson.project_name()]
  38. ]
  39. foreach define: set_defines
  40. config_h.set_quoted(define[0], define[1])
  41. endforeach
  42. # compiler flags
  43. common_flags = ['-DHAVE_CONFIG_H']
  44. compiler_flags = []
  45. if gsd_buildtype.contains('debug')
  46. common_flags += ['-DG_ENABLE_DEBUG']
  47. test_cflags = [
  48. '-Wcast-align',
  49. '-Wmissing-declarations',
  50. '-Wmissing-prototypes',
  51. '-Wnested-externs',
  52. '-Wno-strict-aliasing',
  53. '-Wno-sign-compare',
  54. '-Wpointer-arith'
  55. ]
  56. compiler_flags = cc.get_supported_arguments(test_cflags)
  57. elif gsd_buildtype.contains('release')
  58. common_flags += ['-DG_DISABLE_CAST_CHECKS']
  59. endif
  60. # Workaround for meson's bug
  61. # https://github.com/mesonbuild/meson/pull/1896
  62. if get_option('b_ndebug') == true
  63. common_flags += ['-DG_DISABLE_ASSERT']
  64. endif
  65. add_project_arguments(common_flags + compiler_flags, language: 'c')
  66. colord_dep = dependency('colord', version: '>= 1.0.2')
  67. geocode_glib_dep = dependency('geocode-glib-1.0', version: '>= 3.10.0')
  68. gio_dep = dependency('gio-2.0', version: '>= 2.53.0')
  69. gio_unix_dep = dependency('gio-unix-2.0')
  70. gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.11.1')
  71. gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.23.3')
  72. gtk_dep = dependency('gtk+-3.0', version: '>= 3.15.3')
  73. gtk_x11_dep = dependency('gtk+-x11-3.0')
  74. gweather_dep = dependency('gweather-3.0', version: '>= 3.9.5')
  75. lcms_dep = dependency('lcms2', version: '>= 2.2')
  76. libcanberra_gtk_dep = dependency('libcanberra-gtk3')
  77. libgeoclue_dep = dependency('libgeoclue-2.0', version: '>= 2.3.1')
  78. libnotify_dep = dependency('libnotify', version: '>= 0.7.3')
  79. libpulse_mainloop_glib_dep = dependency('libpulse-mainloop-glib', version: '>= 2.0')
  80. pango_dep = dependency('pango', version: '>= 1.20.0')
  81. polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.103')
  82. upower_glib_dep = dependency('upower-glib', version: '>= 0.99.0')
  83. x11_dep = dependency('x11')
  84. xtst_dep = dependency('xtst')
  85. m_dep = cc.find_library('m')
  86. # ALSA integration (default enabled)
  87. enable_alsa = get_option('alsa')
  88. assert(enable_alsa or not host_is_linux, 'ALSA is not optional on Linux platforms')
  89. libgvc = subproject(
  90. 'gvc',
  91. default_options: [
  92. 'static=true',
  93. 'alsa=' + enable_alsa.to_string()
  94. ]
  95. )
  96. libgvc_dep = libgvc.get_variable('libgvc_dep')
  97. # GUdev integration (default enabled)
  98. enable_gudev = get_option('gudev')
  99. if enable_gudev
  100. assert(enable_gudev, 'GUdev is not optional on Linux platforms')
  101. gudev_dep = dependency('gudev-1.0')
  102. endif
  103. config_h.set('HAVE_GUDEV', enable_gudev)
  104. # Check for libwayland-client
  105. enable_wayland = get_option('wayland')
  106. if enable_wayland
  107. assert(enable_gudev, 'GUDev support is required for wayland support.')
  108. wayland_client_dep = dependency('wayland-client')
  109. endif
  110. config_h.set('HAVE_WAYLAND', enable_wayland)
  111. # wacom (disabled for s390/s390x and non Linux platforms)
  112. enable_wacom = host_is_linux_not_s390
  113. if enable_wacom
  114. assert(enable_gudev, 'GUDev support is required for wacom support.')
  115. libwacom_dep = dependency('libwacom', version: '>= 0.7')
  116. endif
  117. config_h.set('HAVE_WACOM', enable_wacom)
  118. # smartcard section
  119. enable_smartcard = get_option('smartcard')
  120. if enable_smartcard
  121. nss_dep = dependency('nss', version: '>= 3.11.2')
  122. system_nssdb_dir = get_option('nssdb_dir')
  123. if system_nssdb_dir == ''
  124. system_nssdb_dir = join_paths(gsd_sysconfdir, 'pki', 'nssdb')
  125. endif
  126. endif
  127. # CUPS
  128. enable_cups = get_option('cups')
  129. if enable_cups
  130. cups_dep = dependency('cups', version : '>= 1.4', required: false)
  131. assert(cups_dep.found(), 'CUPS 1.4 or newer not found')
  132. # FIXME: 1.6 cflags generate a lot of errors
  133. '''
  134. cups_cflags = []
  135. if cups_dep.version().version_compare('>= 1.6')
  136. cups_cflags += '-D_PPD_DEPRECATED=""'
  137. endif
  138. cups_dep = declare_dependency(
  139. dependencies: cups_dep,
  140. compile_args: cups_cflags
  141. )
  142. '''
  143. endif
  144. # Rfkill
  145. enable_rfkill = get_option('rfkill')
  146. assert(enable_rfkill or not host_is_linux, 'rfkill is not optional on Linux platforms')
  147. if enable_rfkill
  148. assert(cc.has_header('linux/rfkill.h'), 'rfkill support requested but RFKill headers not found')
  149. udev_dir = get_option('udev_dir')
  150. if udev_dir == ''
  151. udev_dir = dependency('udev').get_pkgconfig_variable('udevdir')
  152. endif
  153. endif
  154. # Sharing plugin
  155. enable_network_manager = get_option('network_manager')
  156. assert(enable_network_manager or not host_is_linux, 'NetworkManager support is not optional on Linux platforms')
  157. if enable_network_manager
  158. # network manager
  159. libnm_dep = dependency('libnm', version: '>= 1.0')
  160. endif
  161. config_h.set('HAVE_NETWORK_MANAGER', enable_network_manager)
  162. gnome = import('gnome')
  163. i18n = import('i18n')
  164. pkg = import('pkgconfig')
  165. po_dir = join_paths(meson.source_root(), 'po')
  166. top_inc = include_directories('.')
  167. subdir('tests')
  168. subdir('gnome-settings-daemon')
  169. subdir('data')
  170. subdir('plugins')
  171. subdir('po')
  172. configure_file(
  173. output: 'config.h',
  174. configuration: config_h
  175. )
  176. meson.add_install_script(
  177. 'meson_post_install.py',
  178. gsd_datadir
  179. )
  180. output = '\n ' + meson.project_name() + ' ' + meson.project_version() +'\n'
  181. output += ' =============================\n\n'
  182. output += ' prefix: ' + gsd_prefix + '\n'
  183. output += ' exec_prefix: ' + gsd_prefix + '\n'
  184. output += ' libdir: ' + gsd_libdir + '\n'
  185. output += ' libexecdir: ' + gsd_libexecdir + '\n'
  186. output += ' bindir: ' + gsd_bindir + '\n'
  187. output += ' sysconfdir: ' + gsd_sysconfdir + '\n'
  188. output += ' datadir: ' + gsd_datadir + '\n\n'
  189. output += ' source code location: ' + meson.source_root() + '\n'
  190. output += ' compiler: ' + cc.get_id() + '\n'
  191. output += ' cflags: ' + ' '.join(compiler_flags) + '\n\n'
  192. output += ' ALSA support: ' + enable_alsa.to_string() + '\n'
  193. output += ' NetworkManager support: ' + enable_network_manager.to_string() + '\n'
  194. output += ' Smartcard support: ' + enable_smartcard.to_string() + '\n'
  195. output += ' Cups support: ' + enable_cups.to_string() + '\n'
  196. output += ' Wayland support: ' + enable_wayland.to_string() + '\n'
  197. output += ' Wacom support: ' + enable_wacom.to_string() + '\n'
  198. output += ' RFKill support: ' + enable_rfkill.to_string() + '\n'
  199. if enable_smartcard
  200. output += ' System nssdb: ' + system_nssdb_dir + '\n'
  201. endif
  202. if enable_rfkill
  203. output += ' udev dir: ' + udev_dir + '\n'
  204. endif
  205. message(output)