2018-02-14 13:55:32 +00:00
|
|
|
all_print_backends = [
|
|
|
|
'cups',
|
|
|
|
'cloudprint',
|
|
|
|
]
|
|
|
|
|
|
|
|
enabled_print_backends = get_option('print-backends').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
|
2017-03-22 16:48:56 +00:00
|
|
|
print_backends = ['file']
|
|
|
|
|
2019-02-05 09:30:33 +00:00
|
|
|
# Checks to see if we should compile with CUPS backend for GTK
|
2018-02-14 13:55:32 +00:00
|
|
|
enable_cups = enabled_print_backends.contains('cups')
|
2018-02-19 02:06:11 +00:00
|
|
|
if enable_cups
|
2018-03-18 18:08:28 +00:00
|
|
|
#cups_config = find_program('cups-config', required : true)
|
2017-03-22 16:48:56 +00:00
|
|
|
#if cups_config.found()
|
|
|
|
# FIXME: eek, see configure.ac (we're just not going to support non-standar prefix for now)
|
|
|
|
#endif
|
|
|
|
if cc.has_header('cups/cups.h')
|
2017-05-03 17:40:56 +00:00
|
|
|
# TODO: include_directories from cups-config
|
|
|
|
cups_major_version = cc.compute_int('CUPS_VERSION_MAJOR', prefix : '#include <cups/cups.h>')
|
|
|
|
cups_minor_version = cc.compute_int('CUPS_VERSION_MINOR', prefix : '#include <cups/cups.h>')
|
|
|
|
message('Found CUPS version: @0@.@1@'.format(cups_major_version, cups_minor_version))
|
2019-05-06 19:04:17 +00:00
|
|
|
if cups_major_version >= 2
|
2017-05-03 17:40:56 +00:00
|
|
|
if cc.compiles('#include <cups/http.h> \n http_t http; char *s = http.authstring;')
|
|
|
|
cdata.set('HAVE_HTTP_AUTHSTRING', 1,
|
|
|
|
description :'Define if cups http_t authstring field is accessible')
|
2017-03-22 16:48:56 +00:00
|
|
|
endif
|
2018-03-18 18:08:28 +00:00
|
|
|
libcups = cc.find_library('cups', required : true)
|
2017-05-03 17:40:56 +00:00
|
|
|
if libcups.found() and cc.has_function('httpGetAuthString', dependencies : libcups)
|
|
|
|
cdata.set('HAVE_HTTPGETAUTHSTRING', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
print_backends += ['cups']
|
2018-03-18 18:08:28 +00:00
|
|
|
else
|
2019-05-06 19:04:17 +00:00
|
|
|
error('Need CUPS version >= 2.0')
|
2017-03-22 16:48:56 +00:00
|
|
|
endif
|
2018-03-18 18:08:28 +00:00
|
|
|
else
|
2017-03-22 16:48:56 +00:00
|
|
|
error('Cannot find CUPS headers in default prefix.')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-02-05 09:30:33 +00:00
|
|
|
# Checks to see if we should compile with cloudprint backend for GTK
|
2018-02-14 13:55:32 +00:00
|
|
|
enable_cloudprint = enabled_print_backends.contains('cloudprint')
|
2018-02-19 02:06:11 +00:00
|
|
|
if enable_cloudprint
|
2018-03-18 18:08:28 +00:00
|
|
|
rest_dep = dependency('rest-0.7', required : true)
|
|
|
|
json_glib_dep = dependency('json-glib-1.0', required : true)
|
2017-03-22 16:48:56 +00:00
|
|
|
if rest_dep.found() and json_glib_dep.found()
|
|
|
|
print_backends += ['cloudprint']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
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.')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if os_unix
|
|
|
|
if not cc.has_header('cairo-ps.h', dependencies : cairo_dep)
|
|
|
|
error('Cannot find cairo-ps.h. You must build Cairo with the postscript backend enabled.')
|
|
|
|
endif
|
|
|
|
if not cc.has_header('cairo-svg.h', dependencies : cairo_dep)
|
|
|
|
error('Cannot find cairo-svg.h. You must build Cairo with the svg backend enabled.')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-02-14 13:55:32 +00:00
|
|
|
# Automatic fall-back to the lpr backend
|
2018-02-16 02:53:51 +00:00
|
|
|
if not print_backends.contains('cups')
|
2017-03-22 16:48:56 +00:00
|
|
|
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)
|
|
|
|
|
2017-03-22 18:15:17 +00:00
|
|
|
cdata.set_quoted('GTK_PRINT_BACKENDS', ','.join(print_backends))
|
|
|
|
|
2018-03-11 16:18:16 +00:00
|
|
|
|
|
|
|
enable_colord = get_option('colord')
|
|
|
|
if enable_colord != 'no'
|
|
|
|
want_colord = enable_colord == 'yes'
|
|
|
|
colord_dep = dependency('colord', version: '>= 0.1.9', required: want_colord)
|
|
|
|
cdata.set('HAVE_COLORD', colord_dep.found())
|
|
|
|
else
|
|
|
|
colord_dep = []
|
|
|
|
endif
|
|
|
|
|
2018-03-12 10:02:24 +00:00
|
|
|
printbackends_args = [
|
|
|
|
'-DGTK_COMPILATION',
|
|
|
|
'-DGTK_DISABLE_DEPRECATION_WARNINGS',
|
|
|
|
'-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED',
|
|
|
|
]
|
|
|
|
|
2018-03-11 16:18:16 +00:00
|
|
|
if print_backends.contains('cups')
|
|
|
|
shared_module('printbackend-cups',
|
|
|
|
'gtkprintbackendcups.c',
|
|
|
|
'gtkprintercups.c',
|
|
|
|
'gtkcupsutils.c',
|
|
|
|
'gtkcupssecretsutils.c',
|
2018-03-12 10:02:24 +00:00
|
|
|
c_args: printbackends_args,
|
2018-03-11 16:18:16 +00:00
|
|
|
dependencies: [libgtk_dep, libcups, colord_dep],
|
|
|
|
install_dir: printbackends_install_dir,
|
|
|
|
install : true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if print_backends.contains('cloudprint')
|
|
|
|
shared_module('printbackend-cloudprint',
|
|
|
|
'gtkprintbackendcloudprint.c',
|
|
|
|
'gtkprintercloudprint.c',
|
|
|
|
'gtkcloudprintaccount.c',
|
2018-03-12 10:02:24 +00:00
|
|
|
c_args: printbackends_args,
|
2018-03-11 16:18:16 +00:00
|
|
|
dependencies: [ libgtk_dep, rest_dep, json_glib_dep ],
|
|
|
|
install_dir: printbackends_install_dir,
|
|
|
|
install : true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if print_backends.contains('file')
|
|
|
|
shared_module('printbackend-file',
|
|
|
|
'gtkprintbackendfile.c',
|
2018-03-12 10:02:24 +00:00
|
|
|
c_args: printbackends_args,
|
2018-03-11 16:18:16 +00:00
|
|
|
dependencies: libgtk_dep,
|
|
|
|
install_dir: printbackends_install_dir,
|
|
|
|
install : true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if print_backends.contains('lpr')
|
|
|
|
shared_module('printbackend-lpr',
|
|
|
|
'gtkprintbackendlpr.c',
|
2018-03-12 10:02:24 +00:00
|
|
|
c_args: printbackends_args,
|
2018-03-11 16:18:16 +00:00
|
|
|
dependencies: libgtk_dep,
|
|
|
|
install_dir: printbackends_install_dir,
|
|
|
|
install : true)
|
2018-03-12 10:02:24 +00:00
|
|
|
endif
|