diff --git a/config.h.meson b/config.h.meson index e6cd25d26a..55e026a979 100644 --- a/config.h.meson +++ b/config.h.meson @@ -194,6 +194,12 @@ /* Have the SYNC extension library */ #mesondefine HAVE_XSYNC +/* Define to 1 if you have the `_lock_file' function */ +#mesondefine HAVE__LOCK_FILE + +/* Define to 1 if you have the `flockfile' function */ +#mesondefine HAVE_FLOCKFILE + /* Define if _NL_MEASUREMENT_MEASUREMENT is available */ #mesondefine HAVE__NL_MEASUREMENT_MEASUREMENT diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build index 11fe3322f2..ee44a8530f 100644 --- a/demos/gtk-demo/meson.build +++ b/demos/gtk-demo/meson.build @@ -73,7 +73,7 @@ demos = files([ gtkdemo_deps = [libgtk_dep] -if build_font_demo +if harfbuzz_dep.found() and pangoft_dep.found() demos += files('font_features.c') gtkdemo_deps += harfbuzz_dep endif diff --git a/meson.build b/meson.build index 1a56ec3a7a..e3d9ec4eca 100644 --- a/meson.build +++ b/meson.build @@ -13,10 +13,10 @@ add_global_arguments('-DG_LOG_USE_STRUCTURED=1', language: 'c') add_global_arguments('-DG_ENABLE_DEBUG', language: 'c') add_global_arguments('-DG_ENABLE_CONSISTENCY_CHECKS', language: 'c') -gtk_version = meson.project_version().split('.') -gtk_major_version = gtk_version[0] -gtk_minor_version = gtk_version[1] -gtk_micro_version = gtk_version[2] +gtk_version = meson.project_version().split('.') +gtk_major_version = gtk_version[0].to_int() +gtk_minor_version = gtk_version[1].to_int() +gtk_micro_version = gtk_version[2].to_int() gtk_interface_age = 0 add_global_arguments('-DGTK_VERSION="' + meson.project_version() + '"', language: 'c') @@ -27,7 +27,7 @@ add_global_arguments('-DGTK_VERSION="' + meson.project_version() + '"', language # for GTK+. gtk_binary_version = '3.0.0' -gtk_binary_age = 100 * gtk_minor_version.to_int() + gtk_micro_version.to_int() +gtk_binary_age = 100 * gtk_minor_version + gtk_micro_version gtk_api_version = '@0@.0'.format(gtk_major_version) x11_enabled = get_option('enable-x11-backend') @@ -35,10 +35,10 @@ wayland_enabled = get_option('enable-wayland-backend') broadway_enabled = get_option('enable-broadway-backend') -mkmarshal = find_program('build_marshal.py') +mkmarshal = find_program('build_marshal.py') glib_marshal = find_program('glib-genmarshal') -mkenum = find_program('build_enum.py') -perl = find_program('perl') +mkenum = find_program('build_enum.py') +perl = find_program('perl') glib_mkenums = find_program('glib-mkenums') os_unix = false @@ -56,10 +56,6 @@ endif os_unix = not os_win32 -build_font_demo = false - - - cc = meson.get_compiler('c') cdata = configuration_data() @@ -67,6 +63,7 @@ cdata.set('PACKAGE_VERSION', '"'+meson.project_version()+'"') cdata.set('GTK_LOCALEDIR', '"'+get_option('localedir')+'"') cdata.set('GTK_DATADIR', '"'+get_option('datadir')+'"') cdata.set('GTK_LIBDIR', '"'+get_option('libdir')+'"') +cdata.set('GETTEXT_PACKAGE', '"gtk30"') cdata.set('GTK_MAJOR_VERSION', gtk_major_version) cdata.set('GTK_MINOR_VERSION', gtk_minor_version) cdata.set('GTK_MICRO_VERSION', gtk_micro_version) @@ -102,7 +99,6 @@ endforeach check_functions = [ # check token HAVE_BIND_TEXTDOMAIN_CODESET -# check token HAVE_COLORD # check token HAVE_CUPS_API_1_6 ['HAVE_DCGETTEXT', 'dcgettext', '#include'], ['HAVE_DECL_ISINF', 'isinf', '#include'], @@ -116,23 +112,21 @@ check_functions = [ # check token HAVE_HTTP_AUTHSTRING # check token HAVE_IPRINTDIALOGCALLBACK # check token HAVE_LC_MESSAGES -# check token HAVE_LIBM # check token HAVE_LOCALTIME_R ['HAVE_LSTAT', 'lstat', '#include'], -# check token HAVE_MALLINFO -# check token HAVE_MKSTEMP ['HAVE_MMAP', 'mmap', '#include'], ['HAVE_NEARBYINT', 'nearbyint', '#include'], -# check token HAVE_PAPI -# check token HAVE_POSIX_FALLOCATE + ['HAVE_POSIX_FALLOCATE', 'posix_fallocate', '#include'], + ['HAVE__LOCK_FILE', '_lock_file', '#include'], + ['HAVE_FLOCKFILE', 'flockfile', '#include'], + ['HAVE_MKSTEMP', 'mkstemp', '#include'], + ['HAVE_MALLINFO', 'mallinfo', '#include'], ['HAVE_ROUND', 'round', '#include'], ['HAVE_RINT', 'rint', '#include'], ['HAVE_LOG2', 'log2', '#include'], ['HAVE_EXP2', 'exp2', '#include'], ['HAVE_SINCOS', 'sincos', '#include'], - ['HAVE_XGENERICEVENTS', 'XGetEventData', '#include'], ['HAVE_XKB', 'XkbQueryExtension', '#include'], - ['HAVE_XSYNC', 'XSyncQueryExtension', '#include\n#include'], # check token HAVE_SOCKADDR_UN_SUN_LEN # check token HAVE_SOLARIS_XINERAMA # check token HAVE_XFREE_XINERAMA @@ -143,6 +137,12 @@ check_functions = [ # check token HAVE__NL_TIME_FIRST_WEEKDAY # check token HAVE__NSGETENVIRON ] +if x11_enabled +check_functions += [ + ['HAVE_XGENERICEVENTS', 'XGetEventData', '#include'], + ['HAVE_XSYNC', 'XSyncQueryExtension', '#include\n#include'] +] +endif foreach f : check_functions if cc.has_function(f.get(1), prefix : f.get(2)) @@ -150,20 +150,21 @@ foreach f : check_functions endif endforeach -cdata.set('GETTEXT_PACKAGE', '"gtk-3.0"') +# +# Disable deprecation checks for all libraries we depend on on stable branches. +# This is so newer versions of those libraries don't cause more warnings with +# a stable GTK version. +# We don't ever want to turn off deprecation warnings for master however, because +# that's where we get rid of deprecated API we use. +if gtk_minor_version % 2 == 0 + cdata.set('GLIB_DISABLE_DEPRECATION_WARNINGS', 1) +endif + confinc = include_directories('.') gdkinc = include_directories('gdk') gtkinc = include_directories('gtk') -x11_dep = dependency('x11') -xrender_dep = dependency('xrender') -xi_dep = dependency('xi') -xext_dep = dependency('xext') -xcursor_dep = dependency('xcursor', required: false) -xdamage_dep = dependency('xdamage', required: false) -xfixes_dep = dependency('xfixes', required: false) -xcomposite_dep = dependency('xcomposite', required: false) glib_dep = dependency('glib-2.0', version: '>= 2.49.4') giounix_dep = dependency('gio-unix-2.0', required : false) pango_dep = dependency('pango', version: '>=1.37.3') @@ -176,62 +177,81 @@ epoxy_dep = dependency('epoxy', version: '>= 1.0') atk_dep = dependency('atk', version: '>= 2.15.1') atkbridge_dep = dependency('atk-bridge-2.0') gmodule_dep = dependency('gmodule-2.0') - +colord_dep = dependency('colord', version: '>= 0.1.9', required: false) fontconfig_dep = dependency('fontconfig') -xkbdep = dependency('xkbcommon', version: '>= 0.2.0') -wlclientdep = dependency('wayland-client', version: '>= 1.9.91') -wlprotocolsdep = dependency('wayland-protocols', version: '>= 1.7') -wlcursordep = dependency('wayland-cursor', version: '>= 1.9.91') -wlegldep = dependency('wayland-egl') -xrandr_dep = dependency('xrandr', version: '>= 1.2.99') -xrandr15_dep = dependency('xrandr', version: '>= 1.5', required: false) harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false) -mlib = cc.find_library('m', required: false) -shmlib = cc.find_library('rt') +xkbdep = dependency('xkbcommon', version: '>= 0.2.0') -build_font_demo = harfbuzz_dep.found() and pangoft_dep.found() +if wayland_enabled + wlclientdep = dependency('wayland-client', version: '>= 1.9.91') + wlprotocolsdep = dependency('wayland-protocols', version: '>= 1.7') + wlcursordep = dependency('wayland-cursor', version: '>= 1.9.91') + wlegldep = dependency('wayland-egl') +endif + +if x11_enabled + xrandr_dep = dependency('xrandr', version: '>= 1.2.99') + xrandr15_dep = dependency('xrandr', version: '>= 1.5', required: false) + x11_dep = dependency('x11') + xrender_dep = dependency('xrender') + xi_dep = dependency('xi') + xext_dep = dependency('xext') + xcursor_dep = dependency('xcursor', required: false) + xdamage_dep = dependency('xdamage', required: false) + xfixes_dep = dependency('xfixes', required: false) + xcomposite_dep = dependency('xcomposite', required: false) + + + if xdamage_dep.found() + cdata.set('HAVE_XDAMAGE', 1) + endif + + if xcursor_dep.found() + cdata.set('HAVE_XCURSOR', 1) + endif + + if xcomposite_dep.found() + cdata.set('HAVE_XCOMPOSITE', 1) + endif + + if xfixes_dep.found() + cdata.set('HAVE_XFIXES', 1) + endif + + + + if xi_dep.found() and cc.has_header('X11/extensions/XInput2.h') + cdata.set('XINPUT_2', 1) + prefix = '#include\n#include' + if cc.has_function('XIAllowTouchEvents', prefix: prefix) and cc.has_member('XIScrollClassInfo', 'number', prefix: prefix) + cdata.set('XINPUT_2_2', 1) + endif + endif + + if xrandr_dep.found() + cdata.set('HAVE_RANDR', 1) + + if xrandr15_dep.found() + cdata.set('HAVE_RANDR15', 1) + endif + endif +endif + +mlib = cc.find_library('m', required: false) +shmlib = cc.find_library('rt') if giounix_dep.found() cdata.set('HAVE_GIO_UNIX', 1) endif -if xdamage_dep.found() - cdata.set('HAVE_XDAMAGE', 1) -endif - -if xcursor_dep.found() - cdata.set('HAVE_XCURSOR', 1) +if colord_dep.found() + cdata.set('HAVE_COLORD', 1) endif if mlib.found() cdata.set('HAVE_LIBM', 1) endif -if xcomposite_dep.found() - cdata.set('HAVE_XCOMPOSITE', 1) -endif - -if xfixes_dep.found() - cdata.set('HAVE_XFIXES', 1) -endif - -if xi_dep.found() and cc.has_header('X11/extensions/XInput2.h') - cdata.set('XINPUT_2', 1) - prefix = '#include\n#include' - if cc.has_function('XIAllowTouchEvents', prefix: prefix) and cc.has_member('XIScrollClassInfo', 'number', prefix: prefix) - cdata.set('XINPUT_2_2', 1) - endif -endif - -if xrandr_dep.found() - cdata.set('HAVE_RANDR', 1) - - if xrandr15_dep.found() - cdata.set('HAVE_RANDR15', 1) - endif -endif - - configure_file( input : 'config.h.meson', output: 'config.h',