summaryrefslogtreecommitdiff
path: root/meson.build
blob: 45fa8aae9f14f695b4f91617bc18be07a0053d90 (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
project('libwnck',
  'c',
  version: '3.31.1',
  meson_version: '>= 0.48.1')

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.32' },
  {'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').enabled() },
  {'name': X11_PACKAGE },
  {'name': XRES_PACKAGE, '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 not required and 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'))
pc_conf.set('STARTUP_NOTIFICATION_PACKAGE', STARTUP_NOTIFICATION_PACKAGE)
pc_conf.set('X11_PACKAGE', X11_PACKAGE)
pc_conf.set('XRES_PACKAGE', XRES_PACKAGE)
pc_conf.set('VERSION', meson.project_version())

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

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

if get_option('enable-gtk-doc')
  subdir('doc')
endif