diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-05 10:10:17 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-05 10:10:17 +0100 |
commit | 4a120f80902efcab53ebabbc03266ba3487374fd (patch) | |
tree | f1db5632e79adb13c3f9e3c9cc45092bc6cedb6d | |
parent | 79b0f97a3fb064b2849b4c6870444a66b1e6e886 (diff) | |
parent | c2cbb7b8cecca575ce09aeb04fd1436d44cf9519 (diff) |
Merge branch 'v0.20.x'
-rw-r--r-- | Makefile.am | 81 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rwxr-xr-x | android/build.py | 2 | ||||
-rw-r--r-- | python/build/autotools.py | 32 | ||||
-rw-r--r-- | python/build/libs.py | 30 | ||||
-rw-r--r-- | python/build/makeproject.py | 28 | ||||
-rw-r--r-- | src/filter/Observer.cxx | 4 | ||||
-rw-r--r-- | src/output/plugins/HaikuOutputPlugin.cxx | 1 | ||||
-rw-r--r-- | src/pcm/SoxrResampler.cxx | 8 | ||||
-rw-r--r-- | src/pcm/SoxrResampler.hxx | 1 | ||||
-rw-r--r-- | src/thread/Util.cxx | 6 |
11 files changed, 150 insertions, 48 deletions
diff --git a/Makefile.am b/Makefile.am index 15c829861..dc7d64f6b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -291,30 +291,62 @@ libmain_a_CPPFLAGS = $(AM_CPPFLAGS) -Iandroid/build/include 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: rm -rf android/build 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) -android/build/build.xml: android/AndroidManifest.xml - rm -rf android/build - 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_SDK_BUILD_TOOLS_VERSION = 20.0.0 +ANDROID_SDK_PLATFORM = android-17 + +ANDROID_BUILD_TOOLS_DIR = $(ANDROID_SDK)/build-tools/$(ANDROID_SDK_BUILD_TOOLS_VERSION) +ANDROID_SDK_PLATFORM_DIR = $(ANDROID_SDK)/platforms/$(ANDROID_SDK_PLATFORM) + +JAVAC = javac +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/build/bin/classes/org/musicpd/Bridge.class: android/src/Bridge.java android/build/build.xml android/build/res/drawable/icon.png - cd android/build && ant compile-jni-classes +$(ANDROID_XML_RES_COPIES): $(ANDROID_XML_RES) + @$(MKDIR_P) $(dir $@) + cp $(patsubst android/build/%,$(srcdir)/android/%,$@) $@ -android/build/include/org_musicpd_Bridge.h: android/build/bin/classes/org/musicpd/Bridge.class - javah -classpath $(ANDROID_SDK)/platforms/android-17/android.jar:android/build/bin/classes -d $(@D) org.musicpd.Bridge +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 -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) rm -f $@ $(STRIP) -o $@ $< @@ -323,24 +355,19 @@ android/build/res/drawable/icon.png: mpd.svg mkdir -p $(@D) rsvg-convert --width=48 --height=48 $< -o $@ -APK_DEPS = android/build/res/drawable/icon.png \ - android/build/libs/armeabi-v7a/libmpd.so \ - $(wildcard $(srcdir)/android/src/*.java) \ - android/build/build.xml +.DELETE_ON_ERROR: android/build/unsigned.apk +android/build/unsigned.apk: android/build/classes.dex android/build/resources.apk android/build/lib/armeabi-v7a/libmpd.so + cp android/build/resources.apk $@ + cd $(dir $@) && zip -q -r $(notdir $@) classes.dex lib -android/build/bin/$(APK_NAME)-debug.apk: $(APK_DEPS) - cd android/build && ant nodeps debug +android/build/$(APK_NAME)-debug.apk: android/build/unsigned.apk + jarsigner -keystore $(HOME)/.android/debug.keystore -storepass android -signedjar $@ $< androiddebugkey -android/build/bin/$(APK_NAME)-release-unsigned.apk: $(APK_DEPS) - cd android/build && ant nodeps release - -android/build/bin/$(APK_NAME)-release-unaligned.apk: android/build/bin/$(APK_NAME)-release-unsigned.apk +android/build/$(APK_NAME)-release-unaligned.apk: android/build/unsigned.apk 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/bin/$(APK_NAME).apk: android/build/bin/$(APK_NAME)-release-unaligned.apk - $(ANDROID_SDK)/build-tools/$(ANDROID_SDK_BUILD_TOOLS_VERSION)/zipalign -f 4 $< $@ +android/build/$(APK_NAME).apk: android/build/$(APK_NAME)-release-unaligned.apk + $(ZIPALIGN) -f 4 $< $@ endif @@ -23,9 +23,14 @@ ver 0.21 (not yet released) * require GCC 5.0 ver 0.20.15 (not yet released) +* resampler + - soxr: clear internal state after manual song change * state file - make mount point restore errors non-fatal - fix crash when restoring mounts with incompatible database plugin +* Android + - build without Ant + - fix for SIGSYS crash ver 0.20.14 (2018/01/01) * database diff --git a/android/build.py b/android/build.py index fab6ecb49..edabccf01 100755 --- a/android/build.py +++ b/android/build.py @@ -73,6 +73,8 @@ class AndroidNdkToolchain: self.cxx = os.path.join(llvm_bin, 'clang++') 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.ranlib = os.path.join(toolchain_bin, arch + '-ranlib') self.nm = os.path.join(toolchain_bin, arch + '-nm') diff --git a/python/build/autotools.py b/python/build/autotools.py index d9a1f156b..56af64cce 100644 --- a/python/build/autotools.py +++ b/python/build/autotools.py @@ -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=[], autogen=False, cppflags='', + ldflags='', + libs='', **kwargs): - Project.__init__(self, url, md5, installed, **kwargs) + MakeProject.__init__(self, url, md5, installed, **kwargs) self.configure_args = configure_args self.autogen = autogen self.cppflags = cppflags + self.ldflags = ldflags + self.libs = libs - def build(self, toolchain): + def configure(self, toolchain): src = self.unpack(toolchain) 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(['automake', '--add-missing', '--force-missing', '--foreign'], cwd=src) subprocess.check_call(['autoconf'], cwd=src) @@ -29,8 +36,8 @@ class AutotoolsProject(Project): 'CFLAGS=' + toolchain.cflags, 'CXXFLAGS=' + toolchain.cxxflags, 'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags, - 'LDFLAGS=' + toolchain.ldflags, - 'LIBS=' + toolchain.libs, + 'LDFLAGS=' + toolchain.ldflags + ' ' + self.ldflags, + 'LIBS=' + toolchain.libs + ' ' + self.libs, 'AR=' + toolchain.ar, 'RANLIB=' + toolchain.ranlib, 'STRIP=' + toolchain.strip, @@ -40,7 +47,8 @@ class AutotoolsProject(Project): ] + self.configure_args subprocess.check_call(configure, cwd=build, env=toolchain.env) - subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], - cwd=build, env=toolchain.env) - subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], - cwd=build, env=toolchain.env) + return build + + def build(self, toolchain): + build = self.configure(toolchain) + MakeProject.build(self, toolchain, build) diff --git a/python/build/libs.py b/python/build/libs.py index 5acabf695..8653ddb4c 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -8,21 +8,27 @@ libogg = AutotoolsProject( 'http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz', '5c3a34309d8b98640827e5d0991a4015', 'lib/libogg.a', - ['--disable-shared', '--enable-static'], + [ + '--disable-shared', '--enable-static', + ], ) libvorbis = AutotoolsProject( 'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz', '28cb28097c07a735d6af56e598e1c90f', 'lib/libvorbis.a', - ['--disable-shared', '--enable-static'], + [ + '--disable-shared', '--enable-static', + ], ) opus = AutotoolsProject( 'https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz', 'cfafd339ccd9c5ef8d6ab15d7e1a412c054bf4cb4ecbbbcc78c12ef2def70732', 'lib/libopus.a', - ['--disable-shared', '--enable-static'], + [ + '--disable-shared', '--enable-static', + ], ) flac = AutotoolsProject( @@ -45,7 +51,12 @@ libid3tag = AutotoolsProject( 'ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz', 'e5808ad997ba32c498803822078748c3', '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, ) @@ -53,7 +64,12 @@ libmad = AutotoolsProject( 'ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz', '1be543bc30c56fb6bea1d7bf6a64e66c', '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, ) @@ -123,7 +139,7 @@ curl = AutotoolsProject( ) boost = BoostProject( - 'http://downloads.sourceforge.net/project/boost/boost/1.65.1/boost_1_65_1.tar.bz2', - '9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81', + 'http://downloads.sourceforge.net/project/boost/boost/1.66.0/boost_1_66_0.tar.bz2', + '5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9', 'include/boost/version.hpp', ) diff --git a/python/build/makeproject.py b/python/build/makeproject.py new file mode 100644 index 000000000..fe676bfa4 --- /dev/null +++ b/python/build/makeproject.py @@ -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)) diff --git a/src/filter/Observer.cxx b/src/filter/Observer.cxx index a56efc70f..a5ae69eac 100644 --- a/src/filter/Observer.cxx +++ b/src/filter/Observer.cxx @@ -72,6 +72,10 @@ public: return filter.get(); } + void Reset() noexcept override { + filter->Reset(); + } + ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override { return filter->FilterPCM(src); } diff --git a/src/output/plugins/HaikuOutputPlugin.cxx b/src/output/plugins/HaikuOutputPlugin.cxx index 9c423fbd3..2a604b9a1 100644 --- a/src/output/plugins/HaikuOutputPlugin.cxx +++ b/src/output/plugins/HaikuOutputPlugin.cxx @@ -76,7 +76,6 @@ private: void Close() noexcept override; size_t Play(const void *chunk, size_t size) override; - void Cancel() noexcept override; std::chrono::steady_clock::duration Delay() const noexcept override; diff --git a/src/pcm/SoxrResampler.cxx b/src/pcm/SoxrResampler.cxx index 6dc80f416..90a7d58a5 100644 --- a/src/pcm/SoxrResampler.cxx +++ b/src/pcm/SoxrResampler.cxx @@ -139,6 +139,14 @@ SoxrPcmResampler::Close() noexcept soxr_delete(soxr); } +void +SoxrPcmResampler::Reset() noexcept +{ +#if SOXR_THIS_VERSION >= SOXR_VERSION(0,1,2) + soxr_clear(soxr); +#endif +} + ConstBuffer<void> SoxrPcmResampler::Resample(ConstBuffer<void> src) { diff --git a/src/pcm/SoxrResampler.hxx b/src/pcm/SoxrResampler.hxx index 8df36c959..735a24a85 100644 --- a/src/pcm/SoxrResampler.hxx +++ b/src/pcm/SoxrResampler.hxx @@ -41,6 +41,7 @@ class SoxrPcmResampler final : public PcmResampler { public: AudioFormat Open(AudioFormat &af, unsigned new_sample_rate) override; void Close() noexcept override; + void Reset() noexcept override; ConstBuffer<void> Resample(ConstBuffer<void> src) override; ConstBuffer<void> Flush() override; }; diff --git a/src/thread/Util.cxx b/src/thread/Util.cxx index b336467bd..d50d507e1 100644 --- a/src/thread/Util.cxx +++ b/src/thread/Util.cxx @@ -38,7 +38,7 @@ #include <windows.h> #endif -#ifdef __linux__ +#if defined(__linux__) && !defined(ANDROID) static int ioprio_set(int which, int who, int ioprio) noexcept @@ -69,7 +69,11 @@ SetThreadIdlePriority() noexcept sched_setscheduler(0, SCHED_IDLE, &sched_param); #endif +#ifndef ANDROID + /* this system call is forbidden via seccomp on Android 8 and + leads to crash (SIGSYS) */ ioprio_set_idle(); +#endif #elif defined(_WIN32) SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); |