/
meson.build
133 lines (113 loc) · 2.64 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
project('mpc', 'c',
version: '0.32',
meson_version: '>= 0.47',
default_options: [
'c_std=c99',
],
license: 'GPLv2+',
)
cc = meson.get_compiler('c')
conf = configuration_data()
conf.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('VERSION', meson.project_version())
conf.set('HAVE_STRNDUP', cc.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
iconv = get_option('iconv')
if iconv.disabled()
iconv = false
elif cc.has_function('iconv')
iconv = true
elif iconv.auto()
iconv = false
else
error('iconv() not available')
endif
conf.set('HAVE_ICONV', iconv)
configure_file(output: 'config.h', configuration: conf)
common_cflags = [
# for localtime_r() with glibc
'-D_GNU_SOURCE',
]
test_cflags = [
'-Wall',
'-Wextra',
'-Wno-deprecated-declarations',
'-Wmissing-prototypes',
'-Wshadow',
'-Wpointer-arith',
'-Wstrict-prototypes',
'-Wcast-qual',
'-Wwrite-strings',
'-fvisibility=hidden',
]
if get_option('buildtype') != 'debug'
test_cflags += [
'-ffunction-sections',
'-fdata-sections',
]
add_global_link_arguments(
cc.get_supported_link_arguments(
'-Wl,--gc-sections',
'-Wl,--icf=all',
),
language: 'c'
)
endif
common_cflags += cc.get_supported_arguments(test_cflags)
add_global_arguments(common_cflags, language: 'c')
libmpdclient_dep = dependency('libmpdclient', version: '>= 2.9')
inc = include_directories(
'src',
# for the generated config.h
'.',
)
if iconv
iconv_sources = files('src/charset.c')
else
iconv_sources = []
endif
executable('mpc',
'src/main.c',
'src/list.c',
'src/password.c',
'src/status.c',
'src/args.c',
'src/format.c',
'src/song_format.c',
'src/tags.c',
'src/util.c',
'src/command.c',
'src/queue.c',
'src/output.c',
'src/sticker.c',
'src/tab.c',
'src/idle.c',
'src/message.c',
'src/mount.c',
'src/neighbors.c',
'src/search.c',
'src/options.c',
'src/path.c',
iconv_sources,
include_directories: inc,
dependencies: [
libmpdclient_dep,
],
install: true
)
install_data('AUTHORS', 'COPYING', 'NEWS', 'README.rst',
install_dir : join_paths(get_option('datadir'), 'doc', meson.project_name()))
install_data(
'contrib/mpd-m3u-handler.sh', 'contrib/mpd-pls-handler.sh',
'contrib/mpc-completion.bash',
install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name(), 'contrib'))
if get_option('test')
check_dep = dependency('check')
subdir('test')
endif
with_documentation = get_option('documentation')
if not with_documentation.disabled()
sphinx = find_program('sphinx-build', required: with_documentation)
if sphinx.found()
subdir('doc')
endif
endif