summaryrefslogtreecommitdiff
path: root/meson.build
blob: 907fdf269e7eefa2c17eaa07e48da7a1d0deb2e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
project('libwnck',
  'c',
  version: '43.0',
  meson_version: '>= 0.50.0')

LIBWNCK_SOVERSION = 0

# libtool versioning for libwnck
# increment if the interface has additions, changes, removals.
LIBWNCK_CURRENT = 3

# increment any time the source changes; set to
# 0 if you increment CURRENT
LIBWNCK_REVISION = 0

# increment if any interfaces have been added; set to 0
# if any interfaces have been changed or removed. removal has
# precedence over adding, so set to 0 if both happened.
LIBWNCK_AGE = 3

MODULE_NAME = meson.project_name() + '-@0@'.format(LIBWNCK_CURRENT)
MODULE_VERSION = '@0@.@1@'.format(LIBWNCK_CURRENT, LIBWNCK_REVISION)
PACKAGE_NAME = MODULE_NAME + '.@0@'.format(LIBWNCK_REVISION)
LIBNAME = MODULE_NAME.split('lib')[1]

prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))
libdir = join_paths(prefix, get_option('libdir'))
includedir = join_paths(prefix, get_option('includedir'))
localedir = join_paths(prefix, get_option('localedir'))

default_includes = include_directories('.')
conf = configuration_data()
cc = meson.get_compiler('c')

LIBWNCK_DEPS = [cc.find_library('m', required: true)]
STARTUP_NOTIFICATION_PACKAGE = 'libstartup-notification-1.0'
X11_PACKAGE = 'x11'
XRES_PACKAGE = 'xres'

pkg_deps = [
  {'name': 'cairo-xlib-xrender', 'required': false},
  {'name': 'glib-2.0', 'version': '>= 2.44' },
  {'name': 'gobject-2.0', 'version': '>= 2.13.0' },
  {'name': 'gtk+-3.0', 'version': '>= 3.22.0' },
  {'name': STARTUP_NOTIFICATION_PACKAGE, 'version': '>= 0.4', 'required': get_option('startup_notification')},
  {'name': X11_PACKAGE },
  {'name': XRES_PACKAGE, 'version': '>= 1.2', 'required': false},
]

foreach p: pkg_deps
  pkg = p.get('name')
  required = p.get('required', true)
  dep = dependency(pkg, version: p.get('version', []), required: required)
  LIBWNCK_DEPS += dep

  if dep.found()
    conf.set('HAVE_' + pkg.to_upper().underscorify(), 1)
  endif
endforeach

conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('GETTEXT_PACKAGE', PACKAGE_NAME)
conf.set_quoted('VERSION', meson.project_version())

configure_file(input: 'config.h.meson',
  output : 'config.h',
  configuration : conf)

pc_conf = configuration_data()
pc_conf.set('prefix', get_option('prefix'))
pc_conf.set('exec_prefix', '${prefix}')
pc_conf.set('libdir', '${exec_prefix}' / get_option('libdir'))
pc_conf.set('includedir', '${prefix}' / get_option('includedir'))
if conf.has('HAVE_' + STARTUP_NOTIFICATION_PACKAGE.to_upper().underscorify())
  pc_conf.set('STARTUP_NOTIFICATION_PACKAGE', STARTUP_NOTIFICATION_PACKAGE)
endif
pc_conf.set('X11_PACKAGE', X11_PACKAGE)
if conf.has('HAVE_' + XRES_PACKAGE.to_upper().underscorify())
  pc_conf.set('XRES_PACKAGE', XRES_PACKAGE)
endif
pc_conf.set('VERSION', meson.project_version())

foreach pc: [PACKAGE_NAME, PACKAGE_NAME + '-uninstalled']
  configure_file(input: pc + '.pc.in',
    output: pc + '.pc',
    configuration: pc_conf,
    install: not pc.contains('-uninstalled'),
    install_dir: join_paths(libdir, 'pkgconfig'),
  )
endforeach

subdir('libwnck')
subdir('po')

if get_option('gtk_doc')
  subdir('doc')
endif