Commit d1d9b92a authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Merge branch 'meson-deps-continued' into 'master'

Turn more options into "feature"

See merge request !2708
parents 77af9931 1b7a99cb
Pipeline #224075 passed with stages
in 22 minutes and 37 seconds
......@@ -352,8 +352,10 @@ if os_unix
endif
gmodule_dep = dependency('gmodule-2.0', version: glib_req,
fallback : ['glib', 'libgmodule_dep'])
cairo_dep = dependency('cairo', version: cairo_req, required : cc.get_id() != 'msvc')
cairogobj_dep = dependency('cairo-gobject', version: cairo_req, required : cc.get_id() != 'msvc')
cairo_dep = dependency('cairo', version: cairo_req,
fallback : ['cairo', 'libcairo_dep'])
cairogobj_dep = dependency('cairo-gobject', version: cairo_req,
fallback : ['cairo', 'libcairogobject_dep'])
pango_dep = dependency('pango', version: pango_req,
fallback : ['pango', 'libpango_dep'])
fribidi_dep = dependency('fribidi', version: fribidi_req,
......@@ -380,7 +382,8 @@ pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'])
epoxy_dep = dependency('epoxy', version: epoxy_req,
fallback: ['libepoxy', 'libepoxy_dep'])
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false)
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false,
fallback: ['harfbuzz', 'libharfbuzz_dep'])
xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
fallback: ['graphene', 'graphene_dep'])
......@@ -426,7 +429,7 @@ foreach backend: [ ['cairo-xlib', cairo_req, x11_enabled],
cairo_backend_req = backend.get(1)
cairo_backend = backend.get(0)
if backend_enabled
if dependency(cairo_backend, version: cairo_backend_req, required : cc.get_id() != 'msvc').found()
if dependency(cairo_backend, version: cairo_backend_req).found()
cairo_backends += [ cairo_backend ]
endif
endif
......@@ -442,44 +445,9 @@ if cairogobj_dep.found()
cairogobj_pkg_found = true
endif
cairo_libs = []
if cc.get_id() == 'msvc'
# Fallback dependency discovery for those on Visual Studio that do not generate
# pkg-config files in their build systems for MSVC
# Fallback for Cairo
if not cairo_dep.found()
if (cc.has_header('cairo.h') and cc.has_header('cairo-win32.h'))
cairo_dep = cc.find_library('cairo')
if cairo_dep.found()
cairo_libs += '-lcairo'
endif
endif
endif
# Fallback for Cairo-GObject
if not cairogobj_dep.found()
if cc.has_header('cairo-gobject.h')
cairogobj_dep = cc.find_library('cairo-gobject')
if cairogobj_dep.found()
cairo_libs += '-lcairo-gobject'
endif
endif
endif
# Fallback for HarfBuzz
if not harfbuzz_dep.found()
if cc.has_header('hb.h')
harfbuzz_dep = cc.find_library('harfbuzz', required : false)
endif
endif
endif
cairo_csi_dep = cc.find_library('cairo-script-interpreter',
required: get_option('build-tests'))
if not harfbuzz_dep.found()
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false,
fallback: ['harfbuzz', 'libharfbuzz_dep'])
cairo_csi_dep = dependency('cairo-script-interpreter', required: false)
if not cairo_csi_dep.found()
cairo_csi_dep = cc.find_library('cairo-script-interpreter', required: get_option('build-tests'))
endif
cdata.set('HAVE_CAIRO_SCRIPT_INTERPRETER', cairo_csi_dep.found())
......@@ -573,15 +541,10 @@ if x11_enabled
cdata.set('XINPUT_2_2', 1)
endif
enable_xinerama = get_option('xinerama').enabled()
if enable_xinerama
xinerama_dep = dependency('xinerama', required: true)
if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
cdata.set('HAVE_XFREE_XINERAMA', 1)
x11_pkgs += ['xinerama']
endif
else
xinerama_dep = []
xinerama_dep = dependency('xinerama', required: get_option('xinerama'))
if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
cdata.set('HAVE_XFREE_XINERAMA', 1)
x11_pkgs += ['xinerama']
endif
cdata.set('HAVE_RANDR', xrandr_dep.found())
......@@ -781,9 +744,6 @@ pkgconf.set('GSK_PACKAGES',
pkgconf.set('GTK_PACKAGES',
' '.join([ 'gio-2.0', glib_req ]))
# Requires.private
pc_gdk_extra_libs += cairo_libs
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
pkgconf.set('GDK_PRIVATE_PACKAGES',
' '.join([ gio_pkgname, glib_req,
......
......@@ -27,28 +27,38 @@ option('macos-backend',
# Media backends
option('media',
type: 'string',
value: 'gstreamer',
description : 'Build the specified media engines (comma-separated list, "all", or "none")')
option('media-ffmpeg',
type: 'feature',
value: 'auto',
description : 'Build the ffmpeg media backend')
option('media-gstreamer',
type: 'feature',
value: 'auto',
description : 'Build the gstreamer media backend')
# Print backends
option('print',
type: 'string',
value: 'cups,file',
description : 'Build the specified print backends (comma-separated list, "all", or "none")')
option('print-cups',
type: 'feature',
value: 'auto',
description : 'Build the cups print backend')
option('print-cloudprint',
type: 'feature',
value: 'auto',
description : 'Build the cloudprint print backend')
# Optional features
option('vulkan',
type: 'feature',
value: 'enabled',
value: 'auto',
description : 'Enable support for the Vulkan graphics API')
option('xinerama',
type: 'feature',
value: 'enabled',
value: 'auto',
description : 'Enable support for the X11 Xinerama extension')
option('cloudproviders',
......
all_media_backends = [
'ffmpeg',
'gstreamer'
]
enabled_media_backends = get_option('media').split(',')
if enabled_media_backends.contains('none')
media_backends = []
elif enabled_media_backends.contains('all')
media_backends = all_media_backends
else
media_backends = []
foreach b: enabled_media_backends
if all_media_backends.contains(b)
media_backends += b
else
error('No media backend named "@0@" exists.'.format (b))
endif
endforeach
endif
media_subdir = 'gtk-4.0/@0@/media'.format(gtk_binary_version)
media_install_dir = join_paths(get_option('libdir'), media_subdir)
media_backends = []
extra_c_args = [
'-DGTK_COMPILATION',
......@@ -30,15 +9,28 @@ extra_c_args = [
extra_c_args += common_cflags
if media_backends.contains('ffmpeg')
libavfilter_dep = dependency('libavfilter', version: '>= 6.47.100', required: true)
libavformat_dep = dependency('libavformat', version: '>= 57.41.100', required: true)
libavcodec_dep = dependency('libavcodec', version: '>= 57.48.101', required: true)
libavutil_dep = dependency('libavutil', version: '>= 55.28.100', required: true)
libswscale_dep = dependency('libswscale', version: '>= 4.6.100', required: true)
ffmpeg_deps = [libavfilter_dep, libavformat_dep, libavcodec_dep, libavutil_dep, libswscale_dep]
ffmpeg_opt = get_option('media-ffmpeg')
ffmpeg_versions = {
'libavfilter': '>= 6.47.100',
'libavformat': '>= 57.41.100',
'libavcodec': '>= 57.48.101',
'libavutil': '>= 55.28.100',
'libswscale': '>= 4.6.100',
}
ffmpeg_deps = []
ffmpeg_found = true
foreach name, version : ffmpeg_versions
dep = dependency(name, version: version, required: ffmpeg_opt)
ffmpeg_deps += dep
if not dep.found()
ffmpeg_found = false
break
endif
endforeach
if ffmpeg_found
media_backends += 'ffmpeg'
cdata.set('HAVE_FFMPEG', 1)
shared_module('media-ffmpeg',
'gtkffmediafile.c',
c_args: extra_c_args,
......@@ -47,10 +39,11 @@ if media_backends.contains('ffmpeg')
install : true)
endif
if media_backends.contains('gstreamer')
gstplayer_dep = dependency('gstreamer-player-1.0', version: '>= 1.12.3', required: true)
gstplayer_dep = dependency('gstreamer-player-1.0', version: '>= 1.12.3',
required: get_option('media-gstreamer'))
if gstplayer_dep.found()
media_backends += 'gstreamer'
cdata.set('HAVE_GSTREAMER', 1)
shared_module('media-gstreamer',
'gtkgstmediafile.c',
'gtkgstpaintable.c',
......
all_print_backends = [
'cups',
'cloudprint',
]
enabled_print_backends = get_option('print').split(',')
if enabled_print_backends.contains('none')
enabled_print_backends = []
elif enabled_print_backends.contains('all')
enabled_print_backends = all_print_backends
endif
# The 'file' print backend cannot be disabled
print_backends = ['file']
# Checks to see if we should compile with CUPS backend for GTK
enable_cups = enabled_print_backends.contains('cups')
if enable_cups
cups_dep = dependency('cups', version : '>=2.0', required: true)
print_backends += ['cups']
endif
# Checks to see if we should compile with cloudprint backend for GTK
enable_cloudprint = enabled_print_backends.contains('cloudprint')
if enable_cloudprint
rest_dep = dependency('rest-0.7', required : true)
json_glib_dep = dependency('json-glib-1.0', required : true)
if rest_dep.found() and json_glib_dep.found()
print_backends += ['cloudprint']
endif
endif
print_backends = []
if not cc.has_header('cairo-pdf.h', dependencies : cairo_dep)
error('Cannot find cairo-pdf.h. You must build Cairo with the pdf backend enabled.')
......@@ -44,11 +13,6 @@ if os_unix
endif
endif
# Automatic fall-back to the lpr backend
if not print_backends.contains('cups')
print_backends += ['lpr']
endif
printbackends_subdir = 'gtk-4.0/@0@/printbackends'.format(gtk_binary_version)
printbackends_install_dir = join_paths(get_option('libdir'), printbackends_subdir)
......@@ -61,7 +25,9 @@ printbackends_args = [
'-D_GLIB_EXTERN=@0@'.format(visibility_define),
] + common_cflags
if print_backends.contains('cups')
cups_dep = dependency('cups', version : '>=2.0', required: get_option('print-cups'))
if cups_dep.found()
print_backends += 'cups'
shared_module('printbackend-cups',
'gtkprintbackendcups.c',
'gtkprintercups.c',
......@@ -71,9 +37,21 @@ if print_backends.contains('cups')
dependencies: [libgtk_dep, cups_dep, colord_dep],
install_dir: printbackends_install_dir,
install : true)
else
# Automatic fall-back to the lpr backend
print_backends += 'lpr'
shared_module('printbackend-lpr',
'gtkprintbackendlpr.c',
c_args: printbackends_args,
dependencies: libgtk_dep,
install_dir: printbackends_install_dir,
install : true)
endif
if print_backends.contains('cloudprint')
rest_dep = dependency('rest-0.7', required : get_option('print-cloudprint'))
json_glib_dep = dependency('json-glib-1.0', required : get_option('print-cloudprint'))
if rest_dep.found() and json_glib_dep.found()
print_backends += 'cloudprint'
shared_module('printbackend-cloudprint',
'gtkprintbackendcloudprint.c',
'gtkprintercloudprint.c',
......@@ -84,20 +62,11 @@ if print_backends.contains('cloudprint')
install : true)
endif
if print_backends.contains('file')
shared_module('printbackend-file',
'gtkprintbackendfile.c',
c_args: printbackends_args,
dependencies: libgtk_dep,
install_dir: printbackends_install_dir,
install : true)
endif
if print_backends.contains('lpr')
shared_module('printbackend-lpr',
'gtkprintbackendlpr.c',
c_args: printbackends_args,
dependencies: libgtk_dep,
install_dir: printbackends_install_dir,
install : true)
endif
# The 'file' print backend cannot be disabled
print_backends += 'file'
shared_module('printbackend-file',
'gtkprintbackendfile.c',
c_args: printbackends_args,
dependencies: libgtk_dep,
install_dir: printbackends_install_dir,
install : true)
[wrap-git]
directory=cairo
url=https://gitlab.freedesktop.org/cairo/cairo.git
push-url=ssh://git@gitlab.freedesktop.org:cairo/cairo.git
revision=master
depth=1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment