-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
meson.build
158 lines (137 loc) · 3.84 KB
/
meson.build
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
project('girara', 'c',
version: '0.4.4',
meson_version: '>=0.61',
default_options: ['c_std=c17', 'warning_level=3'],
)
version = meson.project_version()
version_array = version.split('.')
# Rules for so_major and so_minor:
# Before a release perform the following checks against the last release:
# * If a function has been removed or the paramaters of a function have changed
# bump SOMAJOR and set SOMINOR to 0.
# * If any of the exported datastructures have changed in a incompatible way
# bump SOMAJOR and set SOMINOR to 0.
# * If a function has been added bump SOMINOR.
so_major = '4'
so_minor = '0'
so_version = '@0@.@1@'.format(so_major, so_minor)
conf_data = configuration_data()
conf_data.set('GVMAJOR', version_array[0])
conf_data.set('GVMINOR', version_array[1])
conf_data.set('GVREV', version_array[2])
conf_data.set('version', version)
cc = meson.get_compiler('c')
prefix = get_option('prefix')
localedir = get_option('localedir')
# required dependencies
libm = cc.find_library('m', required: false)
glib = dependency('glib-2.0', version: '>=2.72')
gtk3 = dependency('gtk+-3.0', version: '>=3.24')
pango = dependency('pango', version: '>=1.50')
build_dependencies = [libm, glib, gtk3, pango]
pc_requires = ['glib-2.0', 'gtk+-3.0']
# supported functions
has_getpwnam_r = cc.has_function('getpwnam_r', prefix: '#define _DEFAULT_SOURCE\n#include <sys/types.h>\n#include <pwd.h>')
# defines
defines = [
'-DGETTEXT_PACKAGE="libgirara-gtk3-@0@"'.format(so_major),
'-DLOCALEDIR="@0@"'.format(join_paths(prefix, localedir)),
'-D_DEFAULT_SOURCE',
]
if has_getpwnam_r
defines += ['-DHAVE_GETPWNAM_R']
endif
# compile flags
flags = [
'-Wmissing-declarations',
'-Werror=implicit-function-declaration',
'-Werror=vla',
'-Werror=int-conversion'
]
flags = cc.get_supported_arguments(flags)
# optional dependencies
pc_requires_private = ['pango']
jsonc = dependency('json-glib-1.0', required: get_option('json'))
if jsonc.found()
build_dependencies += jsonc
defines += '-DWITH_JSON'
pc_requires_private += 'json-glib-1.0'
endif
# generate version header file
version_header = configure_file(
input: 'girara/version.h.in',
output: 'girara-version.h',
configuration: conf_data
)
include_directories = [
include_directories('.')
]
subdir('data')
subdir('po')
# source files
sources = files(
'girara/callbacks.c',
'girara/commands.c',
'girara/completion.c',
'girara/config.c',
'girara/datastructures.c',
'girara/entry.c',
'girara/input-history-io.c',
'girara/input-history.c',
'girara/log.c',
'girara/session.c',
'girara/settings.c',
'girara/shortcuts.c',
'girara/statusbar.c',
'girara/template.c',
'girara/utils.c'
)
sources += girara_css
# header files to install
headers = files(
'girara/callbacks.h',
'girara/commands.h',
'girara/completion.h',
'girara/config.h',
'girara/datastructures.h',
'girara/entry.h',
'girara/girara.h',
'girara/input-history.h',
'girara/log.h',
'girara/macros.h',
'girara/session.h',
'girara/settings.h',
'girara/shortcuts.h',
'girara/statusbar.h',
'girara/template.h',
'girara/types.h',
'girara/utils.h'
)
headers += version_header
# girara library
girara = library(
'girara-gtk3',
sources,
dependencies: build_dependencies,
version: so_version,
install: true,
include_directories: include_directories,
c_args: defines + flags,
gnu_symbol_visibility: 'hidden'
)
install_headers(headers, subdir: 'girara')
# pkg-config file
pkg = import('pkgconfig')
pkg.generate(
name: 'girara-gtk3',
description: 'User interface library',
url: 'https://pwmt.org/projects/girara',
version: version,
libraries: girara,
requires: pc_requires,
requires_private: pc_requires_private,
)
girara_dependency = declare_dependency(link_with: girara, include_directories: include_directories)
meson.override_dependency('girara-gtk3', girara_dependency)
subdir('doc')
subdir('tests')