1project( 2 'dconf-editor', ['c', 'vala'], 3 version: '3.38.3', 4 license: 'GPL3+', 5 default_options: [ 6 'buildtype=debugoptimized', 7 'warning_level=1' 8 ], 9 meson_version: '>= 0.41.0' 10) 11 12dconf_editor_name = meson.project_name() 13dconf_editor_version = meson.project_version() 14 15dconf_editor_prefix = get_option('prefix') 16dconf_editor_bindir = join_paths(dconf_editor_prefix, get_option('bindir')) 17dconf_editor_datadir = join_paths(dconf_editor_prefix, get_option('datadir')) 18dconf_editor_localedir = join_paths(dconf_editor_prefix, get_option('localedir')) 19dconf_editor_mandir = join_paths(dconf_editor_prefix, get_option('mandir')) 20 21dconf_editor_pkgdatadir = join_paths(dconf_editor_datadir, dconf_editor_name) 22 23dconf_editor_gettext = 'dconf-editor' 24dconf_editor_namespace = 'ca.desrt.dconf-editor' 25 26cc = meson.get_compiler('c') 27valac = meson.get_compiler('vala') 28 29vala_req_version = '>= 0.40.0' 30 31assert(valac.version().version_compare(vala_req_version), 32 'vala ' + vala_req_version + ' is required') 33 34config_h = configuration_data() 35 36# package 37set_defines = [ 38 ['PACKAGE', dconf_editor_name], 39 ['PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=' + dconf_editor_name], 40 ['PACKAGE_NAME', dconf_editor_name], 41 ['PACKAGE_STRING', '@0@ @1@'.format(dconf_editor_name, dconf_editor_version)], 42 ['PACKAGE_TARNAME', dconf_editor_name], 43 ['PACKAGE_URL', 'https://wiki.gnome.org/Apps/DconfEditor'], 44 ['PACKAGE_VERSION', dconf_editor_version], 45 ['VERSION', dconf_editor_version], 46 # i18n 47 ['GETTEXT_PACKAGE', dconf_editor_gettext] 48] 49 50foreach define: set_defines 51 config_h.set_quoted(define[0], define[1]) 52endforeach 53 54# headers 55check_headers = [ 56 ['HAVE_DLFCN_H', 'dlfcn.h'], 57 ['HAVE_FLOAT_H', 'float.h'], 58 ['HAVE_INTTYPES_H', 'inttypes.h'], 59 ['HAVE_MEMORY_H', 'memory.h'], 60 ['HAVE_STDINT_H', 'stdint.h'], 61 ['HAVE_STDLIB_H', 'stdlib.h'], 62 ['HAVE_STRINGS_H', 'strings.h'], 63 ['HAVE_STRING_H', 'string.h'], 64 ['HAVE_SYS_STAT_H', 'sys/stat.h'], 65 ['HAVE_UNISTD_H', 'unistd.h'], 66 # i18n 67 ['HAVE_LOCALE_H', 'locale.h'] 68] 69 70foreach header: check_headers 71 if cc.has_header(header[1]) 72 config_h.set(header[0], true) 73 endif 74endforeach 75 76sys_types_h = cc.has_header('sys/types.h') 77config_h.set('HAVE_SYS_TYPES_H', sys_types_h) 78if not sys_types_h 79 config_h.set('size_t', 'unsigned int') 80endif 81 82# functions 83check_functions = [ 84 ['HAVE_MEMSET', 'memset'], 85 ['HAVE_STRSTR', 'strstr'], 86 # i18n 87 ['HAVE_DCGETTEXT', 'dcgettext'], 88 ['HAVE_GETTEXT', 'gettext'], 89 ['HAVE_ICONV', 'iconv'], 90 ['HAVE_SETLOCALE', 'setlocale'] 91] 92 93if host_machine.system().contains('darwin') 94 check_functions += [ 95 ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'], 96 ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue'] 97 ] 98endif 99 100foreach func: check_functions 101 if cc.has_function(func[1]) 102 config_h.set(func[0], true) 103 endif 104endforeach 105 106# compiler flags 107add_project_arguments('-DHAVE_CONFIG_H', language: 'c') 108 109gnome = import('gnome') 110i18n = import('i18n') 111 112po_dir = join_paths(meson.source_root(), 'po') 113 114top_inc = include_directories('.') 115 116subdir('editor') 117subdir('po') 118 119configure_file( 120 output: 'config.h', 121 configuration: config_h 122) 123 124meson.add_install_script( 125 'meson_post_install.py', 126 dconf_editor_datadir 127) 128