build with Meson instead of autotools

So long, autotools!  This is my last MPD related project to migrate
away from it.  It has its strengths, but also very obvious weaknesses
and weirdnesses.  Today, many of its quirks are not needed anymore,
and are cumbersome and slow.  Now welcome our new Meson overlords!
This commit is contained in:
Max Kellermann
2017-12-29 17:12:55 +01:00
parent 13ce142df1
commit 94592c1406
111 changed files with 4039 additions and 7270 deletions

31
src/lib/alsa/meson.build Normal file
View File

@@ -0,0 +1,31 @@
if not is_linux
alsa_dep = dependency('', required: false)
subdir_done()
endif
libasound_dep = dependency('alsa', version: '>= 0.9.0', required: get_option('alsa'))
if not libasound_dep.found()
alsa_dep = dependency('', required: false)
subdir_done()
endif
conf.set('ENABLE_ALSA', true)
alsa = static_library(
'alsa',
'Version.cxx',
'AllowedFormat.cxx',
'HwSetup.cxx',
'NonBlock.cxx',
include_directories: inc,
dependencies: [
libasound_dep,
],
)
alsa_dep = declare_dependency(
link_with: alsa,
dependencies: [
event_dep,
],
)

28
src/lib/curl/meson.build Normal file
View File

@@ -0,0 +1,28 @@
curl_dep = dependency('libcurl', version: '>= 7.18', required: get_option('curl'))
conf.set('ENABLE_CURL', curl_dep.found())
if not curl_dep.found()
subdir_done()
endif
curl = static_library(
'curl',
'Delegate.cxx',
'Version.cxx',
'Init.cxx',
'Global.cxx',
'Request.cxx',
'Form.cxx',
include_directories: inc,
dependencies: [
curl_dep,
],
)
curl_dep = declare_dependency(
link_with: curl,
dependencies: [
event_dep,
util_dep,
curl_dep,
],
)

37
src/lib/dbus/meson.build Normal file
View File

@@ -0,0 +1,37 @@
dbus_dep = dependency('dbus-1', required: get_option('dbus'))
conf.set('ENABLE_DBUS', dbus_dep.found())
if not dbus_dep.found()
if get_option('udisks').enabled()
error('udisks2 requires D-Bus')
endif
enable_udisks = false
conf.set('ENABLE_UDISKS', enable_udisks)
subdir_done()
endif
enable_udisks = not get_option('udisks').disabled()
conf.set('ENABLE_UDISKS', enable_udisks)
dbus = static_library(
'dbus',
'Connection.cxx',
'Error.cxx',
'Message.cxx',
'UDisks2.cxx',
'ScopeMatch.cxx',
'Glue.cxx',
'Watch.cxx',
include_directories: inc,
dependencies: [
dbus_dep,
],
)
dbus_dep = declare_dependency(
link_with: dbus,
dependencies: [
dbus_dep,
event_dep,
],
)

19
src/lib/expat/meson.build Normal file
View File

@@ -0,0 +1,19 @@
expat_dep = dependency('expat', required: get_option('expat'))
conf.set('ENABLE_EXPAT', expat_dep.found())
if not expat_dep.found()
subdir_done()
endif
expat = static_library(
'expat',
'ExpatParser.cxx',
'StreamExpatParser.cxx',
include_directories: inc,
dependencies: [
expat_dep,
],
)
expat_dep = declare_dependency(
link_with: expat,
)

View File

@@ -0,0 +1,29 @@
libavformat_dep = dependency('libavformat', version: '>= 56.1', required: get_option('ffmpeg'))
libavcodec_dep = dependency('libavcodec', version: '>= 56.1', required: get_option('ffmpeg'))
libavutil_dep = dependency('libavutil', version: '>= 54.3', required: get_option('ffmpeg'))
enable_ffmpeg = libavformat_dep.found() and libavcodec_dep.found() and libavutil_dep.found()
conf.set('ENABLE_FFMPEG', enable_ffmpeg)
if not enable_ffmpeg
ffmpeg_dep = dependency('', required: false)
subdir_done()
endif
ffmpeg = static_library(
'ffmpeg',
'Init.cxx',
'LogError.cxx',
'LogCallback.cxx',
'Error.cxx',
'Domain.cxx',
include_directories: inc,
dependencies: [
libavformat_dep,
libavcodec_dep,
libavutil_dep,
],
)
ffmpeg_dep = declare_dependency(
link_with: ffmpeg,
)

View File

@@ -0,0 +1,20 @@
gcrypt_dep = c_compiler.find_library('gcrypt', required: get_option('qobuz'))
if not gcrypt_dep.found()
subdir_done()
endif
gcrypt = static_library(
'gcrypt',
'MD5.cxx',
include_directories: inc,
dependencies: [
gcrypt_dep,
],
)
gcrypt_dep = declare_dependency(
link_with: gcrypt,
dependencies: [
gcrypt_dep,
],
)

42
src/lib/icu/meson.build Normal file
View File

@@ -0,0 +1,42 @@
icu_dep = dependency('icu-i18n', version: '>= 50', required: get_option('icu'))
conf.set('HAVE_ICU', icu_dep.found())
icu_sources = [
'CaseFold.cxx',
'Compare.cxx',
'Collate.cxx',
'Converter.cxx',
]
if is_windows
icu_sources += 'Win32.cxx'
endif
if icu_dep.found()
icu_sources += [
'Util.cxx',
'Init.cxx',
]
elif not get_option('iconv').disabled()
have_iconv = compiler.has_function('iconv')
conf.set('HAVE_ICONV', have_iconv)
if get_option('iconv').enabled()
error('iconv() not available')
endif
endif
icu = static_library(
'icu',
icu_sources,
include_directories: inc,
dependencies: [
icu_dep,
],
)
icu_dep = declare_dependency(
link_with: icu,
dependencies: [
util_dep,
],
)

27
src/lib/nfs/meson.build Normal file
View File

@@ -0,0 +1,27 @@
nfs_dep = dependency('libnfs', version: '>= 1.11', required: get_option('nfs'))
conf.set('ENABLE_NFS', nfs_dep.found())
if not nfs_dep.found()
subdir_done()
endif
nfs = static_library(
'nfs',
'Connection.cxx',
'Error.cxx',
'Manager.cxx',
'Glue.cxx',
'Base.cxx',
'FileReader.cxx',
'Blocking.cxx',
include_directories: inc,
dependencies: [
nfs_dep,
],
)
nfs_dep = declare_dependency(
link_with: nfs,
dependencies: [
nfs_dep,
],
)

15
src/lib/oss/meson.build Normal file
View File

@@ -0,0 +1,15 @@
enable_oss = get_option('oss')
if enable_oss.disabled()
enable_oss = false
elif enable_oss.auto() and alsa_dep.found()
# don't bother auto-enabling OSS if ALSA is available
enable_oss = false
elif compiler.has_header('sys/soundcard.h') or compiler.has_header('soundcard.h')
enable_oss = true
elif enable_oss.auto()
enable_oss = false
else
error('sys/soundcard.h not found')
endif
conf.set('HAVE_OSS', enable_oss)

23
src/lib/pulse/meson.build Normal file
View File

@@ -0,0 +1,23 @@
pulse_dep = dependency('libpulse', version: '>= 0.9.16', required: get_option('pulse'))
conf.set('ENABLE_PULSE', pulse_dep.found())
if not pulse_dep.found()
subdir_done()
endif
pulse = static_library(
'pulse',
'LogError.cxx',
'Error.cxx',
'Domain.cxx',
include_directories: inc,
dependencies: [
pulse_dep,
],
)
pulse_dep = declare_dependency(
link_with: pulse,
dependencies: [
pulse_dep,
],
)

2
src/lib/roar/meson.build Normal file
View File

@@ -0,0 +1,2 @@
libroar_dep = dependency('libroar', version: '>= 0.4.0', required: get_option('roar'))
conf.set('ENABLE_ROAR', libroar_dep.found())

View File

@@ -0,0 +1,23 @@
smbclient_dep = dependency('smbclient', version: '>= 0.2', required: get_option('smbclient'))
conf.set('ENABLE_SMBCLIENT', smbclient_dep.found())
if not smbclient_dep.found()
subdir_done()
endif
smbclient = static_library(
'smbclient',
'Domain.cxx',
'Mutex.cxx',
'Init.cxx',
include_directories: inc,
dependencies: [
smbclient_dep,
],
)
smbclient_dep = declare_dependency(
link_with: smbclient,
dependencies: [
smbclient_dep,
],
)

12
src/lib/sndio/meson.build Normal file
View File

@@ -0,0 +1,12 @@
libsndio_dep = c_compiler.find_library('sndio', required: get_option('sndio'))
if libsndio_dep.found()
if c_compiler.has_header_symbol('sndio.h', 'ROAR_VERSION')
if get_option('sndio').enabled()
error('Found libroarsndio, which is known to be broken.')
else
warning('Found libroarsndio, which is known to be broken; ignoring it.')
libsndio_dep = dependency('', required: false)
endif
endif
endif
conf.set('ENABLE_SNDIO', libsndio_dep.found())

View File

@@ -0,0 +1,18 @@
sqlite_dep = dependency('sqlite3', version: '>= 3.7.3', required: get_option('sqlite'))
conf.set('ENABLE_SQLITE', sqlite_dep.found())
if not sqlite_dep.found()
subdir_done()
endif
sqlite = static_library(
'sqlite',
'Error.cxx',
include_directories: inc,
dependencies: [
sqlite_dep,
],
)
sqlite_dep = declare_dependency(
link_with: sqlite,
)

View File

@@ -0,0 +1,23 @@
if not is_linux or is_android
systemd_dep = dependency('', required: false)
subdir_done()
endif
systemd_dep = dependency('libsystemd', required: get_option('systemd'))
conf.set('ENABLE_SYSTEMD_DAEMON', systemd_dep.found())
if not systemd_dep.found()
subdir_done()
endif
systemd = static_library(
'systemd',
'Watchdog.cxx',
include_directories: inc,
dependencies: [
systemd_dep,
],
)
systemd_dep = declare_dependency(
link_with: systemd,
)

40
src/lib/upnp/meson.build Normal file
View File

@@ -0,0 +1,40 @@
upnp_dep = dependency('libupnp', required: get_option('upnp'))
conf.set('ENABLE_UPNP', upnp_dep.found())
if not upnp_dep.found()
subdir_done()
endif
if not curl_dep.found()
error('UPnP requires CURL')
endif
if not expat_dep.found()
error('UPnP requires expat')
endif
upnp = static_library(
'upnp',
'Init.cxx',
'ClientInit.cxx',
'Device.cxx',
'ContentDirectoryService.cxx',
'Discovery.cxx',
'ixmlwrap.cxx',
'Util.cxx',
include_directories: inc,
dependencies: [
upnp_dep,
curl_dep,
expat_dep,
],
)
upnp_dep = declare_dependency(
link_with: upnp,
dependencies: [
upnp_dep,
curl_dep,
expat_dep,
event_dep,
],
)

21
src/lib/wrap/meson.build Normal file
View File

@@ -0,0 +1,21 @@
libwrap_option = get_option('libwrap')
enable_libwrap = false
if not libwrap_option.disabled() and compiler.has_header('tcpd.h') and compiler.compiles('''
#include <tcpd.h>
bool CheckLibWrap(int fd, const char &progname) {
struct request_info req;
request_init(&req, RQ_FILE, fd, RQ_DAEMON, progname, 0);
fromhost(&req);
return hosts_access(&req);
}
''')
libwrap_dep = compiler.find_library('wrap', required: libwrap_option)
else
libwrap_dep = dependency('', required: libwrap_option)
endif
if not libwrap_dep.found() and libwrap_option.enabled()
error('libwrap not found')
endif
conf.set('HAVE_LIBWRAP', libwrap_dep.found())

81
src/lib/xiph/meson.build Normal file
View File

@@ -0,0 +1,81 @@
libflac_dep = dependency('flac', version: '>= 1.2', required: get_option('flac'))
libopus_dep = dependency('opus', required: get_option('opus'))
libvorbis_dep = dependency('vorbis', required: get_option('vorbis'))
if need_encoder
libvorbisenc_dep = dependency('vorbisenc', required: get_option('vorbisenc'))
else
libvorbisenc_dep = dependency('', required: false)
endif
if libopus_dep.found() or libvorbis_dep.found() or libvorbisenc_dep.found()
libogg_dep = dependency('ogg')
else
libogg_dep = dependency('', required: false)
endif
if not libogg_dep.found() or not libflac_dep.found()
xiph_dep = dependency('', required: false)
ogg_dep = dependency('', required: false)
flac_dep = dependency('', required: false)
subdir_done()
endif
xiph = static_library(
'xiph',
'VorbisComments.cxx',
'XiphTags.cxx',
include_directories: inc,
)
xiph_dep = declare_dependency(
link_with: xiph,
)
if libogg_dep.found()
ogg = static_library(
'ogg',
'OggVisitor.cxx',
'OggSerial.cxx',
'OggSyncState.cxx',
'OggFind.cxx',
'OggPacket.cxx',
include_directories: inc,
dependencies: [
libogg_dep,
],
)
ogg_dep = declare_dependency(
link_with: ogg,
dependencies: [
xiph_dep,
libogg_dep,
],
)
else
ogg_dep = dependency('', required: false)
endif
if libflac_dep.found()
flac = static_library(
'flac',
'FlacIOHandle.cxx',
'FlacMetadataChain.cxx',
'FlacStreamMetadata.cxx',
include_directories: inc,
dependencies: [
libflac_dep,
],
)
flac_dep = declare_dependency(
link_with: flac,
dependencies: [
xiph_dep,
libflac_dep,
],
)
else
flac_dep = dependency('', required: false)
endif

21
src/lib/yajl/meson.build Normal file
View File

@@ -0,0 +1,21 @@
yajl_dep = dependency('yajl', required: get_option('yajl'))
if not yajl_dep.found()
subdir_done()
endif
yajl = static_library(
'yajl',
'ResponseParser.cxx',
'ParseInputStream.cxx',
include_directories: inc,
dependencies: [
yajl_dep,
],
)
yajl_dep = declare_dependency(
link_with: yajl,
dependencies: [
yajl_dep,
],
)

17
src/lib/zlib/meson.build Normal file
View File

@@ -0,0 +1,17 @@
zlib_dep = dependency('zlib', required: get_option('zlib'))
if not zlib_dep.found()
subdir_done()
endif
zlib = static_library(
'zlib',
'Error.cxx',
include_directories: inc,
dependencies: [
zlib_dep,
],
)
zlib_dep = declare_dependency(
link_with: zlib,
)