|
| 1 | +project( |
| 2 | + 'xfwm4', |
| 3 | + 'c', |
| 4 | +version : '4.20.0-dev', |
| 5 | + license : 'GPL-2.0-or-later', |
| 6 | + meson_version : '>= 0.56.0', |
| 7 | + default_options : ['c_std=gnu11', 'buildtype=debugoptimized', 'warning_level=2'] |
| 8 | +) |
| 9 | + |
| 10 | +project_namespace = 'xfce' |
| 11 | +pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name() |
| 12 | + |
| 13 | +cc = meson.get_compiler('c') |
| 14 | +pkgconfig = import('pkgconfig') |
| 15 | +gnome = import('gnome') |
| 16 | +i18n = import('i18n') |
| 17 | +fs = import('fs') |
| 18 | + |
| 19 | +dependency_versions = { |
| 20 | + 'glib': '>= 2.72.0', |
| 21 | + 'gtk': '>= 3.24.0', |
| 22 | + 'libxfce4ui': '>= 4.12.0', |
| 23 | + 'libxfce4util': '>= 4.8.0', |
| 24 | + 'xfconf': '>= 4.13.0', |
| 25 | + 'libwnck': '>= 3.14', |
| 26 | + 'libx11': '>= 1.6.7', |
| 27 | + 'xinerama': '>= 1.1.4', |
| 28 | + |
| 29 | + 'libxi': '>= 1.7.10', |
| 30 | + 'libxres': '>= 1.2.0', |
| 31 | + 'libxext': '>= 1.0.0', |
| 32 | + 'libepoxy': '>= 1.0', |
| 33 | + 'libstartup': '>= 0.5', |
| 34 | + 'libxrender': '>= 0.9.10', |
| 35 | + 'libxcomposite': '>= 0.2', |
| 36 | + 'libxdamage': '>= 1.1.5', |
| 37 | + 'libxfixes': '>= 5.0.3', |
| 38 | + 'libxrandr': '>= 1.5.2', |
| 39 | + 'libxpresent': '>= 1.0', |
| 40 | + 'presentproto': '>= 1.1', |
| 41 | +} |
| 42 | + |
| 43 | +glib = dependency('glib-2.0', version: dependency_versions['glib']) |
| 44 | +gtk = dependency('gtk+-3.0', version: dependency_versions['gtk']) |
| 45 | +libxfce4ui = dependency('libxfce4ui-2', version: dependency_versions['libxfce4ui']) |
| 46 | +libxfce4kbd = dependency('libxfce4kbd-private-3', version: dependency_versions['libxfce4ui']) |
| 47 | +libxfce4util = dependency('libxfce4util-1.0', version: dependency_versions['libxfce4util']) |
| 48 | +xfconf = dependency('libxfconf-0', version: dependency_versions['xfconf']) |
| 49 | +libwnck = dependency('libwnck-3.0', version: dependency_versions['libwnck']) |
| 50 | +libx11 = dependency('x11', version: dependency_versions['libx11']) |
| 51 | +xinerama = dependency('xinerama', version: dependency_versions['xinerama']) |
| 52 | + |
| 53 | +xdt_csource = find_program('xdt-csource', required: true) |
| 54 | + |
| 55 | +feature_cflags = [] |
| 56 | + |
| 57 | +libxi = dependency('xi', version: dependency_versions['libxi'], required: get_option('xi2')) |
| 58 | +if libxi.found() |
| 59 | + feature_cflags += '-DHAVE_XI2=1' |
| 60 | +endif |
| 61 | + |
| 62 | +libxres = dependency('xres', version: dependency_versions['libxres'], required: get_option('xres')) |
| 63 | +if libxres.found() |
| 64 | + feature_cflags += '-DHAVE_XRES=1' |
| 65 | +endif |
| 66 | + |
| 67 | +libxext = dependency('xext', version: dependency_versions['libxext'], required: get_option('xsync')) |
| 68 | +if libxext.found() |
| 69 | + feature_cflags += '-DHAVE_XSYNC=1' |
| 70 | +endif |
| 71 | + |
| 72 | +libepoxy = dependency('epoxy', version: dependency_versions['libepoxy'], required: get_option('epoxy')) |
| 73 | +if libepoxy.found() |
| 74 | + feature_cflags += '-DHAVE_EPOXY=1' |
| 75 | +endif |
| 76 | + |
| 77 | +libstartup = dependency('libstartup-notification-1.0', version: dependency_versions['libstartup'], required: get_option('startup-notification')) |
| 78 | +if libstartup.found() |
| 79 | + feature_cflags += '-DHAVE_LIBSTARTUP_NOTIFICATION=1' |
| 80 | +endif |
| 81 | + |
| 82 | +libxrender = dependency('xrender', version: dependency_versions['libxrender'], required: get_option('render')) |
| 83 | +if libxrender.found() |
| 84 | + feature_cflags += '-DHAVE_RENDER=1' |
| 85 | +endif |
| 86 | + |
| 87 | +libxrandr = dependency('xrandr', version: dependency_versions['libxrandr'], required: get_option('randr')) |
| 88 | +if libxrandr.found() |
| 89 | + feature_cflags += '-DHAVE_RANDR=1' |
| 90 | +endif |
| 91 | + |
| 92 | +xpresent_deps = [] |
| 93 | +xpresent_deps += dependency('xpresent', version: dependency_versions['libxpresent'], required: get_option('xpresent')) |
| 94 | +xpresent_deps += dependency('presentproto', version: dependency_versions['presentproto'], required: get_option('xpresent')) |
| 95 | +enable_xpresent = not get_option('xpresent').disabled() |
| 96 | +foreach dep : xpresent_deps |
| 97 | + enable_xpresent = enable_xpresent and dep.found() |
| 98 | +endforeach |
| 99 | +if enable_xpresent |
| 100 | + feature_cflags += '-DHAVE_PRESENT_EXTENSION=1' |
| 101 | +endif |
| 102 | + |
| 103 | +compositor_deps = [] |
| 104 | +compositor_deps += dependency('xrender', version: dependency_versions['libxrender'], required: get_option('compositor')) |
| 105 | +compositor_deps += dependency('xcomposite', version: dependency_versions['libxcomposite'], required: get_option('compositor')) |
| 106 | +compositor_deps += dependency('xdamage', version: dependency_versions['libxdamage'], required: get_option('compositor')) |
| 107 | +compositor_deps += dependency('xfixes', version: dependency_versions['libxfixes'], required: get_option('compositor')) |
| 108 | +enable_compositor = not get_option('compositor').disabled() |
| 109 | +foreach dep : compositor_deps |
| 110 | + enable_compositor = enable_compositor and dep.found() |
| 111 | +endforeach |
| 112 | +if enable_compositor |
| 113 | + feature_cflags += '-DHAVE_COMPOSITOR=1' |
| 114 | +endif |
| 115 | + |
| 116 | +if get_option('poswin') |
| 117 | + feature_cflags += '-DSHOW_POSITION=1' |
| 118 | +endif |
| 119 | + |
| 120 | +helper_path_prefix = get_option('helper-path-prefix') |
| 121 | +if helper_path_prefix == '' |
| 122 | + helper_path_prefix = get_option('prefix') / get_option('libdir') |
| 123 | +endif |
| 124 | + |
| 125 | +headers = [ |
| 126 | + 'math.h', |
| 127 | + 'memory.h', |
| 128 | + 'stdlib.h', |
| 129 | + 'string.h', |
| 130 | +] |
| 131 | +foreach header : headers |
| 132 | + if cc.check_header(header) |
| 133 | + feature_cflags += '-DHAVE_@0@=1'.format(header.underscorify().to_upper()) |
| 134 | + endif |
| 135 | +endforeach |
| 136 | + |
| 137 | +libm = cc.find_library('m', required: true) |
| 138 | + |
| 139 | +extra_cflags = [] |
| 140 | +extra_cflags_check = [ |
| 141 | + '-Wmissing-declarations', |
| 142 | + '-Wmissing-noreturn', |
| 143 | + '-Wold-style-definition', |
| 144 | + '-Wredundant-decls', |
| 145 | + '-Wpointer-arith', |
| 146 | + '-Wcast-align', |
| 147 | + '-Winit-self', |
| 148 | + '-Wshadow', |
| 149 | + '-Wmissing-include-dirs', |
| 150 | + '-Wundef', |
| 151 | + '-Wformat', |
| 152 | + '-Wformat-security', |
| 153 | + '-Wformat-y2k', |
| 154 | + '-Wnested-externs', |
| 155 | + '-Wno-unused-parameter', |
| 156 | + '-Wno-declaration-after-statement', |
| 157 | + '-Wno-missing-field-initializers', |
| 158 | + '-Werror=implicit-function-declaration', |
| 159 | + '-Wno-error=deprecated-declarations', |
| 160 | +] |
| 161 | + |
| 162 | +optimization = get_option('optimization') |
| 163 | +if get_option('debug') and optimization in ['0', 'g'] |
| 164 | + extra_cflags_check += '-fstack-protector-strong' |
| 165 | + extra_cflags += [ |
| 166 | + '-DDEBUG=1', |
| 167 | + '-DDEBUG_TRACE=1', |
| 168 | + '-DG_ENABLE_DEBUG', |
| 169 | + ] |
| 170 | +elif optimization in ['3', 'minsize'] |
| 171 | + extra_cflags += [ |
| 172 | + '-DNDEBUG', |
| 173 | + '-DG_DISABLE_CAST_CHECKS', |
| 174 | + '-DG_DISABLE_ASSERT', |
| 175 | + ] |
| 176 | +endif |
| 177 | + |
| 178 | +if dependency_versions.has_key('glib') |
| 179 | + glib_version_parts = dependency_versions['glib'].split(' ') |
| 180 | + glib_min_version_parts = glib_version_parts[1].split('.') |
| 181 | + glib_min_version_define = 'GLIB_VERSION_@0@_@1@'.format(glib_min_version_parts[0], glib_min_version_parts[1]) |
| 182 | + extra_cflags += [ |
| 183 | + '-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_min_version_define), |
| 184 | + '-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_min_version_define), |
| 185 | + '-DG_LOG_USE_STRUCTURED=1', |
| 186 | + ] |
| 187 | +endif |
| 188 | + |
| 189 | +version_parts = meson.project_version().split('-dev')[0].split('.') |
| 190 | +version_short = '@0@.@1@'.format(version_parts[0], version_parts[1]) |
| 191 | + |
| 192 | +extra_cflags += [ |
| 193 | + '-DPACKAGE="@0@"'.format(meson.project_name()), |
| 194 | + '-DPACKAGE_NAME="@0@"'.format(meson.project_name()), |
| 195 | + '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()), |
| 196 | + '-DVERSION="@0@"'.format(meson.project_version()), |
| 197 | + '-DVERSION_SHORT="@0@"'.format(version_short), |
| 198 | + '-DPACKAGE_STRING="@0@ @1@"'.format(meson.project_name(), meson.project_version()), |
| 199 | + '-DPACKAGE_DATADIR="@0@"'.format(pkgdatadir), |
| 200 | + '-DPACKAGE_LOCALE_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')), |
| 201 | + '-DPACKAGE_BUGREPORT="https://gitlab.xfce.org/@0@/@1@/-/issues"'.format(project_namespace, meson.project_name()), |
| 202 | + '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), |
| 203 | + '-DPREFIX="@0@"'.format(get_option('prefix')), |
| 204 | + '-DBINDIR="@0@"'.format(get_option('prefix') / get_option('bindir')), |
| 205 | + '-DDATADIR="@0@"'.format(get_option('prefix') / get_option('datadir')), |
| 206 | + '-DINCLUDEDIR="@0@"'.format(get_option('prefix') / get_option('includedir')), |
| 207 | + '-DLIBDIR="@0@"'.format(get_option('prefix') / get_option('libdir')), |
| 208 | + '-DLIBEXECDIR="@0@"'.format(get_option('prefix') / get_option('libexecdir')), |
| 209 | + '-DLOCALEDIR="@0@"'.format(get_option('prefix') / get_option('localedir')), |
| 210 | + '-DLOCALSTATEDIR="@0@"'.format(get_option('prefix') / get_option('localstatedir')), |
| 211 | + '-DSBINDIR="@0@"'.format(get_option('prefix') / get_option('sbindir')), |
| 212 | + '-DSYSCONFDIR="@0@"'.format(get_option('prefix') / get_option('sysconfdir')), |
| 213 | + '-DHAVE_XFCE_REVISION_H=1', |
| 214 | +] |
| 215 | + |
| 216 | +add_project_arguments(cc.get_supported_arguments(extra_cflags_check), language: 'c') |
| 217 | +add_project_arguments(extra_cflags, language: 'c') |
| 218 | +add_project_arguments(feature_cflags, language: 'c') |
| 219 | + |
| 220 | +xfce_revision_h = vcs_tag( |
| 221 | + command: ['git', 'rev-parse', '--short', 'HEAD'], |
| 222 | + fallback: 'UNKNOWN', |
| 223 | + input: 'xfce-revision.h.in', |
| 224 | + output: 'xfce-revision.h', |
| 225 | + replace_string: '@REVISION@', |
| 226 | +) |
| 227 | + |
| 228 | +subdir('common') |
| 229 | +subdir('defaults') |
| 230 | +subdir('helper-dialog') |
| 231 | +subdir('icons') |
| 232 | +subdir('po') |
| 233 | +subdir('settings-dialogs') |
| 234 | +subdir('src') |
| 235 | +subdir('themes') |
0 commit comments