Blame meson.build

Packit 2c4300
project(
Packit 2c4300
  'dconf-editor', ['c', 'vala'],
Packit 2c4300
  version: '3.28.0',
Packit 2c4300
  license: 'GPL3+',
Packit 2c4300
  default_options: [
Packit 2c4300
    'buildtype=debugoptimized',
Packit 2c4300
    'warning_level=1'
Packit 2c4300
  ],
Packit 2c4300
  meson_version: '>= 0.41.0'
Packit 2c4300
)
Packit 2c4300
Packit 2c4300
dconf_editor_name = meson.project_name()
Packit 2c4300
dconf_editor_version = meson.project_version()
Packit 2c4300
Packit 2c4300
dconf_editor_prefix = get_option('prefix')
Packit 2c4300
dconf_editor_bindir = join_paths(dconf_editor_prefix, get_option('bindir'))
Packit 2c4300
dconf_editor_datadir = join_paths(dconf_editor_prefix, get_option('datadir'))
Packit 2c4300
dconf_editor_localedir = join_paths(dconf_editor_prefix, get_option('localedir'))
Packit 2c4300
dconf_editor_mandir = join_paths(dconf_editor_prefix, get_option('mandir'))
Packit 2c4300
Packit 2c4300
dconf_editor_pkgdatadir = join_paths(dconf_editor_datadir, dconf_editor_name)
Packit 2c4300
Packit 2c4300
dconf_editor_gettext = 'dconf-editor'
Packit 2c4300
dconf_editor_namespace = 'ca.desrt.dconf-editor'
Packit 2c4300
Packit 2c4300
cc = meson.get_compiler('c')
Packit 2c4300
valac = meson.get_compiler('vala')
Packit 2c4300
Packit 2c4300
vala_req_version = '>= 0.36.11'
Packit 2c4300
Packit 2c4300
assert(valac.version().version_compare(vala_req_version),
Packit 2c4300
       'vala ' + vala_req_version + ' is required')
Packit 2c4300
Packit 2c4300
config_h = configuration_data()
Packit 2c4300
Packit 2c4300
# package
Packit 2c4300
set_defines = [
Packit 2c4300
  ['PACKAGE', dconf_editor_name],
Packit 2c4300
  ['PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=' + dconf_editor_name],
Packit 2c4300
  ['PACKAGE_NAME', dconf_editor_name],
Packit 2c4300
  ['PACKAGE_STRING', '@0@ @1@'.format(dconf_editor_name, dconf_editor_version)],
Packit 2c4300
  ['PACKAGE_TARNAME', dconf_editor_name],
Packit 2c4300
  ['PACKAGE_URL', 'https://wiki.gnome.org/Apps/DconfEditor'],
Packit 2c4300
  ['PACKAGE_VERSION', dconf_editor_version],
Packit 2c4300
  ['VERSION', dconf_editor_version],
Packit 2c4300
  # i18n
Packit 2c4300
  ['GETTEXT_PACKAGE', dconf_editor_gettext]
Packit 2c4300
]
Packit 2c4300
Packit 2c4300
foreach define: set_defines
Packit 2c4300
  config_h.set_quoted(define[0], define[1])
Packit 2c4300
endforeach
Packit 2c4300
Packit 2c4300
# headers
Packit 2c4300
check_headers = [
Packit 2c4300
  ['HAVE_DLFCN_H', 'dlfcn.h'],
Packit 2c4300
  ['HAVE_FLOAT_H', 'float.h'],
Packit 2c4300
  ['HAVE_INTTYPES_H', 'inttypes.h'],
Packit 2c4300
  ['HAVE_MEMORY_H', 'memory.h'],
Packit 2c4300
  ['HAVE_STDINT_H', 'stdint.h'],
Packit 2c4300
  ['HAVE_STDLIB_H', 'stdlib.h'],
Packit 2c4300
  ['HAVE_STRINGS_H', 'strings.h'],
Packit 2c4300
  ['HAVE_STRING_H', 'string.h'],
Packit 2c4300
  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
Packit 2c4300
  ['HAVE_UNISTD_H', 'unistd.h'],
Packit 2c4300
  # i18n
Packit 2c4300
  ['HAVE_LOCALE_H', 'locale.h']
Packit 2c4300
]
Packit 2c4300
Packit 2c4300
foreach header: check_headers
Packit 2c4300
  if cc.has_header(header[1])
Packit 2c4300
    config_h.set(header[0], true)
Packit 2c4300
  endif
Packit 2c4300
endforeach
Packit 2c4300
Packit 2c4300
sys_types_h = cc.has_header('sys/types.h')
Packit 2c4300
config_h.set('HAVE_SYS_TYPES_H', sys_types_h)
Packit 2c4300
if not sys_types_h
Packit 2c4300
  config_h.set('size_t', 'unsigned int')
Packit 2c4300
endif
Packit 2c4300
Packit 2c4300
# functions
Packit 2c4300
check_functions = [
Packit 2c4300
  ['HAVE_MEMSET', 'memset'],
Packit 2c4300
  ['HAVE_STRSTR', 'strstr'],
Packit 2c4300
  # i18n
Packit 2c4300
  ['HAVE_DCGETTEXT', 'dcgettext'],
Packit 2c4300
  ['HAVE_GETTEXT', 'gettext'],
Packit 2c4300
  ['HAVE_ICONV', 'iconv'],
Packit 2c4300
  ['HAVE_SETLOCALE', 'setlocale']
Packit 2c4300
]
Packit 2c4300
Packit 2c4300
if host_machine.system().contains('darwin')
Packit 2c4300
  check_functions += [
Packit 2c4300
    ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
Packit 2c4300
    ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
Packit 2c4300
  ]
Packit 2c4300
endif
Packit 2c4300
Packit 2c4300
foreach func: check_functions
Packit 2c4300
  if cc.has_function(func[1])
Packit 2c4300
    config_h.set(func[0], true)
Packit 2c4300
  endif
Packit 2c4300
endforeach
Packit 2c4300
Packit 2c4300
# compiler flags
Packit 2c4300
add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
Packit 2c4300
Packit 2c4300
gnome = import('gnome')
Packit 2c4300
i18n = import('i18n')
Packit 2c4300
Packit 2c4300
po_dir = join_paths(meson.source_root(), 'po')
Packit 2c4300
Packit 2c4300
top_inc = include_directories('.')
Packit 2c4300
Packit 2c4300
subdir('editor')
Packit 2c4300
subdir('po')
Packit 2c4300
Packit 2c4300
configure_file(
Packit 2c4300
  output: 'config.h',
Packit 2c4300
  configuration: config_h
Packit 2c4300
)
Packit 2c4300
Packit 2c4300
meson.add_install_script(
Packit 2c4300
  'meson_post_install.py',
Packit 2c4300
  dconf_editor_datadir
Packit 2c4300
)