File: meson.build

package info (click to toggle)
libmpdclient 2.16-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 844 kB
  • sloc: ansic: 8,158; python: 65; makefile: 11; sh: 5
file content (231 lines) | stat: -rw-r--r-- 5,303 bytes parent folder | download
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
project('libmpdclient', 'c', version: '2.16',
  default_options: [
    'c_std=c99',
  ],
  license: 'BSD',
)

cc = meson.get_compiler('c')

conf = configuration_data()
conf.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('VERSION', meson.project_version())

if host_machine.system() != 'windows'
  conf.set_quoted('DEFAULT_SOCKET', get_option('default_socket'))
endif

conf.set_quoted('DEFAULT_HOST', get_option('default_host'))
conf.set('DEFAULT_PORT', get_option('default_port'))

conf.set('HAVE_STRNDUP', cc.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))

if get_option('tcp')
  conf.set('ENABLE_TCP', true)
  conf.set('HAVE_GETADDRINFO', cc.has_function('getaddrinfo'))
endif

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

version_conf = configuration_data()
splitted_version = meson.project_version().split('.')
version_conf.set('MAJOR_VERSION', splitted_version[0])
version_conf.set('MINOR_VERSION', splitted_version[1])
if splitted_version.length() >= 3
  version_conf.set('PATCH_VERSION', splitted_version[2])
else
  version_conf.set('PATCH_VERSION', '0')
endif
configure_file(input: 'include/mpd/version.h.in', output: 'version.h', configuration: version_conf)

common_cflags = [
  # for strdup() with glibc
  '-D_GNU_SOURCE',
]

test_cflags = [
  '-Wall',
  '-Wextra',
  '-Wno-deprecated-declarations',
  '-Wmissing-prototypes',
  '-Wshadow',
  '-Wpointer-arith',
  '-Wstrict-prototypes',
  '-Wcast-qual',
  '-Wwrite-strings',
]

foreach f: test_cflags
  if cc.has_argument(f)
    common_cflags += [ f ]
  endif
endforeach

add_global_arguments(common_cflags, language: 'c')

common_ldflags = []

test_ldflags = [
]

if host_machine.system() == 'linux'
  test_ldflags += [ '-Wl,--version-script=' + join_paths(meson.source_root(), 'libmpdclient.ld') ]
endif

if meson.version().version_compare('>=0.46.0')
  # compiler.has_link_argument() was added in Meson 0.46.0
  foreach f: test_ldflags
    if cc.has_link_argument(f)
      common_ldflags += [ f ]
    endif
  endforeach
else
  # Meson too old: assume the linker supports all flags
  common_ldflags += test_ldflags
endif

platform_deps = []
if host_machine.system() == 'windows'
  platform_deps = [cc.find_library('ws2_32')]
endif

inc = include_directories(
  'src',
  'include',

  # for the generated config.h
  '.',
)

libmpdclient = library('mpdclient',
  'src/async.c',
  'src/audio_format.c',
  'src/ierror.c',
  'src/resolver.c',
  'src/capabilities.c',
  'src/connection.c',
  'src/database.c',
  'src/directory.c',
  'src/rdirectory.c',
  'src/error.c',
  'src/fd_util.c',
  'src/output.c',
  'src/coutput.c',
  'src/entity.c',
  'src/idle.c',
  'src/iso8601.c',
  'src/kvlist.c',
  'src/list.c',
  'src/mixer.c',
  'src/mount.c', 'src/cmount.c',
  'src/parser.c',
  'src/password.c',
  'src/player.c',
  'src/playlist.c',
  'src/player.c',
  'src/rplaylist.c',
  'src/cplaylist.c',
  'src/queue.c',
  'src/quote.c',
  'src/recv.c',
  'src/response.c',
  'src/run.c',
  'src/search.c',
  'src/send.c',
  'src/socket.c',
  'src/song.c',
  'src/status.c',
  'src/cstatus.c',
  'src/stats.c',
  'src/cstats.c',
  'src/sync.c',
  'src/tag.c',
  'src/sticker.c',
  'src/settings.c',
  'src/message.c',
  'src/cmessage.c',
  link_depends: [
    'libmpdclient.ld'
  ],
  include_directories: inc,
  dependencies: [
    platform_deps,
  ],
  link_args: common_ldflags,
  version: meson.project_version(),
  soversion: splitted_version[0],
  install: true
)
libmpdclient_dep = declare_dependency(link_with: libmpdclient)

executable('example',
  'src/example.c',
  include_directories: inc,
  dependencies: [
    libmpdclient_dep,
  ])

install_headers(
  'include/mpd/async.h',
  'include/mpd/audio_format.h',
  'include/mpd/client.h',
  'include/mpd/capabilities.h',
  'include/mpd/compiler.h',
  'include/mpd/connection.h',
  'include/mpd/database.h',
  'include/mpd/directory.h',
  'include/mpd/entity.h',
  'include/mpd/error.h',
  'include/mpd/idle.h',
  'include/mpd/list.h',
  'include/mpd/mixer.h',
  'include/mpd/mount.h',
  'include/mpd/parser.h',
  'include/mpd/password.h',
  'include/mpd/player.h',
  'include/mpd/playlist.h',
  'include/mpd/protocol.h',
  'include/mpd/queue.h',
  'include/mpd/recv.h',
  'include/mpd/response.h',
  'include/mpd/send.h',
  'include/mpd/status.h',
  'include/mpd/stats.h',
  'include/mpd/tag.h',
  'include/mpd/output.h',
  'include/mpd/pair.h',
  'include/mpd/search.h',
  'include/mpd/socket.h',
  'include/mpd/song.h',
  'include/mpd/sticker.h',
  'include/mpd/settings.h',
  'include/mpd/message.h',
  join_paths(meson.build_root(), 'version.h'),
  subdir: 'mpd')

docdir = join_paths(get_option('datadir'), 'doc', meson.project_name())
install_data('AUTHORS', 'COPYING', 'NEWS', 'README.rst',
  install_dir: docdir)

install_data('vapi/libmpdclient.vapi',
  install_dir : join_paths(get_option('datadir'), 'vala', 'vapi'))

pkg_mod = import('pkgconfig')
pkg_mod.generate(
  libraries: libmpdclient,
  version: meson.project_version(),
  name: 'libmpdclient',
  description: 'Music Player Daemon client library',
)

if get_option('documentation')
  doxygen = find_program('doxygen', required: false)
  if doxygen.found()
    subdir('doc')
  endif
endif

if get_option('test')
  check_dep = dependency('check')
  subdir('test')
endif