1project(
2  'gnome-documents', 'c',
3  version: '3.34.0',
4  license: 'GPL2+',
5  default_options: 'buildtype=debugoptimized',
6  meson_version: '>= 0.50.0'
7)
8
9documents_version = meson.project_version()
10
11documents_ns = 'Gd'
12documents_private_ns = documents_ns + 'Private'
13
14documents_api_version = '1.0'
15documents_gir_version = '1.0'
16
17documents_apps = [
18  'org.gnome.Documents'
19]
20
21documents_prefix = get_option('prefix')
22documents_bindir = join_paths(documents_prefix, get_option('bindir'))
23documents_datadir = join_paths(documents_prefix, get_option('datadir'))
24documents_libdir = join_paths(documents_prefix, get_option('libdir'))
25documents_mandir = join_paths(documents_prefix, get_option('mandir'))
26
27documents_pkgdatadir = join_paths(documents_datadir, meson.project_name())
28documents_pkglibdir = join_paths(documents_libdir, meson.project_name())
29
30documents_schemadir = join_paths(documents_datadir, 'glib-2.0', 'schemas')
31
32cc = meson.get_compiler('c')
33
34config_h = configuration_data()
35
36# defines
37set_defines = [
38  # package
39  ['PACKAGE_NAME', meson.project_name()],
40  ['PACKAGE_VERSION', documents_version],
41  # i18n
42  ['GETTEXT_PACKAGE', meson.project_name()]
43]
44
45foreach define: set_defines
46  config_h.set_quoted(define[0], define[1])
47endforeach
48
49# compiler flags
50add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
51
52evince_req_version = '>= 3.13.3'
53tracker_req_version = '>= 0.17.3'
54
55gjs_dep = dependency('gjs-1.0', version: '>= 1.48.0')
56gjs_console = gjs_dep.get_pkgconfig_variable('gjs_console')
57
58documents_deps = [
59  gjs_dep,
60  dependency('evince-document-3.0', version: evince_req_version),
61  dependency('evince-view-3.0', version: evince_req_version),
62  dependency('glib-2.0', version: '>= 2.39.3'),
63  dependency('gnome-desktop-3.0'),
64  dependency('gobject-introspection-1.0', version: '>= 1.31.6'),
65  dependency('gtk+-3.0', version: '>= 3.22.15'),
66  dependency('libsoup-2.4', version: '>= 2.41.3'),
67  dependency('tracker-control-2.0', version: tracker_req_version),
68  dependency('tracker-sparql-2.0', version: tracker_req_version),
69  dependency('webkit2gtk-4.0', version: '>= 2.6.0'),
70  cc.find_library('m')
71]
72
73# we just check their existence for gir
74dependency('libgdata')
75dependency('goa-1.0')
76dependency('zapojit-0.0')
77
78# Although GTK+ 3.10 includes hi-dpi functionality, it does not require a cairo with
79# cairo_surface_set_device_scale(), which we also need if we're to support hi-dpi,
80# so we need check for that explicity.
81config_h.set(
82  'HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE',
83  cc.has_function('cairo_surface_set_device_scale', dependencies: documents_deps)
84)
85
86libgd = subproject(
87  'libgd',
88  default_options: [
89    'pkgdatadir=' + documents_pkgdatadir,
90    'pkglibdir=' + documents_pkglibdir,
91    'static=false',
92    'with-gtk-hacks=true',
93    'with-introspection=true',
94    'with-main-view=true',
95    'with-notification=true',
96    'with-tagged-entry=true'
97  ]
98)
99documents_deps += libgd.get_variable('libgd_dep')
100
101configure_file(
102  output: 'config.h',
103  configuration: config_h
104)
105
106gnome = import('gnome')
107i18n = import('i18n')
108pkg = import('pkgconfig')
109
110po_dir = join_paths(meson.source_root(), 'po')
111
112top_inc = include_directories('.')
113
114subdir('help')
115subdir('src')
116subdir('data')
117subdir('po')
118
119if get_option('documentation')
120  subdir('man')
121endif
122
123if get_option('getting_started')
124  subdir('getting-started')
125endif
126
127meson.add_install_script(
128  'meson_post_install.py',
129  documents_datadir,
130  documents_bindir
131)
132
133output = '\n        ' + meson.project_name() + ' ' + documents_version + '\n'
134output += '        ======================\n\n'
135output += '        prefix:    ' + documents_prefix + '\n'
136output += '        compiler:  ' + cc.get_id() + '\n'
137message(output)
138