Merge branch 'v0.20.x'

This commit is contained in:
Max Kellermann 2018-01-05 10:10:17 +01:00
commit 4a120f8090
11 changed files with 150 additions and 48 deletions

View File

@ -291,30 +291,62 @@ libmain_a_CPPFLAGS = $(AM_CPPFLAGS) -Iandroid/build/include
src_mpd_LDADD += libandroid.a libjava.a src_mpd_LDADD += libandroid.a libjava.a
all-local: android/build/bin/$(APK_NAME)-debug.apk all-local: android/build/$(APK_NAME)-debug.apk
clean-local: clean-local:
rm -rf android/build rm -rf android/build
libmpd.so: $(filter %.a,$(src_mpd_LDADD)) libmain.a libmpd.so: $(filter %.a,$(src_mpd_LDADD)) libmain.a
$(AM_V_CXXLD)$(CXXLD) -shared -Wl,--no-undefined,-shared,-Bsymbolic -llog -lz -o $@ $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) src/libmain_a-Main.o $(src_mpd_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLD) -shared -Wl,--no-undefined,-shared,-Bsymbolic -llog -lz -o $@ $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) src/libmain_a-Main.o $(src_mpd_LDADD) $(LIBS)
android/build/build.xml: android/AndroidManifest.xml ANDROID_SDK_BUILD_TOOLS_VERSION = 20.0.0
rm -rf android/build ANDROID_SDK_PLATFORM = android-17
mkdir -p android/build/include android/build/res android/build/src/org
ln -s $(abs_srcdir)/android/AndroidManifest.xml $(abs_srcdir)/android/custom_rules.xml android/build
ln -s $(abs_srcdir)/android/src android/build/src/org/musicpd
ln -s $(abs_srcdir)/android/res/values $(abs_srcdir)/android/res/layout android/build/res
$(ANDROID_SDK)/tools/android update project --path android/build --target android-17 --name $(APK_NAME)
android/build/bin/classes/org/musicpd/Bridge.class: android/src/Bridge.java android/build/build.xml android/build/res/drawable/icon.png ANDROID_BUILD_TOOLS_DIR = $(ANDROID_SDK)/build-tools/$(ANDROID_SDK_BUILD_TOOLS_VERSION)
cd android/build && ant compile-jni-classes ANDROID_SDK_PLATFORM_DIR = $(ANDROID_SDK)/platforms/$(ANDROID_SDK_PLATFORM)
android/build/include/org_musicpd_Bridge.h: android/build/bin/classes/org/musicpd/Bridge.class JAVAC = javac
javah -classpath $(ANDROID_SDK)/platforms/android-17/android.jar:android/build/bin/classes -d $(@D) org.musicpd.Bridge AAPT = $(ANDROID_BUILD_TOOLS_DIR)/aapt
DX = $(ANDROID_BUILD_TOOLS_DIR)/dx
ZIPALIGN = $(ANDROID_BUILD_TOOLS_DIR)/zipalign
ANDROID_XML_RES := $(wildcard $(srcdir)/android/res/*/*.xml)
ANDROID_XML_RES_COPIES := $(patsubst $(srcdir)/android/%,android/build/%,$(ANDROID_XML_RES))
JAVA_SOURCE_NAMES = Bridge.java Loader.java Main.java
JAVA_SOURCES = $(addprefix $(srcdir)/android/src/,$(JAVA_SOURCE_NAMES))
JAVA_CLASSFILES_DIR = android/build/classes
$(ANDROID_XML_RES_COPIES): $(ANDROID_XML_RES)
@$(MKDIR_P) $(dir $@)
cp $(patsubst android/build/%,$(srcdir)/android/%,$@) $@
android/build/resources.apk: $(ANDROID_XML_RES_COPIES) android/build/res/drawable/icon.png
@$(MKDIR_P) android/build/gen
$(AAPT) package -f -m --auto-add-overlay \
--custom-package org.musicpd \
-M $(srcdir)/android/AndroidManifest.xml \
-S android/build/res \
-J android/build/gen \
-I $(ANDROID_SDK_PLATFORM_DIR)/android.jar \
-F android/build/resources.apk
# R.java is generated by aapt, when resources.apk is generated
android/build/gen/org/musicpd/R.java: android/build/resources.apk
android/build/classes.dex: $(JAVA_SOURCES) android/build/gen/org/musicpd/R.java
@$(MKDIR_P) $(JAVA_CLASSFILES_DIR)
$(JAVAC) -source 1.5 -target 1.5 -Xlint:-options \
-cp $(ANDROID_SDK_PLATFORM_DIR)/android.jar:$(JAVA_CLASSFILES_DIR) \
-d $(JAVA_CLASSFILES_DIR) $^
$(DX) --dex --output $@ $(JAVA_CLASSFILES_DIR)
android/build/include/org_musicpd_Bridge.h: android/build/classes.dex
javah -classpath $(ANDROID_SDK_PLATFORM_DIR)/android.jar:$(JAVA_CLASSFILES_DIR) -d $(@D) org.musicpd.Bridge
BUILT_SOURCES = android/build/include/org_musicpd_Bridge.h BUILT_SOURCES = android/build/include/org_musicpd_Bridge.h
android/build/libs/armeabi-v7a/libmpd.so: libmpd.so android/build/build.xml android/build/lib/armeabi-v7a/libmpd.so: libmpd.so
mkdir -p $(@D) mkdir -p $(@D)
rm -f $@ rm -f $@
$(STRIP) -o $@ $< $(STRIP) -o $@ $<
@ -323,24 +355,19 @@ android/build/res/drawable/icon.png: mpd.svg
mkdir -p $(@D) mkdir -p $(@D)
rsvg-convert --width=48 --height=48 $< -o $@ rsvg-convert --width=48 --height=48 $< -o $@
APK_DEPS = android/build/res/drawable/icon.png \ .DELETE_ON_ERROR: android/build/unsigned.apk
android/build/libs/armeabi-v7a/libmpd.so \ android/build/unsigned.apk: android/build/classes.dex android/build/resources.apk android/build/lib/armeabi-v7a/libmpd.so
$(wildcard $(srcdir)/android/src/*.java) \ cp android/build/resources.apk $@
android/build/build.xml cd $(dir $@) && zip -q -r $(notdir $@) classes.dex lib
android/build/bin/$(APK_NAME)-debug.apk: $(APK_DEPS) android/build/$(APK_NAME)-debug.apk: android/build/unsigned.apk
cd android/build && ant nodeps debug jarsigner -keystore $(HOME)/.android/debug.keystore -storepass android -signedjar $@ $< androiddebugkey
android/build/bin/$(APK_NAME)-release-unsigned.apk: $(APK_DEPS) android/build/$(APK_NAME)-release-unaligned.apk: android/build/unsigned.apk
cd android/build && ant nodeps release
android/build/bin/$(APK_NAME)-release-unaligned.apk: android/build/bin/$(APK_NAME)-release-unsigned.apk
jarsigner -digestalg SHA1 -sigalg MD5withRSA -storepass:env ANDROID_KEYSTORE_PASS -keystore $(ANDROID_KEYSTORE) -signedjar $@ $< $(ANDROID_KEY_ALIAS) jarsigner -digestalg SHA1 -sigalg MD5withRSA -storepass:env ANDROID_KEYSTORE_PASS -keystore $(ANDROID_KEYSTORE) -signedjar $@ $< $(ANDROID_KEY_ALIAS)
ANDROID_SDK_BUILD_TOOLS_VERSION = 20.0.0 android/build/$(APK_NAME).apk: android/build/$(APK_NAME)-release-unaligned.apk
$(ZIPALIGN) -f 4 $< $@
android/build/bin/$(APK_NAME).apk: android/build/bin/$(APK_NAME)-release-unaligned.apk
$(ANDROID_SDK)/build-tools/$(ANDROID_SDK_BUILD_TOOLS_VERSION)/zipalign -f 4 $< $@
endif endif

5
NEWS
View File

@ -23,9 +23,14 @@ ver 0.21 (not yet released)
* require GCC 5.0 * require GCC 5.0
ver 0.20.15 (not yet released) ver 0.20.15 (not yet released)
* resampler
- soxr: clear internal state after manual song change
* state file * state file
- make mount point restore errors non-fatal - make mount point restore errors non-fatal
- fix crash when restoring mounts with incompatible database plugin - fix crash when restoring mounts with incompatible database plugin
* Android
- build without Ant
- fix for SIGSYS crash
ver 0.20.14 (2018/01/01) ver 0.20.14 (2018/01/01)
* database * database

View File

@ -73,6 +73,8 @@ class AndroidNdkToolchain:
self.cxx = os.path.join(llvm_bin, 'clang++') self.cxx = os.path.join(llvm_bin, 'clang++')
common_flags += ' -target ' + llvm_triple + ' -integrated-as -gcc-toolchain ' + toolchain_path common_flags += ' -target ' + llvm_triple + ' -integrated-as -gcc-toolchain ' + toolchain_path
common_flags += ' -fvisibility=hidden -fdata-sections -ffunction-sections'
self.ar = os.path.join(toolchain_bin, arch + '-ar') self.ar = os.path.join(toolchain_bin, arch + '-ar')
self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib') self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib')
self.nm = os.path.join(toolchain_bin, arch + '-nm') self.nm = os.path.join(toolchain_bin, arch + '-nm')

View File

@ -1,21 +1,28 @@
import os.path, subprocess import os.path, subprocess, sys
from build.project import Project from build.makeproject import MakeProject
class AutotoolsProject(Project): class AutotoolsProject(MakeProject):
def __init__(self, url, md5, installed, configure_args=[], def __init__(self, url, md5, installed, configure_args=[],
autogen=False, autogen=False,
cppflags='', cppflags='',
ldflags='',
libs='',
**kwargs): **kwargs):
Project.__init__(self, url, md5, installed, **kwargs) MakeProject.__init__(self, url, md5, installed, **kwargs)
self.configure_args = configure_args self.configure_args = configure_args
self.autogen = autogen self.autogen = autogen
self.cppflags = cppflags self.cppflags = cppflags
self.ldflags = ldflags
self.libs = libs
def build(self, toolchain): def configure(self, toolchain):
src = self.unpack(toolchain) src = self.unpack(toolchain)
if self.autogen: if self.autogen:
subprocess.check_call(['libtoolize', '--force'], cwd=src) if sys.platform == 'darwin':
subprocess.check_call(['glibtoolize', '--force'], cwd=src)
else:
subprocess.check_call(['libtoolize', '--force'], cwd=src)
subprocess.check_call(['aclocal'], cwd=src) subprocess.check_call(['aclocal'], cwd=src)
subprocess.check_call(['automake', '--add-missing', '--force-missing', '--foreign'], cwd=src) subprocess.check_call(['automake', '--add-missing', '--force-missing', '--foreign'], cwd=src)
subprocess.check_call(['autoconf'], cwd=src) subprocess.check_call(['autoconf'], cwd=src)
@ -29,8 +36,8 @@ class AutotoolsProject(Project):
'CFLAGS=' + toolchain.cflags, 'CFLAGS=' + toolchain.cflags,
'CXXFLAGS=' + toolchain.cxxflags, 'CXXFLAGS=' + toolchain.cxxflags,
'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags, 'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags,
'LDFLAGS=' + toolchain.ldflags, 'LDFLAGS=' + toolchain.ldflags + ' ' + self.ldflags,
'LIBS=' + toolchain.libs, 'LIBS=' + toolchain.libs + ' ' + self.libs,
'AR=' + toolchain.ar, 'AR=' + toolchain.ar,
'RANLIB=' + toolchain.ranlib, 'RANLIB=' + toolchain.ranlib,
'STRIP=' + toolchain.strip, 'STRIP=' + toolchain.strip,
@ -40,7 +47,8 @@ class AutotoolsProject(Project):
] + self.configure_args ] + self.configure_args
subprocess.check_call(configure, cwd=build, env=toolchain.env) subprocess.check_call(configure, cwd=build, env=toolchain.env)
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], return build
cwd=build, env=toolchain.env)
subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], def build(self, toolchain):
cwd=build, env=toolchain.env) build = self.configure(toolchain)
MakeProject.build(self, toolchain, build)

View File

@ -8,21 +8,27 @@ libogg = AutotoolsProject(
'http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz', 'http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz',
'5c3a34309d8b98640827e5d0991a4015', '5c3a34309d8b98640827e5d0991a4015',
'lib/libogg.a', 'lib/libogg.a',
['--disable-shared', '--enable-static'], [
'--disable-shared', '--enable-static',
],
) )
libvorbis = AutotoolsProject( libvorbis = AutotoolsProject(
'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz', 'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz',
'28cb28097c07a735d6af56e598e1c90f', '28cb28097c07a735d6af56e598e1c90f',
'lib/libvorbis.a', 'lib/libvorbis.a',
['--disable-shared', '--enable-static'], [
'--disable-shared', '--enable-static',
],
) )
opus = AutotoolsProject( opus = AutotoolsProject(
'https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz', 'https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz',
'cfafd339ccd9c5ef8d6ab15d7e1a412c054bf4cb4ecbbbcc78c12ef2def70732', 'cfafd339ccd9c5ef8d6ab15d7e1a412c054bf4cb4ecbbbcc78c12ef2def70732',
'lib/libopus.a', 'lib/libopus.a',
['--disable-shared', '--enable-static'], [
'--disable-shared', '--enable-static',
],
) )
flac = AutotoolsProject( flac = AutotoolsProject(
@ -45,7 +51,12 @@ libid3tag = AutotoolsProject(
'ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz', 'ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz',
'e5808ad997ba32c498803822078748c3', 'e5808ad997ba32c498803822078748c3',
'lib/libid3tag.a', 'lib/libid3tag.a',
['--disable-shared', '--enable-static'], [
'--disable-shared', '--enable-static',
# without this, libid3tag's configure.ac ignores -O* and -f*
'--disable-debugging',
],
autogen=True, autogen=True,
) )
@ -53,7 +64,12 @@ libmad = AutotoolsProject(
'ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz', 'ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz',
'1be543bc30c56fb6bea1d7bf6a64e66c', '1be543bc30c56fb6bea1d7bf6a64e66c',
'lib/libmad.a', 'lib/libmad.a',
['--disable-shared', '--enable-static'], [
'--disable-shared', '--enable-static',
# without this, libmad's configure.ac ignores -O* and -f*
'--disable-debugging',
],
autogen=True, autogen=True,
) )
@ -123,7 +139,7 @@ curl = AutotoolsProject(
) )
boost = BoostProject( boost = BoostProject(
'http://downloads.sourceforge.net/project/boost/boost/1.65.1/boost_1_65_1.tar.bz2', 'http://downloads.sourceforge.net/project/boost/boost/1.66.0/boost_1_66_0.tar.bz2',
'9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81', '5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9',
'include/boost/version.hpp', 'include/boost/version.hpp',
) )

View File

@ -0,0 +1,28 @@
import subprocess
from build.project import Project
class MakeProject(Project):
def __init__(self, url, md5, installed,
install_target='install',
**kwargs):
Project.__init__(self, url, md5, installed, **kwargs)
self.install_target = install_target
def get_simultaneous_jobs(self):
return 12
def get_make_args(self, toolchain):
return ['--quiet', '-j' + str(self.get_simultaneous_jobs())]
def get_make_install_args(self, toolchain):
return ['--quiet', self.install_target]
def make(self, toolchain, wd, args):
subprocess.check_call(['/usr/bin/make'] + args,
cwd=wd, env=toolchain.env)
def build(self, toolchain, wd, install=True):
self.make(toolchain, wd, self.get_make_args(toolchain))
if install:
self.make(toolchain, wd, self.get_make_install_args(toolchain))

View File

@ -72,6 +72,10 @@ public:
return filter.get(); return filter.get();
} }
void Reset() noexcept override {
filter->Reset();
}
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override { ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override {
return filter->FilterPCM(src); return filter->FilterPCM(src);
} }

View File

@ -76,7 +76,6 @@ private:
void Close() noexcept override; void Close() noexcept override;
size_t Play(const void *chunk, size_t size) override; size_t Play(const void *chunk, size_t size) override;
void Cancel() noexcept override;
std::chrono::steady_clock::duration Delay() const noexcept override; std::chrono::steady_clock::duration Delay() const noexcept override;

View File

@ -139,6 +139,14 @@ SoxrPcmResampler::Close() noexcept
soxr_delete(soxr); soxr_delete(soxr);
} }
void
SoxrPcmResampler::Reset() noexcept
{
#if SOXR_THIS_VERSION >= SOXR_VERSION(0,1,2)
soxr_clear(soxr);
#endif
}
ConstBuffer<void> ConstBuffer<void>
SoxrPcmResampler::Resample(ConstBuffer<void> src) SoxrPcmResampler::Resample(ConstBuffer<void> src)
{ {

View File

@ -41,6 +41,7 @@ class SoxrPcmResampler final : public PcmResampler {
public: public:
AudioFormat Open(AudioFormat &af, unsigned new_sample_rate) override; AudioFormat Open(AudioFormat &af, unsigned new_sample_rate) override;
void Close() noexcept override; void Close() noexcept override;
void Reset() noexcept override;
ConstBuffer<void> Resample(ConstBuffer<void> src) override; ConstBuffer<void> Resample(ConstBuffer<void> src) override;
ConstBuffer<void> Flush() override; ConstBuffer<void> Flush() override;
}; };

View File

@ -38,7 +38,7 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef __linux__ #if defined(__linux__) && !defined(ANDROID)
static int static int
ioprio_set(int which, int who, int ioprio) noexcept ioprio_set(int which, int who, int ioprio) noexcept
@ -69,7 +69,11 @@ SetThreadIdlePriority() noexcept
sched_setscheduler(0, SCHED_IDLE, &sched_param); sched_setscheduler(0, SCHED_IDLE, &sched_param);
#endif #endif
#ifndef ANDROID
/* this system call is forbidden via seccomp on Android 8 and
leads to crash (SIGSYS) */
ioprio_set_idle(); ioprio_set_idle();
#endif
#elif defined(_WIN32) #elif defined(_WIN32)
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);