From c68ed40661f8077557748b6a00fa40d10bd19f74 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 2 Jan 2018 19:07:45 +0100 Subject: [PATCH 01/14] pcm/SoxrResampler: implement method Reset() --- NEWS | 2 ++ src/pcm/SoxrResampler.cxx | 8 ++++++++ src/pcm/SoxrResampler.hxx | 1 + 3 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 7107eeb31..3788d63a5 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ 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 diff --git a/src/pcm/SoxrResampler.cxx b/src/pcm/SoxrResampler.cxx index 621d3f970..868ad59fd 100644 --- a/src/pcm/SoxrResampler.cxx +++ b/src/pcm/SoxrResampler.cxx @@ -139,6 +139,14 @@ SoxrPcmResampler::Close() soxr_delete(soxr); } +void +SoxrPcmResampler::Reset() +{ +#if SOXR_THIS_VERSION >= SOXR_VERSION(0,1,2) + soxr_clear(soxr); +#endif +} + ConstBuffer SoxrPcmResampler::Resample(ConstBuffer src) { diff --git a/src/pcm/SoxrResampler.hxx b/src/pcm/SoxrResampler.hxx index 0be861179..9f3114a47 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() override; + void Reset() override; ConstBuffer Resample(ConstBuffer src) override; }; From 17b0add058991ee0be763d88e3673e890f8143bf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 2 Jan 2018 22:13:14 +0100 Subject: [PATCH 02/14] filter/Observer: pass Reset() to underlying Filter Wohooooo, the method Filter::Reset() has been broken because no implementation of it has ever been called for a loooong time. And nobody ever noticed it. WTF. --- src/filter/Observer.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/filter/Observer.cxx b/src/filter/Observer.cxx index 5d6602d46..d7835a7ed 100644 --- a/src/filter/Observer.cxx +++ b/src/filter/Observer.cxx @@ -73,6 +73,10 @@ public: return filter; } + void Reset() override { + filter->Reset(); + } + ConstBuffer FilterPCM(ConstBuffer src) override { return filter->FilterPCM(src); } From 414f00d6ae446a2e6f0bb28d68f6762ed2931934 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Jan 2018 18:47:52 +0100 Subject: [PATCH 03/14] Makefile.am: add variable ANDROID_SDK_PLATFORM --- Makefile.am | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 396bc0c37..316df7db5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -292,19 +292,22 @@ clean-local: 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_SDK_PLATFORM = android-17 +ANDROID_SDK_PLATFORM_DIR = $(ANDROID_SDK)/platforms/$(ANDROID_SDK_PLATFORM) + 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)/tools/android update project --path android/build --target $(ANDROID_SDK_PLATFORM) --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 cd android/build && ant compile-jni-classes 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 + javah -classpath $(ANDROID_SDK_PLATFORM_DIR)/android.jar:android/build/bin/classes -d $(@D) org.musicpd.Bridge BUILT_SOURCES = android/build/include/org_musicpd_Bridge.h From 85d0bbd9577f37c6d42be48ca2976439ef4fe920 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Jan 2018 18:55:45 +0100 Subject: [PATCH 04/14] Makefile.am: add variable ZIPALIGN --- Makefile.am | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 316df7db5..592e75a77 100644 --- a/Makefile.am +++ b/Makefile.am @@ -292,9 +292,14 @@ clean-local: 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_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) +ZIPALIGN = $(ANDROID_BUILD_TOOLS_DIR)/zipalign + android/build/build.xml: android/AndroidManifest.xml rm -rf android/build mkdir -p android/build/include android/build/res android/build/src/org @@ -334,10 +339,8 @@ android/build/bin/$(APK_NAME)-release-unsigned.apk: $(APK_DEPS) 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) -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 $< $@ + $(ZIPALIGN) -f 4 $< $@ endif From fbdb8b406e79d282ed0c5b7fde723fcfbde43d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=A4dicke?= Date: Thu, 20 Jul 2017 01:05:59 +0200 Subject: [PATCH 05/14] Makefile.am: build Android APK package without Ant In current Android SDK releases, Ant support was removed. Move the necessary build steps from the former Ant build system to our Makefile, and call the required build tools from the Android SDK (aapt and dx), Java SDK (javac) and Info-ZIP (zip) directly. [mk: copied from Felix's commit e52b906dba971a1173f9e8f83d32b52ee9f89af3 in the XCSoar project) --- Makefile.am | 69 ++++++++++++++++++++++++++++++++++------------------- NEWS | 2 ++ 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index 592e75a77..c0ccec411 100644 --- a/Makefile.am +++ b/Makefile.am @@ -285,7 +285,7 @@ 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 @@ -298,25 +298,49 @@ 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/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_SDK_PLATFORM) --name $(APK_NAME) +ANDROID_XML_RES := $(wildcard $(srcdir)/android/res/*/*.xml) +ANDROID_XML_RES_COPIES := $(patsubst $(srcdir)/android/%,android/build/%,$(ANDROID_XML_RES)) -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 +JAVA_SOURCE_NAMES = Bridge.java Loader.java Main.java +JAVA_SOURCES = $(addprefix $(srcdir)/android/src/,$(JAVA_SOURCE_NAMES)) -android/build/include/org_musicpd_Bridge.h: android/build/bin/classes/org/musicpd/Bridge.class - javah -classpath $(ANDROID_SDK_PLATFORM_DIR)/android.jar:android/build/bin/classes -d $(@D) org.musicpd.Bridge +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 -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 $@ $< @@ -325,21 +349,18 @@ 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/build/bin/$(APK_NAME).apk: android/build/bin/$(APK_NAME)-release-unaligned.apk +android/build/$(APK_NAME).apk: android/build/$(APK_NAME)-release-unaligned.apk $(ZIPALIGN) -f 4 $< $@ endif diff --git a/NEWS b/NEWS index 3788d63a5..a6532fe62 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ ver 0.20.15 (not yet released) * state file - make mount point restore errors non-fatal - fix crash when restoring mounts with incompatible database plugin +* Android + - build without Ant ver 0.20.14 (2018/01/01) * database From 329f9cd9fe4d41afa2986dbf358339b7a48d044b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Jan 2018 19:19:16 +0100 Subject: [PATCH 06/14] thread/Util: no ioprio_set() on Android due to seccomp/SIGSYS --- NEWS | 1 + src/thread/Util.cxx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a6532fe62..e87043daa 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ ver 0.20.15 (not yet released) - 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/src/thread/Util.cxx b/src/thread/Util.cxx index 6213d9777..c4c93f82e 100644 --- a/src/thread/Util.cxx +++ b/src/thread/Util.cxx @@ -38,7 +38,7 @@ #include #endif -#ifdef __linux__ +#if defined(__linux__) && !defined(ANDROID) static int ioprio_set(int which, int who, int ioprio) @@ -69,7 +69,11 @@ SetThreadIdlePriority() 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); From 5724656acb2058c6adb6bd4040fb0867576c6353 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Jan 2018 23:33:07 +0100 Subject: [PATCH 07/14] android/build.py: enable function/data sections in static libraries .. and make all library symbols hidden by default. Saves big amounts of .text section size with --gc-sections, because only this allows discarding unused functions from those (static) third-party libraries. --- android/build.py | 2 ++ 1 file changed, 2 insertions(+) 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') From a60dee57ce5dcdb288ac469e951aca231ea358d9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Jan 2018 07:16:38 +0100 Subject: [PATCH 08/14] python/libs: upgrade Boost to 1.66.0 --- python/build/libs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/build/libs.py b/python/build/libs.py index 5acabf695..a5cc689e9 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -123,7 +123,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', ) From 4183416b3ec30978b991f8380ead48fb02db4ba3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Jan 2018 07:27:09 +0100 Subject: [PATCH 09/14] python/build/libs.py: reindent arrays --- python/build/libs.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/python/build/libs.py b/python/build/libs.py index a5cc689e9..605b04f5d 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,9 @@ 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', + ], autogen=True, ) @@ -53,7 +61,9 @@ 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', + ], autogen=True, ) From 7b56bae289dd82bb24f597f8f98037bb8f3fbaf9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Jan 2018 07:30:09 +0100 Subject: [PATCH 10/14] python/build/libs.py: pass --disable-debugging to libid3tag and libmad --- python/build/libs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/build/libs.py b/python/build/libs.py index 605b04f5d..8653ddb4c 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -53,6 +53,9 @@ libid3tag = AutotoolsProject( 'lib/libid3tag.a', [ '--disable-shared', '--enable-static', + + # without this, libid3tag's configure.ac ignores -O* and -f* + '--disable-debugging', ], autogen=True, ) @@ -63,6 +66,9 @@ libmad = AutotoolsProject( 'lib/libmad.a', [ '--disable-shared', '--enable-static', + + # without this, libmad's configure.ac ignores -O* and -f* + '--disable-debugging', ], autogen=True, ) From 4303aaa9b8430ab0fa3f58e8b9f5d1cf7b115473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=A4dicke?= Date: Mon, 30 Nov 2015 23:47:28 +0100 Subject: [PATCH 11/14] build/python: use "glibtoolize", not "libtoolize" when compiling on OS X On OS X, the "libtoolize" command is some Apple tool. The libtoolize we want is named "glibtoolize" in Homebrew. --- python/build/autotools.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/build/autotools.py b/python/build/autotools.py index d9a1f156b..55a5fc067 100644 --- a/python/build/autotools.py +++ b/python/build/autotools.py @@ -1,4 +1,4 @@ -import os.path, subprocess +import os.path, subprocess, sys from build.project import Project @@ -15,7 +15,10 @@ class AutotoolsProject(Project): def build(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) From 1ca70d97596937ae8b14719de191ce1a7790e11c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Jan 2018 07:56:49 +0100 Subject: [PATCH 12/14] build/python/autotools: add properties "ldflags", "libs", "install_target" --- python/build/autotools.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/python/build/autotools.py b/python/build/autotools.py index 55a5fc067..c3e179f85 100644 --- a/python/build/autotools.py +++ b/python/build/autotools.py @@ -6,11 +6,17 @@ class AutotoolsProject(Project): def __init__(self, url, md5, installed, configure_args=[], autogen=False, cppflags='', + ldflags='', + libs='', + install_target='install', **kwargs): Project.__init__(self, url, md5, installed, **kwargs) self.configure_args = configure_args self.autogen = autogen self.cppflags = cppflags + self.ldflags = ldflags + self.libs = libs + self.install_target = install_target def build(self, toolchain): src = self.unpack(toolchain) @@ -32,8 +38,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, @@ -45,5 +51,5 @@ class AutotoolsProject(Project): 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'], + subprocess.check_call(['/usr/bin/make', '--quiet', self.install_target], cwd=build, env=toolchain.env) From 8217d75ca159db470846e28e9215fe08a61bc7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=A4dicke?= Date: Fri, 6 Oct 2017 23:06:28 +0200 Subject: [PATCH 13/14] build/python: refactoring: introduce new class MakeProject This introduces a the new class MakeProject, which is used as a base class for all Makefile based thirdparty libraries. --- python/build/autotools.py | 19 +++++++++---------- python/build/makeproject.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 python/build/makeproject.py diff --git a/python/build/autotools.py b/python/build/autotools.py index c3e179f85..56af64cce 100644 --- a/python/build/autotools.py +++ b/python/build/autotools.py @@ -1,24 +1,22 @@ 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='', - install_target='install', **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 - self.install_target = install_target - def build(self, toolchain): + def configure(self, toolchain): src = self.unpack(toolchain) if self.autogen: if sys.platform == 'darwin': @@ -49,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', self.install_target], - 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/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)) From c2cbb7b8cecca575ce09aeb04fd1436d44cf9519 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Jan 2018 10:05:14 +0100 Subject: [PATCH 14/14] output/haiku: remove unimplemented Cancel() method --- src/output/plugins/HaikuOutputPlugin.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/output/plugins/HaikuOutputPlugin.cxx b/src/output/plugins/HaikuOutputPlugin.cxx index 732a90900..2487ace16 100644 --- a/src/output/plugins/HaikuOutputPlugin.cxx +++ b/src/output/plugins/HaikuOutputPlugin.cxx @@ -77,7 +77,6 @@ public: void Close(); size_t Play(const void *chunk, size_t size); - void Cancel(); std::chrono::steady_clock::duration Delay() noexcept;