Merge branch 'v0.21.x'

This commit is contained in:
Max Kellermann 2020-05-27 16:16:30 +02:00
commit 5e93e882c9
12 changed files with 128 additions and 12 deletions

3
.gitignore vendored
View File

@ -6,3 +6,6 @@
/output/ /output/
__pycache__/ __pycache__/
/.clangd/
/compile_commands.json

View File

@ -109,7 +109,8 @@ jobs:
- chromaprint - chromaprint
- libsamplerate - libsamplerate
- libsoxr - libsoxr
- libzzip # libzzip appears to be broken on Homebrew: "ld: library not found for -lzzip"
#- libzzip
- flac - flac
- opus - opus
- libvorbis - libvorbis

11
NEWS
View File

@ -43,8 +43,17 @@ ver 0.21.24 (not yet released)
- "tagtypes" requires no permissions - "tagtypes" requires no permissions
* database * database
- simple: fix crash when mounting twice - simple: fix crash when mounting twice
* decoder
- modplug: fix Windows build failure
- wildmidi: attempt to detect WildMidi using pkg-config
- wildmidi: fix Windows build failure
* Android
- enable the decoder plugins ModPlug and WildMidi
- fix build failure with Android NDK r21
* Windows
- enable the decoder plugins ModPlug and WildMidi
- work around Meson bug breaking the Windows build with GCC 10
* fix unit test failure * fix unit test failure
* fix build failure with Android NDK r21
ver 0.21.23 (2020/04/23) ver 0.21.23 (2020/04/23)
* protocol * protocol

View File

@ -168,6 +168,8 @@ thirdparty_libs = [
opus, opus,
flac, flac,
libid3tag, libid3tag,
libmodplug,
wildmidi,
ffmpeg, ffmpeg,
curl, curl,
libexpat, libexpat,

View File

@ -5,7 +5,8 @@ project(
meson_version: '>= 0.49.0', meson_version: '>= 0.49.0',
default_options: [ default_options: [
'c_std=c99', 'c_std=c99',
'cpp_std=c++17' 'cpp_std=c++17',
'warning_level=2',
], ],
license: 'GPLv2+', license: 'GPLv2+',
) )
@ -153,7 +154,13 @@ conf.set('HAVE_GETPWNAM_R', compiler.has_function('getpwnam_r'))
conf.set('HAVE_GETPWUID_R', compiler.has_function('getpwuid_r')) conf.set('HAVE_GETPWUID_R', compiler.has_function('getpwuid_r'))
conf.set('HAVE_INITGROUPS', compiler.has_function('initgroups')) conf.set('HAVE_INITGROUPS', compiler.has_function('initgroups'))
conf.set('HAVE_FNMATCH', compiler.has_function('fnmatch')) conf.set('HAVE_FNMATCH', compiler.has_function('fnmatch'))
conf.set('HAVE_STRNDUP', compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
# Explicitly exclude Windows in this check because
# https://github.com/mesonbuild/meson/issues/3672 (reported in 2018,
# still not fixed in 2020) causes Meson to believe it exists, because
# __builtin_strndup() exists (but strndup() still cannot be used).
conf.set('HAVE_STRNDUP', not is_windows and compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
conf.set('HAVE_STRCASESTR', compiler.has_function('strcasestr')) conf.set('HAVE_STRCASESTR', compiler.has_function('strcasestr'))
conf.set('HAVE_PRCTL', is_linux) conf.set('HAVE_PRCTL', is_linux)

45
python/build/cmake.py Normal file
View File

@ -0,0 +1,45 @@
import subprocess
from build.project import Project
def configure(toolchain, src, build, args=()):
cross_args = []
if toolchain.is_windows:
cross_args.append('-DCMAKE_SYSTEM_NAME=Windows')
cross_args.append('-DCMAKE_RC_COMPILER=' + toolchain.windres)
configure = [
'cmake',
src,
'-DCMAKE_INSTALL_PREFIX=' + toolchain.install_prefix,
'-DCMAKE_BUILD_TYPE=release',
'-DCMAKE_C_COMPILER=' + toolchain.cc,
'-DCMAKE_CXX_COMPILER=' + toolchain.cxx,
'-DCMAKE_C_FLAGS=' + toolchain.cflags + ' ' + toolchain.cppflags,
'-DCMAKE_CXX_FLAGS=' + toolchain.cxxflags + ' ' + toolchain.cppflags,
'-GNinja',
] + cross_args + args
subprocess.check_call(configure, env=toolchain.env, cwd=build)
class CmakeProject(Project):
def __init__(self, url, md5, installed, configure_args=[],
**kwargs):
Project.__init__(self, url, md5, installed, **kwargs)
self.configure_args = configure_args
def configure(self, toolchain):
src = self.unpack(toolchain)
build = self.make_build_path(toolchain)
configure(toolchain, src, build, self.configure_args)
return build
def build(self, toolchain):
build = self.configure(toolchain)
subprocess.check_call(['ninja', 'install'],
cwd=build, env=toolchain.env)

View File

@ -4,6 +4,7 @@ from os.path import abspath
from build.project import Project from build.project import Project
from build.zlib import ZlibProject from build.zlib import ZlibProject
from build.meson import MesonProject from build.meson import MesonProject
from build.cmake import CmakeProject
from build.autotools import AutotoolsProject from build.autotools import AutotoolsProject
from build.ffmpeg import FfmpegProject from build.ffmpeg import FfmpegProject
from build.boost import BoostProject from build.boost import BoostProject
@ -111,9 +112,32 @@ liblame = AutotoolsProject(
], ],
) )
libmodplug = AutotoolsProject(
'https://downloads.sourceforge.net/modplug-xmms/libmodplug/0.8.9.0/libmodplug-0.8.9.0.tar.gz',
'457ca5a6c179656d66c01505c0d95fafaead4329b9dbaa0f997d00a3508ad9de',
'lib/libmodplug.a',
[
'--disable-shared', '--enable-static',
],
)
wildmidi = CmakeProject(
'https://codeload.github.com/Mindwerks/wildmidi/tar.gz/wildmidi-0.4.3',
'498e5a96455bb4b91b37188ad6dcb070824e92c44f5ed452b90adbaec8eef3c5',
'lib/libWildMidi.a',
[
'-DBUILD_SHARED_LIBS=OFF',
'-DWANT_PLAYER=OFF',
'-DWANT_STATIC=ON',
],
base='wildmidi-wildmidi-0.4.3',
name='wildmidi',
version='0.4.3',
)
ffmpeg = FfmpegProject( ffmpeg = FfmpegProject(
'http://ffmpeg.org/releases/ffmpeg-4.2.2.tar.xz', 'http://ffmpeg.org/releases/ffmpeg-4.2.3.tar.xz',
'cb754255ab0ee2ea5f66f8850e1bd6ad5cac1cd855d0a2f4990fb8c668b0d29c', '9df6c90aed1337634c1fb026fb01c154c29c82a64ea71291ff2da9aacb9aad31',
'lib/libavcodec.a', 'lib/libavcodec.a',
[ [
'--disable-shared', '--enable-static', '--disable-shared', '--enable-static',

View File

@ -27,6 +27,12 @@
#include "util/StringView.hxx" #include "util/StringView.hxx"
#include "Log.hxx" #include "Log.hxx"
#ifdef _WIN32
/* assume ModPlug is built as static library on Windows; without
this, linking to the static library would fail */
#define MODPLUG_STATIC
#endif
#include <libmodplug/modplug.h> #include <libmodplug/modplug.h>
#include <cassert> #include <cassert>

View File

@ -25,8 +25,15 @@
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx" #include "fs/FileSystem.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "PluginUnavailable.hxx" #include "PluginUnavailable.hxx"
#ifdef _WIN32
/* assume WildMidi is built as static library on Windows; without
this, linking to the static library would fail */
#define WILDMIDI_STATIC
#endif
extern "C" { extern "C" {
#include <wildmidi_lib.h> #include <wildmidi_lib.h>
} }
@ -52,7 +59,8 @@ wildmidi_init(const ConfigBlock &block)
AtScopeExit() { WildMidi_ClearError(); }; AtScopeExit() { WildMidi_ClearError(); };
#endif #endif
if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate, if (WildMidi_Init(NarrowPath(path),
wildmidi_audio_format.sample_rate,
0) != 0) { 0) != 0) {
#ifdef LIBWILDMIDI_VERSION #ifdef LIBWILDMIDI_VERSION
/* WildMidi_GetError() requires libwildmidi 0.4 */ /* WildMidi_GetError() requires libwildmidi 0.4 */
@ -95,7 +103,7 @@ wildmidi_file_decode(DecoderClient &client, Path path_fs)
midi *wm; midi *wm;
const struct _WM_Info *info; const struct _WM_Info *info;
wm = WildMidi_Open(path_fs.c_str()); wm = WildMidi_Open(NarrowPath(path_fs));
if (wm == nullptr) if (wm == nullptr)
return; return;
@ -135,7 +143,7 @@ wildmidi_file_decode(DecoderClient &client, Path path_fs)
static bool static bool
wildmidi_scan_file(Path path_fs, TagHandler &handler) noexcept wildmidi_scan_file(Path path_fs, TagHandler &handler) noexcept
{ {
midi *wm = WildMidi_Open(path_fs.c_str()); midi *wm = WildMidi_Open(NarrowPath(path_fs));
if (wm == nullptr) if (wm == nullptr)
return false; return false;

View File

@ -129,7 +129,16 @@ if wavpack_dep.found()
decoder_plugins_sources += 'WavpackDecoderPlugin.cxx' decoder_plugins_sources += 'WavpackDecoderPlugin.cxx'
endif endif
wildmidi_required = get_option('wildmidi')
if wildmidi_required.enabled()
# if the user has force-enabled WildMidi, allow the pkg-config test
# to fail; after that, the find_library() check must succeed
wildmidi_required = false
endif
wildmidi_dep = dependency('wildmidi', required: wildmidi_required)
if not wildmidi_dep.found()
wildmidi_dep = c_compiler.find_library('WildMidi', required: get_option('wildmidi')) wildmidi_dep = c_compiler.find_library('WildMidi', required: get_option('wildmidi'))
endif
decoder_features.set('ENABLE_WILDMIDI', wildmidi_dep.found()) decoder_features.set('ENABLE_WILDMIDI', wildmidi_dep.found())
if wildmidi_dep.found() if wildmidi_dep.found()
decoder_plugins_sources += 'WildmidiDecoderPlugin.cxx' decoder_plugins_sources += 'WildmidiDecoderPlugin.cxx'

View File

@ -45,7 +45,7 @@ FfmpegTimeToDouble(int64_t t, const AVRational time_base) noexcept
{ {
assert(t != (int64_t)AV_NOPTS_VALUE); assert(t != (int64_t)AV_NOPTS_VALUE);
return FloatDuration(av_rescale_q(t, time_base, (AVRational){1, 1024})) return FloatDuration(av_rescale_q(t, time_base, {1, 1024}))
/ 1024; / 1024;
} }
@ -69,7 +69,7 @@ FromFfmpegTime(int64_t t, const AVRational time_base) noexcept
assert(t != (int64_t)AV_NOPTS_VALUE); assert(t != (int64_t)AV_NOPTS_VALUE);
return SongTime::FromMS(av_rescale_q(t, time_base, return SongTime::FromMS(av_rescale_q(t, time_base,
(AVRational){1, 1000})); {1, 1000}));
} }
/** /**

View File

@ -96,6 +96,8 @@ thirdparty_libs = [
zlib, zlib,
libid3tag, libid3tag,
liblame, liblame,
libmodplug,
wildmidi,
ffmpeg, ffmpeg,
curl, curl,
libexpat, libexpat,