Commit fe5d0ce8 authored by Max Kellermann's avatar Max Kellermann

Merge branch 'v0.20.x'

parents 2fed3b5e 83765789
...@@ -63,8 +63,8 @@ src_mpd_LDADD = \ ...@@ -63,8 +63,8 @@ src_mpd_LDADD = \
libnet.a \ libnet.a \
$(FS_LIBS) \ $(FS_LIBS) \
libsystem.a \ libsystem.a \
libutil.a \
$(ICU_LDADD) \ $(ICU_LDADD) \
libutil.a \
$(SYSTEMD_DAEMON_LIBS) $(SYSTEMD_DAEMON_LIBS)
src_mpd_SOURCES = \ src_mpd_SOURCES = \
...@@ -304,7 +304,7 @@ clean-local: ...@@ -304,7 +304,7 @@ clean-local:
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_SDK_BUILD_TOOLS_VERSION = 20.0.0 ANDROID_SDK_BUILD_TOOLS_VERSION = 27.0.0
ANDROID_SDK_PLATFORM = android-17 ANDROID_SDK_PLATFORM = android-17
ANDROID_BUILD_TOOLS_DIR = $(ANDROID_SDK)/build-tools/$(ANDROID_SDK_BUILD_TOOLS_VERSION) ANDROID_BUILD_TOOLS_DIR = $(ANDROID_SDK)/build-tools/$(ANDROID_SDK_BUILD_TOOLS_VERSION)
...@@ -319,7 +319,7 @@ ANDROID_XML_RES := $(wildcard $(srcdir)/android/res/*/*.xml) ...@@ -319,7 +319,7 @@ ANDROID_XML_RES := $(wildcard $(srcdir)/android/res/*/*.xml)
ANDROID_XML_RES_COPIES := $(patsubst $(srcdir)/android/%,android/build/%,$(ANDROID_XML_RES)) ANDROID_XML_RES_COPIES := $(patsubst $(srcdir)/android/%,android/build/%,$(ANDROID_XML_RES))
JAVA_SOURCE_NAMES = Bridge.java Loader.java Main.java JAVA_SOURCE_NAMES = Bridge.java Loader.java Main.java
JAVA_SOURCES = $(addprefix $(srcdir)/android/src/,$(JAVA_SOURCE_NAMES)) JAVA_SOURCE_PATHS = $(addprefix $(srcdir)/android/src/,$(JAVA_SOURCE_NAMES))
JAVA_CLASSFILES_DIR = android/build/classes JAVA_CLASSFILES_DIR = android/build/classes
...@@ -340,7 +340,7 @@ android/build/resources.apk: $(ANDROID_XML_RES_COPIES) android/build/res/drawabl ...@@ -340,7 +340,7 @@ android/build/resources.apk: $(ANDROID_XML_RES_COPIES) android/build/res/drawabl
# R.java is generated by aapt, when resources.apk is generated # R.java is generated by aapt, when resources.apk is generated
android/build/gen/org/musicpd/R.java: android/build/resources.apk android/build/gen/org/musicpd/R.java: android/build/resources.apk
android/build/classes.dex: $(JAVA_SOURCES) android/build/gen/org/musicpd/R.java android/build/classes.dex: $(JAVA_SOURCE_PATHS) android/build/gen/org/musicpd/R.java
@$(MKDIR_P) $(JAVA_CLASSFILES_DIR) @$(MKDIR_P) $(JAVA_CLASSFILES_DIR)
$(JAVAC) -source 1.5 -target 1.5 -Xlint:-options \ $(JAVAC) -source 1.5 -target 1.5 -Xlint:-options \
-cp $(ANDROID_SDK_PLATFORM_DIR)/android.jar:$(JAVA_CLASSFILES_DIR) \ -cp $(ANDROID_SDK_PLATFORM_DIR)/android.jar:$(JAVA_CLASSFILES_DIR) \
......
...@@ -26,6 +26,8 @@ ver 0.21 (not yet released) ...@@ -26,6 +26,8 @@ ver 0.21 (not yet released)
* require GCC 5.0 * require GCC 5.0
ver 0.20.16 (not yet released) ver 0.20.16 (not yet released)
* database
- simple: fix search within mount points
* fix crash in debug build on Haiku and other operating systems * fix crash in debug build on Haiku and other operating systems
ver 0.20.15 (2018/01/05) ver 0.20.15 (2018/01/05)
......
...@@ -65,7 +65,9 @@ class AndroidNdkToolchain: ...@@ -65,7 +65,9 @@ class AndroidNdkToolchain:
llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch) llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch)
llvm_triple = 'armv7-none-linux-androideabi' llvm_triple = 'armv7-none-linux-androideabi'
common_flags = '-march=armv7-a -mfloat-abi=softfp' common_flags = '-Os -g'
common_flags += ' -fPIC'
common_flags += ' -march=armv7-a -mfloat-abi=softfp'
toolchain_bin = os.path.join(toolchain_path, 'bin') toolchain_bin = os.path.join(toolchain_path, 'bin')
llvm_bin = os.path.join(llvm_path, 'bin') llvm_bin = os.path.join(llvm_path, 'bin')
...@@ -80,8 +82,8 @@ class AndroidNdkToolchain: ...@@ -80,8 +82,8 @@ class AndroidNdkToolchain:
self.nm = os.path.join(toolchain_bin, arch + '-nm') self.nm = os.path.join(toolchain_bin, arch + '-nm')
self.strip = os.path.join(toolchain_bin, arch + '-strip') self.strip = os.path.join(toolchain_bin, arch + '-strip')
self.cflags = '-Os -g ' + common_flags self.cflags = common_flags
self.cxxflags = '-Os -g ' + common_flags self.cxxflags = common_flags
self.cppflags = '--sysroot=' + sysroot + \ self.cppflags = '--sysroot=' + sysroot + \
' -isystem ' + os.path.join(install_prefix, 'include') + \ ' -isystem ' + os.path.join(install_prefix, 'include') + \
' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \ ' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \
...@@ -100,15 +102,13 @@ class AndroidNdkToolchain: ...@@ -100,15 +102,13 @@ class AndroidNdkToolchain:
libcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/llvm-libc++') libcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/llvm-libc++')
libcxx_libs_path = os.path.join(libcxx_path, 'libs', android_abi) libcxx_libs_path = os.path.join(libcxx_path, 'libs', android_abi)
libstdcxx_cppflags = '-nostdinc++ -isystem ' + os.path.join(libcxx_path, 'include') + ' -isystem ' + os.path.join(ndk_path, 'sources/android/support/include') libstdcxx_flags = '-stdlib=libc++'
libstdcxx_ldadd = os.path.join(libcxx_libs_path, 'libc++_static.a') + ' ' + os.path.join(libcxx_libs_path, 'libc++abi.a') libstdcxx_cxxflags = libstdcxx_flags + ' -isystem ' + os.path.join(libcxx_path, 'include') + ' -isystem ' + os.path.join(ndk_path, 'sources/android/support/include')
libstdcxx_ldflags = libstdcxx_flags + ' -static-libstdc++ -L' + libcxx_libs_path
if self.is_armv7:
libstdcxx_ldadd += ' ' + os.path.join(libcxx_libs_path, 'libunwind.a')
if use_cxx: if use_cxx:
self.libs += ' ' + libstdcxx_ldadd self.cxxflags += ' ' + libstdcxx_cxxflags
self.cppflags += ' ' + libstdcxx_cppflags self.ldflags += ' ' + libstdcxx_ldflags
self.env = dict(os.environ) self.env = dict(os.environ)
......
...@@ -8,6 +8,7 @@ class AutotoolsProject(MakeProject): ...@@ -8,6 +8,7 @@ class AutotoolsProject(MakeProject):
cppflags='', cppflags='',
ldflags='', ldflags='',
libs='', libs='',
subdirs=None,
**kwargs): **kwargs):
MakeProject.__init__(self, url, md5, installed, **kwargs) MakeProject.__init__(self, url, md5, installed, **kwargs)
self.configure_args = configure_args self.configure_args = configure_args
...@@ -15,6 +16,7 @@ class AutotoolsProject(MakeProject): ...@@ -15,6 +16,7 @@ class AutotoolsProject(MakeProject):
self.cppflags = cppflags self.cppflags = cppflags
self.ldflags = ldflags self.ldflags = ldflags
self.libs = libs self.libs = libs
self.subdirs = subdirs
def configure(self, toolchain): def configure(self, toolchain):
src = self.unpack(toolchain) src = self.unpack(toolchain)
...@@ -51,4 +53,8 @@ class AutotoolsProject(MakeProject): ...@@ -51,4 +53,8 @@ class AutotoolsProject(MakeProject):
def build(self, toolchain): def build(self, toolchain):
build = self.configure(toolchain) build = self.configure(toolchain)
MakeProject.build(self, toolchain, build) if self.subdirs is not None:
for subdir in self.subdirs:
MakeProject.build(self, toolchain, os.path.join(build, subdir))
else:
MakeProject.build(self, toolchain, build)
...@@ -29,6 +29,8 @@ opus = AutotoolsProject( ...@@ -29,6 +29,8 @@ opus = AutotoolsProject(
'lib/libopus.a', 'lib/libopus.a',
[ [
'--disable-shared', '--enable-static', '--disable-shared', '--enable-static',
'--disable-doc',
'--disable-extra-programs',
], ],
# suppress "visibility default" from opus_defines.h # suppress "visibility default" from opus_defines.h
...@@ -42,7 +44,9 @@ flac = AutotoolsProject( ...@@ -42,7 +44,9 @@ flac = AutotoolsProject(
[ [
'--disable-shared', '--enable-static', '--disable-shared', '--enable-static',
'--disable-xmms-plugin', '--disable-cpplibs', '--disable-xmms-plugin', '--disable-cpplibs',
'--disable-doxygen-docs',
], ],
subdirs=['include', 'src/libFLAC'],
) )
zlib = ZlibProject( zlib = ZlibProject(
...@@ -83,8 +87,8 @@ libmad = AutotoolsProject( ...@@ -83,8 +87,8 @@ libmad = AutotoolsProject(
) )
liblame = AutotoolsProject( liblame = AutotoolsProject(
'http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz', 'http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz',
'24346b4158e4af3bd9f2e194bb23eb473c75fb7377011523353196b19b9a23ff', 'ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e',
'lib/libmp3lame.a', 'lib/libmp3lame.a',
[ [
'--disable-shared', '--enable-static', '--disable-shared', '--enable-static',
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "util/ChronoUtil.hxx" #include "util/ChronoUtil.hxx"
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
#include "util/StringCompare.hxx"
#include "util/StringView.hxx"
#include "util/ASCII.hxx" #include "util/ASCII.hxx"
#include "util/TimeParser.hxx" #include "util/TimeParser.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
...@@ -60,7 +62,7 @@ locate_parse_type(const char *str) noexcept ...@@ -60,7 +62,7 @@ locate_parse_type(const char *str) noexcept
SongFilter::Item::Item(unsigned _tag, const char *_value, bool _fold_case) SongFilter::Item::Item(unsigned _tag, const char *_value, bool _fold_case)
:tag(_tag), :tag(_tag),
value(AllocatedString<>::Duplicate(_value)), value(_value),
fold_case(_fold_case ? IcuCompare(value.c_str()) : IcuCompare()) fold_case(_fold_case ? IcuCompare(value.c_str()) : IcuCompare())
{ {
} }
...@@ -275,3 +277,33 @@ SongFilter::GetBase() const noexcept ...@@ -275,3 +277,33 @@ SongFilter::GetBase() const noexcept
return nullptr; return nullptr;
} }
SongFilter
SongFilter::WithoutBasePrefix(const char *_prefix) const noexcept
{
const StringView prefix(_prefix);
SongFilter result;
for (const auto &i : items) {
if (i.GetTag() == LOCATE_TAG_BASE_TYPE) {
const char *s = StringAfterPrefix(i.GetValue(), prefix);
if (s != nullptr) {
if (*s == 0)
continue;
if (*s == '/') {
++s;
if (*s != 0)
result.items.emplace_back(LOCATE_TAG_BASE_TYPE, s);
continue;
}
}
}
result.items.emplace_back(i);
}
return result;
}
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#define MPD_SONG_FILTER_HXX #define MPD_SONG_FILTER_HXX
#include "lib/icu/Compare.hxx" #include "lib/icu/Compare.hxx"
#include "util/AllocatedString.hxx"
#include "Compiler.h" #include "Compiler.h"
#include <string>
#include <list> #include <list>
#include <chrono> #include <chrono>
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
class Item { class Item {
uint8_t tag; uint8_t tag;
AllocatedString<> value; std::string value;
/** /**
* This value is only set if case folding is enabled. * This value is only set if case folding is enabled.
...@@ -71,11 +71,6 @@ public: ...@@ -71,11 +71,6 @@ public:
Item(unsigned tag, const char *value, bool fold_case=false); Item(unsigned tag, const char *value, bool fold_case=false);
Item(unsigned tag, std::chrono::system_clock::time_point time); Item(unsigned tag, std::chrono::system_clock::time_point time);
Item(const Item &other) = delete;
Item(Item &&) = default;
Item &operator=(const Item &other) = delete;
unsigned GetTag() const { unsigned GetTag() const {
return tag; return tag;
} }
...@@ -162,6 +157,13 @@ public: ...@@ -162,6 +157,13 @@ public:
*/ */
gcc_pure gcc_pure
const char *GetBase() const noexcept; const char *GetBase() const noexcept;
/**
* Create a copy of the filter with the given prefix stripped
* from all #LOCATE_TAG_BASE_TYPE items. This is used to
* filter songs in mounted databases.
*/
SongFilter WithoutBasePrefix(const char *prefix) const noexcept;
}; };
/** /**
......
...@@ -20,18 +20,12 @@ ...@@ -20,18 +20,12 @@
#include "config.h" #include "config.h"
#include "Mount.hxx" #include "Mount.hxx"
#include "PrefixedLightSong.hxx" #include "PrefixedLightSong.hxx"
#include "SongFilter.hxx"
#include "db/Selection.hxx" #include "db/Selection.hxx"
#include "db/LightDirectory.hxx" #include "db/LightDirectory.hxx"
#include "db/Interface.hxx" #include "db/Interface.hxx"
#include "fs/Traits.hxx" #include "fs/Traits.hxx"
#ifdef _LIBCPP_VERSION
/* workaround for "error: incomplete type 'PlaylistInfo' used in type
trait expression" with libc++ version 3900 (from Android NDK
r13b) */
#include "db/PlaylistInfo.hxx"
#endif
#include <string> #include <string>
struct PrefixedLightDirectory : LightDirectory { struct PrefixedLightDirectory : LightDirectory {
...@@ -93,5 +87,16 @@ WalkMount(const char *base, const Database &db, ...@@ -93,5 +87,16 @@ WalkMount(const char *base, const Database &db,
vp = std::bind(PrefixVisitPlaylist, vp = std::bind(PrefixVisitPlaylist,
base, std::ref(visit_playlist), _1, _2); base, std::ref(visit_playlist), _1, _2);
SongFilter prefix_filter;
if (base != nullptr && filter != nullptr) {
/* if the SongFilter contains a LOCATE_TAG_BASE_TYPE
item, copy the SongFilter and drop the mount point
from the filter, because the mounted database
doesn't know its own location within MPD's VFS */
prefix_filter = filter->WithoutBasePrefix(base);
filter = &prefix_filter;
}
db.Visit(DatabaseSelection(uri, recursive, filter), vd, vs, vp); db.Visit(DatabaseSelection(uri, recursive, filter), vd, vs, vp);
} }
...@@ -37,6 +37,18 @@ public: ...@@ -37,6 +37,18 @@ public:
explicit IcuCompare(const char *needle) noexcept; explicit IcuCompare(const char *needle) noexcept;
IcuCompare(const IcuCompare &src) noexcept
:needle(src
? AllocatedString<>::Duplicate(src.needle.c_str())
: nullptr) {}
IcuCompare &operator=(const IcuCompare &src) noexcept {
needle = src
? AllocatedString<>::Duplicate(src.needle.c_str())
: nullptr;
return *this;
}
IcuCompare(IcuCompare &&) = default; IcuCompare(IcuCompare &&) = default;
IcuCompare &operator=(IcuCompare &&) = default; IcuCompare &operator=(IcuCompare &&) = default;
......
...@@ -50,14 +50,14 @@ class CrossGccToolchain: ...@@ -50,14 +50,14 @@ class CrossGccToolchain:
self.nm = os.path.join(toolchain_bin, arch + '-nm') self.nm = os.path.join(toolchain_bin, arch + '-nm')
self.strip = os.path.join(toolchain_bin, arch + '-strip') self.strip = os.path.join(toolchain_bin, arch + '-strip')
common_flags = '' common_flags = '-O2 -g'
if not x64: if not x64:
# enable SSE support which is required for LAME # enable SSE support which is required for LAME
common_flags += ' -march=pentium3' common_flags += ' -march=pentium3'
self.cflags = '-O2 -g ' + common_flags self.cflags = common_flags
self.cxxflags = '-O2 -g ' + common_flags self.cxxflags = common_flags
self.cppflags = '-isystem ' + os.path.join(install_prefix, 'include') self.cppflags = '-isystem ' + os.path.join(install_prefix, 'include')
self.ldflags = '-L' + os.path.join(install_prefix, 'lib') self.ldflags = '-L' + os.path.join(install_prefix, 'lib')
self.libs = '' self.libs = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment