diff --git a/Makefile.am b/Makefile.am index 9339e9029..e1b72e7b1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,8 +63,8 @@ src_mpd_LDADD = \ libnet.a \ $(FS_LIBS) \ libsystem.a \ - libutil.a \ $(ICU_LDADD) \ + libutil.a \ $(SYSTEMD_DAEMON_LIBS) src_mpd_SOURCES = \ @@ -304,7 +304,7 @@ 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_BUILD_TOOLS_VERSION = 27.0.0 ANDROID_SDK_PLATFORM = android-17 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) 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_SOURCE_PATHS = $(addprefix $(srcdir)/android/src/,$(JAVA_SOURCE_NAMES)) JAVA_CLASSFILES_DIR = android/build/classes @@ -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 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) $(JAVAC) -source 1.5 -target 1.5 -Xlint:-options \ -cp $(ANDROID_SDK_PLATFORM_DIR)/android.jar:$(JAVA_CLASSFILES_DIR) \ diff --git a/NEWS b/NEWS index d27149c30..5b222be3c 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ ver 0.21 (not yet released) * require GCC 5.0 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 ver 0.20.15 (2018/01/05) diff --git a/android/build.py b/android/build.py index edabccf01..0b001e7da 100755 --- a/android/build.py +++ b/android/build.py @@ -65,7 +65,9 @@ class AndroidNdkToolchain: llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch) 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') llvm_bin = os.path.join(llvm_path, 'bin') @@ -80,8 +82,8 @@ class AndroidNdkToolchain: self.nm = os.path.join(toolchain_bin, arch + '-nm') self.strip = os.path.join(toolchain_bin, arch + '-strip') - self.cflags = '-Os -g ' + common_flags - self.cxxflags = '-Os -g ' + common_flags + self.cflags = common_flags + self.cxxflags = common_flags self.cppflags = '--sysroot=' + sysroot + \ ' -isystem ' + os.path.join(install_prefix, 'include') + \ ' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \ @@ -100,15 +102,13 @@ class AndroidNdkToolchain: libcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/llvm-libc++') 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_ldadd = os.path.join(libcxx_libs_path, 'libc++_static.a') + ' ' + os.path.join(libcxx_libs_path, 'libc++abi.a') - - if self.is_armv7: - libstdcxx_ldadd += ' ' + os.path.join(libcxx_libs_path, 'libunwind.a') + libstdcxx_flags = '-stdlib=libc++' + 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 use_cxx: - self.libs += ' ' + libstdcxx_ldadd - self.cppflags += ' ' + libstdcxx_cppflags + self.cxxflags += ' ' + libstdcxx_cxxflags + self.ldflags += ' ' + libstdcxx_ldflags self.env = dict(os.environ) diff --git a/python/build/autotools.py b/python/build/autotools.py index 56af64cce..58d5d8c54 100644 --- a/python/build/autotools.py +++ b/python/build/autotools.py @@ -8,6 +8,7 @@ class AutotoolsProject(MakeProject): cppflags='', ldflags='', libs='', + subdirs=None, **kwargs): MakeProject.__init__(self, url, md5, installed, **kwargs) self.configure_args = configure_args @@ -15,6 +16,7 @@ class AutotoolsProject(MakeProject): self.cppflags = cppflags self.ldflags = ldflags self.libs = libs + self.subdirs = subdirs def configure(self, toolchain): src = self.unpack(toolchain) @@ -51,4 +53,8 @@ class AutotoolsProject(MakeProject): def build(self, 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) diff --git a/python/build/libs.py b/python/build/libs.py index 0ad195798..a70cf5d1f 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -29,6 +29,8 @@ opus = AutotoolsProject( 'lib/libopus.a', [ '--disable-shared', '--enable-static', + '--disable-doc', + '--disable-extra-programs', ], # suppress "visibility default" from opus_defines.h @@ -42,7 +44,9 @@ flac = AutotoolsProject( [ '--disable-shared', '--enable-static', '--disable-xmms-plugin', '--disable-cpplibs', + '--disable-doxygen-docs', ], + subdirs=['include', 'src/libFLAC'], ) zlib = ZlibProject( @@ -83,8 +87,8 @@ libmad = AutotoolsProject( ) liblame = AutotoolsProject( - 'http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz', - '24346b4158e4af3bd9f2e194bb23eb473c75fb7377011523353196b19b9a23ff', + 'http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz', + 'ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e', 'lib/libmp3lame.a', [ '--disable-shared', '--enable-static', diff --git a/src/SongFilter.cxx b/src/SongFilter.cxx index 870788479..244cfc193 100644 --- a/src/SongFilter.cxx +++ b/src/SongFilter.cxx @@ -25,6 +25,8 @@ #include "util/ChronoUtil.hxx" #include "util/ConstBuffer.hxx" #include "util/StringAPI.hxx" +#include "util/StringCompare.hxx" +#include "util/StringView.hxx" #include "util/ASCII.hxx" #include "util/TimeParser.hxx" #include "util/UriUtil.hxx" @@ -60,7 +62,7 @@ locate_parse_type(const char *str) noexcept SongFilter::Item::Item(unsigned _tag, const char *_value, bool _fold_case) :tag(_tag), - value(AllocatedString<>::Duplicate(_value)), + value(_value), fold_case(_fold_case ? IcuCompare(value.c_str()) : IcuCompare()) { } @@ -275,3 +277,33 @@ SongFilter::GetBase() const noexcept 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; +} diff --git a/src/SongFilter.hxx b/src/SongFilter.hxx index 1dfffeeab..a1bec4c62 100644 --- a/src/SongFilter.hxx +++ b/src/SongFilter.hxx @@ -21,9 +21,9 @@ #define MPD_SONG_FILTER_HXX #include "lib/icu/Compare.hxx" -#include "util/AllocatedString.hxx" #include "Compiler.h" +#include #include #include @@ -54,7 +54,7 @@ public: class Item { uint8_t tag; - AllocatedString<> value; + std::string value; /** * This value is only set if case folding is enabled. @@ -71,11 +71,6 @@ public: Item(unsigned tag, const char *value, bool fold_case=false); 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 { return tag; } @@ -162,6 +157,13 @@ public: */ gcc_pure 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; }; /** diff --git a/src/db/plugins/simple/Mount.cxx b/src/db/plugins/simple/Mount.cxx index c07b67abc..22db95f46 100644 --- a/src/db/plugins/simple/Mount.cxx +++ b/src/db/plugins/simple/Mount.cxx @@ -20,18 +20,12 @@ #include "config.h" #include "Mount.hxx" #include "PrefixedLightSong.hxx" +#include "SongFilter.hxx" #include "db/Selection.hxx" #include "db/LightDirectory.hxx" #include "db/Interface.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 struct PrefixedLightDirectory : LightDirectory { @@ -93,5 +87,16 @@ WalkMount(const char *base, const Database &db, vp = std::bind(PrefixVisitPlaylist, 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); } diff --git a/src/lib/icu/Compare.hxx b/src/lib/icu/Compare.hxx index 9ee2e6848..d38026508 100644 --- a/src/lib/icu/Compare.hxx +++ b/src/lib/icu/Compare.hxx @@ -37,6 +37,18 @@ public: 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 &operator=(IcuCompare &&) = default; diff --git a/win32/build.py b/win32/build.py index d2b1aef1a..45c5dfa4c 100755 --- a/win32/build.py +++ b/win32/build.py @@ -50,14 +50,14 @@ class CrossGccToolchain: self.nm = os.path.join(toolchain_bin, arch + '-nm') self.strip = os.path.join(toolchain_bin, arch + '-strip') - common_flags = '' + common_flags = '-O2 -g' if not x64: # enable SSE support which is required for LAME common_flags += ' -march=pentium3' - self.cflags = '-O2 -g ' + common_flags - self.cxxflags = '-O2 -g ' + common_flags + self.cflags = common_flags + self.cxxflags = common_flags self.cppflags = '-isystem ' + os.path.join(install_prefix, 'include') self.ldflags = '-L' + os.path.join(install_prefix, 'lib') self.libs = ''