diff options
author | Max Kellermann <max@musicpd.org> | 2018-03-05 11:13:42 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-03-05 11:13:42 +0100 |
commit | 5b0e8c6de0b73d8e8812cbf4588862fed2a2af42 (patch) | |
tree | f6791e79ebaa7c534ae812abdcbdb9946e56daa8 | |
parent | 67274c018d1872a24a54c1d0c9753b629833a8f5 (diff) | |
parent | 8266ab5588ccca25b0b8b09e970736898159e73f (diff) |
Merge branch 'v0.20.x'
-rw-r--r-- | NEWS | 5 | ||||
-rwxr-xr-x | android/build.py | 41 | ||||
-rw-r--r-- | doc/user.xml | 53 | ||||
-rw-r--r-- | python/build/libs.py | 5 | ||||
-rw-r--r-- | src/Main.cxx | 19 | ||||
-rw-r--r-- | src/protocol/ArgParser.cxx | 4 |
6 files changed, 98 insertions, 29 deletions
@@ -31,6 +31,11 @@ ver 0.21 (not yet released) - opus: support for sending metadata using ogg stream chaining * require GCC 5.0 +ver 0.20.19 (not yet released) +* protocol + - validate absolute seek time, reject negative values +* macOS: fix crash bug + ver 0.20.18 (2018/02/24) * input - curl: allow authentication methods other than "Basic" diff --git a/android/build.py b/android/build.py index 4c4f77ae7..19dcbaee7 100755 --- a/android/build.py +++ b/android/build.py @@ -3,13 +3,14 @@ import os, os.path import sys, subprocess -if len(sys.argv) < 3: - print("Usage: build.py SDK_PATH NDK_PATH [configure_args...]", file=sys.stderr) +if len(sys.argv) < 4: + print("Usage: build.py SDK_PATH NDK_PATH ABI [configure_args...]", file=sys.stderr) sys.exit(1) sdk_path = sys.argv[1] ndk_path = sys.argv[2] -configure_args = sys.argv[3:] +android_abi = sys.argv[3] +configure_args = sys.argv[4:] if not os.path.isfile(os.path.join(sdk_path, 'tools', 'android')): print("SDK not found in", ndk_path, file=sys.stderr) @@ -19,8 +20,27 @@ if not os.path.isdir(ndk_path): print("NDK not found in", ndk_path, file=sys.stderr) sys.exit(1) +android_abis = { + 'armeabi-v7a': { + 'arch': 'arm-linux-androideabi', + 'ndk_arch': 'arm', + 'toolchain_arch': 'arm-linux-androideabi', + 'llvm_triple': 'armv7-none-linux-androideabi', + 'cflags': '-march=armv7-a -mfpu=vfp -mfloat-abi=softfp', + }, + + 'x86': { + 'arch': 'i686-linux-android', + 'ndk_arch': 'x86', + 'toolchain_arch': 'x86', + 'llvm_triple': 'i686-none-linux-android', + 'cflags': '-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32', + }, +} + # select the NDK target -arch = 'arm-linux-androideabi' +abi_info = android_abis[android_abi] +arch = abi_info['arch'] # the path to the MPD sources mpd_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]) or '.', '..')) @@ -44,8 +64,7 @@ class AndroidNdkToolchain: self.src_path = src_path self.build_path = build_path - self.ndk_arch = 'arm' - android_abi = 'armeabi-v7a' + ndk_arch = abi_info['ndk_arch'] ndk_platform = 'android-14' # select the NDK compiler @@ -53,7 +72,7 @@ class AndroidNdkToolchain: ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform) sysroot = os.path.join(ndk_path, 'sysroot') - target_root = os.path.join(ndk_platform_path, 'arch-' + self.ndk_arch) + target_root = os.path.join(ndk_platform_path, 'arch-' + ndk_arch) install_prefix = os.path.join(arch_path, 'root') @@ -61,13 +80,13 @@ class AndroidNdkToolchain: self.install_prefix = install_prefix self.sysroot = sysroot - toolchain_path = os.path.join(ndk_path, 'toolchains', arch + '-' + gcc_version, 'prebuilt', build_arch) + toolchain_path = os.path.join(ndk_path, 'toolchains', abi_info['toolchain_arch'] + '-' + gcc_version, 'prebuilt', build_arch) llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch) - llvm_triple = 'armv7-none-linux-androideabi' + llvm_triple = abi_info['llvm_triple'] common_flags = '-Os -g' common_flags += ' -fPIC' - common_flags += ' -march=armv7-a -mfpu=vfp -mfloat-abi=softfp' + common_flags += ' ' + abi_info['cflags'] toolchain_bin = os.path.join(toolchain_path, 'bin') llvm_bin = os.path.join(llvm_path, 'bin') @@ -95,7 +114,7 @@ class AndroidNdkToolchain: ' ' + common_flags self.libs = '' - self.is_arm = self.ndk_arch == 'arm' + self.is_arm = ndk_arch == 'arm' self.is_armv7 = self.is_arm and 'armv7' in self.cflags self.is_windows = False diff --git a/doc/user.xml b/doc/user.xml index 2447dce45..2887b7ca1 100644 --- a/doc/user.xml +++ b/doc/user.xml @@ -265,6 +265,59 @@ apt-get install g++ \ script. </para> </section> + + <section id="android_build"> + <title>Compiling for Android</title> + + <para> + MPD can be compiled as an Android app. It can be installed + easily with <link linkend="install_android">Google + Play</link>, but if you want to build it from source, follow + this section. + </para> + + <para> + You need: + </para> + + <itemizedlist> + <listitem> + <para> + Android SDK + </para> + </listitem> + + <listitem> + <para> + <ulink + url="https://developer.android.com/ndk/downloads/index.html">Android + NDK</ulink> + </para> + </listitem> + </itemizedlist> + + <para> + Just like with the native build, unpack the + <application>MPD</application> source tarball and change + into the directory. Then, instead of + <command>./configure</command>, type: + </para> + + <programlisting>./android/build.py SDK_PATH NDK_PATH ABI +make android/build/mpd-debug.apk</programlisting> + + <para> + <varname>SDK_PATH</varname> is the absolute path where you + installed the Android SDK; <varname>NDK_PATH</varname> is + the Android NDK installation path; <varname>ABI</varname> is + the Android ABI to be built, e.g. "armeabi-v7a". + </para> + + <para> + This downloads various library sources, and then configures + and builds <application>MPD</application>. + </para> + </section> </section> <section id="systemd_socket"> diff --git a/python/build/libs.py b/python/build/libs.py index 4cbab63ee..18b4cbbaf 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -23,6 +23,11 @@ libvorbis = AutotoolsProject( [ '--disable-shared', '--enable-static', ], + + edits={ + # this option is not understood by clang + 'configure': lambda data: data.replace('-mno-ieee-fp', ' '), + } ) opus = AutotoolsProject( diff --git a/src/Main.cxx b/src/Main.cxx index fce8dc06e..19b18f7a4 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -107,10 +107,6 @@ #include <locale.h> #endif -#ifdef __BLOCKS__ -#include <dispatch/dispatch.h> -#endif - #include <limits.h> static constexpr size_t KILOBYTE = 1024; @@ -536,21 +532,8 @@ try { daemonize_begin(options.daemon); #endif -#ifdef __BLOCKS__ - /* Runs the OS X native event loop in the main thread, and runs - the rest of mpd_main on a new thread. This lets CoreAudio receive - route change notifications (e.g. plugging or unplugging headphones). - All hardware output on OS X ultimately uses CoreAudio internally. - This must be run after forking; if dispatch is called before forking, - the child process will have a broken internal dispatch state. */ - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - exit(mpd_main_after_fork(config)); - }); - dispatch_main(); - return EXIT_FAILURE; // unreachable, because dispatch_main never returns -#else return mpd_main_after_fork(config); -#endif + } catch (const std::exception &e) { LogError(e); return EXIT_FAILURE; diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index 47fdfa405..bdc28bcbf 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -164,6 +164,10 @@ SongTime ParseCommandArgSongTime(const char *s) { auto value = ParseCommandArgFloat(s); + if (value < 0) + throw FormatProtocolError(ACK_ERROR_ARG, + "Negative value not allowed: %s", s); + return SongTime::FromS(value); } |