Message ID | 20201006192709.8265-2-leo@yuriev.ru |
---|---|
State | Changes Requested |
Headers | show |
Series | package/libmdbx: new package (library/database) | expand |
Hi, Am Di., 6. Okt. 2020 um 21:27 Uhr schrieb Leonid Yuriev <leo@yuriev.ru>: > > This patch adds libmdbx v0.9.1: > - libmdbx is one of the fastest compact embeddable key-value ACID database. > - libmdbx has a specific set of properties and capabilities, > focused on creating unique lightweight solutions. > - libmdbx surpasses the legendary LMDB (Lightning Memory-Mapped Database) > in terms of reliability, features and performance. > > https://github.com/erthink/libmdbx > > --- > Changes v1 -> v2: > - libmdbx version v0.8.2 -> v0.9.1 (released 2020-09-30) > > Changes v2 -> v3: > - removed outcommented stuff (suggested by Heiko Thiery). > - cleaned up and simplified the makefile (suggested by Heiko Thiery). > - added patch for C++ header installation. > - added patch with fix minor copy&paste typo. > - added patch with pthread workaround for buggy toolchain/cmake/buildroot. > - added patch for `pthread_yield()`. > - passed `utils/check-package package/libmdbx/*` (suggested by Heiko Thiery) > - passed `utils/test-pkg -a -p libmdbx`, > except w/o threads & w/o MMU (suggested by Heiko Thiery). > > Changes v3 -> v4: > - fix passing BR2_PACKAGE_LIBMDBX_TOOLS option to cmake. > - fix using `depend on` instead of `select`, > and add `comment` for C++ toolchain (suggested by Heiko Thiery). > - fix minor help typo. > > Signed-off-by: Leonid Yuriev <leo@yuriev.ru> Reviewed-by: Heiko Thiery <heiko.thiery@gmail.com> > --- > DEVELOPERS | 3 + > package/Config.in | 1 + > .../0001-mdbx-fix-minor-copy-paste-typo.patch | 27 ++++++++ > ...e-fix-missing-installation-of-mdbx.h.patch | 54 +++++++++++++++ > .../0003-mdbx-fix-obsolete-__noreturn.patch | 27 ++++++++ > ...ield-instruction-on-ARM-if-unsupport.patch | 28 ++++++++ > ...fix-minor-false-positive-GCC-warning.patch | 27 ++++++++ > ...ad-workaround-for-buggy-toolchain-cm.patch | 65 +++++++++++++++++++ > ...mdbx-fix-pthread_yield-for-non-GLIBC.patch | 42 ++++++++++++ > package/libmdbx/Config.in | 42 ++++++++++++ > package/libmdbx/libmdbx.hash | 2 + > package/libmdbx/libmdbx.mk | 24 +++++++ > 12 files changed, 342 insertions(+) > create mode 100644 package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch > create mode 100644 package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch > create mode 100644 package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch > create mode 100644 package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch > create mode 100644 package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch > create mode 100644 package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch > create mode 100644 package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch > create mode 100644 package/libmdbx/Config.in > create mode 100644 package/libmdbx/libmdbx.hash > create mode 100644 package/libmdbx/libmdbx.mk > > diff --git a/DEVELOPERS b/DEVELOPERS > index f8655fa054..924e70e30c 100644 > --- a/DEVELOPERS > +++ b/DEVELOPERS > @@ -1551,6 +1551,9 @@ N: Leon Anavi <leon.anavi@konsulko.com> > F: board/olimex/a10_olinuxino > F: configs/olimex_a10_olinuxino_lime_defconfig > > +N: Leonid Yuriev <leo@yuriev.ru> > +F: package/libmdbx > + > N: Lionel Flandrin <lionel@svkt.org> > F: package/python-babel/ > F: package/python-daemonize/ > diff --git a/package/Config.in b/package/Config.in > index 51583d07d6..f87e0388a0 100644 > --- a/package/Config.in > +++ b/package/Config.in > @@ -1370,6 +1370,7 @@ menu "Database" > source "package/kompexsqlite/Config.in" > source "package/leveldb/Config.in" > source "package/libgit2/Config.in" > + source "package/libmdbx/Config.in" > source "package/libodb/Config.in" > source "package/libodb-boost/Config.in" > source "package/libodb-mysql/Config.in" > diff --git a/package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch b/package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch > new file mode 100644 > index 0000000000..d9ff3c5e71 > --- /dev/null > +++ b/package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch > @@ -0,0 +1,27 @@ > +From 5807e2eda046bff35946972289236bbef5c0c597 Mon Sep 17 00:00:00 2001 > +From: Leonid Yuriev <leo@yuriev.ru> > +Date: Thu, 1 Oct 2020 02:27:29 +0300 > +Subject: [PATCH] mdbx++: fix minor copy&paste typo. > + > +Change-Id: I0af3e7ffbbd1231069a60f9f48880df3df2141d7 > +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +--- > + mdbx.h++ | 2 +- > + 1 file changed, 1 insertion(+), 1 deletion(-) > + > +diff --git a/mdbx.h++ b/mdbx.h++ > +index 095ff9abb..2050f4b92 100644 > +--- a/mdbx.h++ > ++++ b/mdbx.h++ > +@@ -538,7 +538,7 @@ struct LIBMDBX_API_TYPE slice : public ::MDBX_val { > + byte *from_base58(byte *dest, size_t dest_size, > + bool ignore_spaces = false) const; > + > +- /// vReturns the buffer size in bytes needed for conversion > ++ /// \brief Returns the buffer size in bytes needed for conversion > + /// [Base58](https://en.wikipedia.org/wiki/Base58) dump to data. > + MDBX_CXX11_CONSTEXPR size_t from_base58_bytes() const noexcept { > + return length() / 11 * 8 + length() % 11 * 32 / 43; > +-- > +2.28.0 > + > diff --git a/package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch b/package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch > new file mode 100644 > index 0000000000..df49342ccb > --- /dev/null > +++ b/package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch > @@ -0,0 +1,54 @@ > +From dc2cd19d566e84451ee47cf04277f97bc22771c5 Mon Sep 17 00:00:00 2001 > +From: Leonid Yuriev <leo@yuriev.ru> > +Date: Fri, 2 Oct 2020 00:05:02 +0300 > +Subject: [PATCH] mdbx-cmake: fix missing installation of `mdbx.h++` > + > +Change-Id: I41975e4eeff6583a266b273b9a4f8486982ede90 > +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +--- > + CMakeLists.txt | 8 +++++--- > + 1 file changed, 5 insertions(+), 3 deletions(-) > + > +diff --git a/CMakeLists.txt b/CMakeLists.txt > +index 28db425c5..95f116521 100644 > +--- a/CMakeLists.txt > ++++ b/CMakeLists.txt > +@@ -485,7 +485,8 @@ fetch_version(MDBX "${CMAKE_CURRENT_SOURCE_DIR}" FALSE) > + message(STATUS "libmdbx version is ${MDBX_VERSION}") > + > + # sources list > +-set(LIBMDBX_SOURCES mdbx.h "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) > ++set(LIBMDBX_PUBLIC_HEADERS mdbx.h) > ++set(LIBMDBX_SOURCES mdbx.h "${CMAKE_CURRENT_BINARY_DIR}/config.h") > + if(MDBX_AMALGAMATED_SOURCE) > + list(APPEND LIBMDBX_SOURCES mdbx.c) > + else() > +@@ -511,6 +512,7 @@ else() > + endif(MDBX_AMALGAMATED_SOURCE) > + if(MDBX_BUILD_CXX) > + message(STATUS "Use C${MDBX_C_STANDARD} and C++${MDBX_CXX_STANDARD} for libmdbx") > ++ list(APPEND LIBMDBX_PUBLIC_HEADERS mdbx.h++) > + list(APPEND LIBMDBX_SOURCES "${MDBX_SOURCE_DIR}/mdbx.c++" mdbx.h++) > + else() > + message(STATUS "Use C${MDBX_C_STANDARD} for libmdbx but C++ portion is disabled") > +@@ -561,7 +563,7 @@ if(MDBX_INSTALL_STATIC) > + else() > + add_library(mdbx-static STATIC EXCLUDE_FROM_ALL ${LIBMDBX_SOURCES}) > + endif() > +-set_target_properties(mdbx-static PROPERTIES PUBLIC_HEADER mdbx.h) > ++set_target_properties(mdbx-static PROPERTIES PUBLIC_HEADER "${LIBMDBX_PUBLIC_HEADERS}") > + target_compile_definitions(mdbx-static PRIVATE MDBX_BUILD_SHARED_LIBRARY=0) > + target_setup_options(mdbx-static) > + libmdbx_setup_libs(mdbx-static INTERFACE) > +@@ -576,7 +578,7 @@ endif() > + # build shared library > + if(MDBX_BUILD_SHARED_LIBRARY) > + add_library(mdbx SHARED ${LIBMDBX_SOURCES}) > +- set_target_properties(mdbx PROPERTIES PUBLIC_HEADER mdbx.h) > ++ set_target_properties(mdbx PROPERTIES PUBLIC_HEADER "${LIBMDBX_PUBLIC_HEADERS}") > + target_compile_definitions(mdbx PRIVATE LIBMDBX_EXPORTS MDBX_BUILD_SHARED_LIBRARY=1 INTERFACE LIBMDBX_IMPORTS) > + target_setup_options(mdbx) > + libmdbx_setup_libs(mdbx PRIVATE) > +-- > +2.28.0 > + > diff --git a/package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch b/package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch > new file mode 100644 > index 0000000000..cb04334220 > --- /dev/null > +++ b/package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch > @@ -0,0 +1,27 @@ > +From 280ed17ea2dff464c9688fcc92079f36d8b74621 Mon Sep 17 00:00:00 2001 > +From: Leonid Yuriev <leo@yuriev.ru> > +Date: Sat, 3 Oct 2020 11:35:26 +0300 > +Subject: [PATCH] mdbx: fix obsolete `__noreturn`. > + > +Change-Id: Ic78843d6f16de2a409c16ceecc7acb2ed8aa3e68 > +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +--- > + mdbx.c | 2 +- > + 1 file changed, 1 insertion(+), 1 deletion(-) > + > +diff --git a/mdbx.c b/mdbx.c > +index 04ea5140d..9212640fe 100644 > +--- a/mdbx.c > ++++ b/mdbx.c > +@@ -141,7 +141,7 @@ __extern_C void __assert(const char *, const char *, unsigned int, const char *) > + #else > + __nothrow > + #endif /* __THROW */ > +- __noreturn; > ++ MDBX_NORETURN; > + #define __assert_fail(assertion, file, line, function) \ > + __assert(assertion, file, line, function) > + > +-- > +2.28.0 > + > diff --git a/package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch b/package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch > new file mode 100644 > index 0000000000..23f91d859b > --- /dev/null > +++ b/package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch > @@ -0,0 +1,28 @@ > +From 70b615e8d4d10cda2d961a815dd15eb87a1f3925 Mon Sep 17 00:00:00 2001 > +From: Leonid Yuriev <leo@yuriev.ru> > +Date: Sun, 4 Oct 2020 14:54:11 +0300 > +Subject: [PATCH] mdbx: don't use `yield` instruction on ARM if unsupported. > + > +Change-Id: I0b01d783fe4336b089f4b051fb61c203b5879aa5 > +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +--- > + mdbx.c | 3 ++- > + 1 file changed, 2 insertions(+), 1 deletion(-) > + > +diff --git a/mdbx.c b/mdbx.c > +index aba445424..a9ba1ee85 100644 > +--- a/mdbx.c > ++++ b/mdbx.c > +@@ -763,7 +763,8 @@ static __always_inline void atomic_yield(void) { > + #else > + __asm__ __volatile__("hint @pause"); > + #endif > +-#elif defined(__arm__) || defined(__aarch64__) > ++#elif defined(__aarch64__) || (defined(__ARM_ARCH) && __ARM_ARCH > 6) || \ > ++ defined(__ARM_ARCH_6K__) > + #ifdef __CC_ARM > + __yield(); > + #else > +-- > +2.28.0 > + > diff --git a/package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch b/package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch > new file mode 100644 > index 0000000000..29d69e3faa > --- /dev/null > +++ b/package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch > @@ -0,0 +1,27 @@ > +From 8d4e7994c0c5c0cf69326139717e324f90bff65b Mon Sep 17 00:00:00 2001 > +From: Leonid Yuriev <leo@yuriev.ru> > +Date: Mon, 5 Oct 2020 15:09:10 +0300 > +Subject: [PATCH] mdbx-load: fix minor false-positive GCC warning. > + > +Change-Id: Ie75c793712d050e8d3da76a4d0a8df9b81dc5275 > +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +--- > + mdbx_load.c | 2 +- > + 1 file changed, 1 insertion(+), 1 deletion(-) > + > +diff --git a/mdbx_load.c b/mdbx_load.c > +index e5e72fc8f..54e179553 100644 > +--- a/mdbx_load.c > ++++ b/mdbx_load.c > +@@ -318,7 +318,7 @@ static int readhdr(void) { > + } > + > + for (int i = 0; dbflags[i].bit; i++) { > +- bool value; > ++ bool value = false; > + if (valbool(dbuf.iov_base, dbflags[i].name, &value)) { > + if (value) > + dbi_flags |= dbflags[i].bit; > +-- > +2.28.0 > + > diff --git a/package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch b/package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch > new file mode 100644 > index 0000000000..37525cf0d5 > --- /dev/null > +++ b/package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch > @@ -0,0 +1,65 @@ > +From 787eaaa373073e17f3a53658b085c255bc2c8ff8 Mon Sep 17 00:00:00 2001 > +From: Leonid Yuriev <leo@yuriev.ru> > +Date: Mon, 5 Oct 2020 19:12:20 +0300 > +Subject: [PATCH] mdbx-cmake: pthread workaround for buggy > + toolchain/cmake/buildroot. > + > +Change-Id: I0d95e783abbd10a63cd1595a9de50593e814a967 > +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +--- > + CMakeLists.txt | 21 ++++++++++++++++++--- > + 1 file changed, 18 insertions(+), 3 deletions(-) > + > +diff --git a/CMakeLists.txt b/CMakeLists.txt > +index 95f116521..20a50a453 100644 > +--- a/CMakeLists.txt > ++++ b/CMakeLists.txt > +@@ -173,10 +173,27 @@ if(NOT CMAKE_BUILD_TYPE) > + endif() > + string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE) > + > ++set(CMAKE_THREAD_PREFER_PTHREAD TRUE) > ++set(THREADS_PREFER_PTHREAD_FLAG TRUE) > ++find_package(Threads REQUIRED) > ++ > + include(cmake/utils.cmake) > + include(cmake/compiler.cmake) > + include(cmake/profile.cmake) > + > ++# Workaround for `-pthread` toolchain/cmake bug > ++if(NOT APPLE AND NOT MSVC > ++ AND CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_THREAD_LIBS_INIT > ++ AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)) > ++ check_compiler_flag("-pthread" CC_HAS_PTHREAD) > ++ if(CC_HAS_PTHREAD AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-pthread") > ++ message(STATUS "Force add -pthread for linker flags to avoid troubles") > ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") > ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread") > ++ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pthread") > ++ endif() > ++endif() > ++ > + CHECK_FUNCTION_EXISTS(pow NOT_NEED_LIBM) > + if(NOT_NEED_LIBM) > + set(LIB_MATH "") > +@@ -190,8 +207,6 @@ else() > + endif() > + endif() > + > +-find_package(Threads REQUIRED) > +- > + if(SUBPROJECT) > + if(NOT DEFINED BUILD_SHARED_LIBS) > + option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)" OFF) > +@@ -541,7 +556,7 @@ macro(target_setup_options TARGET) > + endmacro() > + > + macro(libmdbx_setup_libs TARGET MODE) > +- target_link_libraries(${TARGET} ${MODE} ${CMAKE_THREAD_LIBS_INIT}) > ++ target_link_libraries(${TARGET} ${MODE} Threads::Threads) > + if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") > + target_link_libraries(${TARGET} ${MODE} ntdll.lib) > + if(MDBX_NTDLL_EXTRA_IMPLIB AND MDBX_AVOID_CRT) > +-- > +2.28.0 > + > diff --git a/package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch b/package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch > new file mode 100644 > index 0000000000..5d7e83d4c7 > --- /dev/null > +++ b/package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch > @@ -0,0 +1,42 @@ > +From 16d43332a9d28ba27aa3d127e8f6b77a87b2f5eb Mon Sep 17 00:00:00 2001 > +From: Leonid Yuriev <leo@yuriev.ru> > +Date: Mon, 5 Oct 2020 21:08:09 +0300 > +Subject: [PATCH] mdbx: fix `pthread_yield()` for non-GLIBC. > + > +Change-Id: I080e37a42b62e524896dea8747e9f23e2fcd584f > +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +--- > + mdbx.c | 4 +++- > + mdbx.c | 1 + > + 2 files changed, 4 insertions(+), 1 deletion(-) > + > +diff --git a/mdbx.c b/mdbx.c > +index a9ba1ee85..ace6f2756 100644 > +--- a/mdbx.c > ++++ b/mdbx.c > +@@ -777,7 +777,9 @@ static __always_inline void atomic_yield(void) { > + defined(__mips64__) || defined(_M_MRX000) || defined(_MIPS_) || \ > + defined(__MWERKS__) || defined(__sgi) > + __asm__ __volatile__(".word 0x00000140"); > +-#else > ++#elif defined(__linux__) || defined(__gnu_linux__) || defined(_UNIX03_SOURCE) > ++ sched_yield(); > ++#elif (defined(_GNU_SOURCE) && __GLIBC_PREREQ(2, 1)) || defined(_OPEN_THREADS) > + pthread_yield(); > + #endif > + } > +diff --git a/mdbx.c b/mdbx.c > +index 3509942dc..3af23ce0b 100644 > +--- a/mdbx.c > ++++ b/mdbx.c > +@@ -119,6 +119,7 @@ > + > + #if defined(__linux__) || defined(__gnu_linux__) > + #include <linux/sysctl.h> > ++#include <sched.h> > + #include <sys/sendfile.h> > + #include <sys/statfs.h> > + #endif /* Linux */ > +-- > +2.28.0 > + > diff --git a/package/libmdbx/Config.in b/package/libmdbx/Config.in > new file mode 100644 > index 0000000000..dc36f12348 > --- /dev/null > +++ b/package/libmdbx/Config.in > @@ -0,0 +1,42 @@ > +config BR2_PACKAGE_LIBMDBX > + bool "libmdbx" > + depends on BR2_USE_MMU > + depends on BR2_TOOLCHAIN_HAS_THREADS > + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 > + depends on BR2_TOOLCHAIN_HAS_SYNC_4 > + help > + One of the fastest compact key-value ACID database > + without WAL. libmdbx has a specific set of properties > + and capabilities, focused on creating unique lightweight > + solutions. > + > + libmdbx surpasses the legendary LMDB in terms of > + reliability, features and performance. > + > + https://github.com/erthink/libmdbx > + > +if BR2_PACKAGE_LIBMDBX > + > +config BR2_PACKAGE_LIBMDBX_TOOLS > + bool "install tools" > + help > + Install libmdbx tools for checking, dump, restore > + and show statistics of databases. > + > +config BR2_PACKAGE_LIBMDBX_CXX > + bool "C++ API" > + depends on BR2_INSTALL_LIBSTDCPP > + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 > + help > + Enable modern C++11/14/17/20 API for libmdbx. > + > +comment "libmdbx C++ support needs a toolchain w/ C++11, gcc >= 4.8" > + depends on !BR2_INSTALL_LIBSTDCPP || \ > + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 > + > +endif > + > +comment "libmdbx needs a toolchain w/ threads, gcc >= 4.4" > + depends on BR2_USE_MMU > + depends on !BR2_TOOLCHAIN_HAS_THREADS || \ > + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 > diff --git a/package/libmdbx/libmdbx.hash b/package/libmdbx/libmdbx.hash > new file mode 100644 > index 0000000000..f48cd81a7d > --- /dev/null > +++ b/package/libmdbx/libmdbx.hash > @@ -0,0 +1,2 @@ > +sha256 310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569 LICENSE > +sha256 c7fb24381eb4d92f2e2edc17e577cb721269683c816c6cca307c58f6f346e786 libmdbx-amalgamated-0.9.1.tar.gz > diff --git a/package/libmdbx/libmdbx.mk b/package/libmdbx/libmdbx.mk > new file mode 100644 > index 0000000000..be0c2d7b06 > --- /dev/null > +++ b/package/libmdbx/libmdbx.mk > @@ -0,0 +1,24 @@ > +################################################################################ > +# > +# libmdbx > +# > +################################################################################ > + > +LIBMDBX_VERSION = 0.9.1 > +LIBMDBX_SOURCE = libmdbx-amalgamated-$(LIBMDBX_VERSION).tar.gz > +LIBMDBX_SITE = https://github.com/erthink/libmdbx/releases/download/v$(LIBMDBX_VERSION) > +LIBMDBX_SUPPORTS_IN_SOURCE_BUILD = NO > +LIBMDBX_LICENSE = OLDAP-2.8 > +LIBMDBX_LICENSE_FILES = LICENSE > +LIBMDBX_REDISTRIBUTE = YES > +LIBMDBX_STRIP_COMPONENTS = 0 > +LIBMDBX_INSTALL_STAGING = YES > + > +LIBMDBX_CONF_OPTS = -DMDBX_INSTALL_MANPAGES=OFF -DBUILD_FOR_NATIVE_CPU=OFF \ > + -DMDBX_INSTALL_STATIC=$(if $(BR2_STATIC_LIBS),ON,OFF) \ > + -DMDBX_BUILD_SHARED_LIBRARY=$(if $(BR2_SHARED_LIBS),ON,OFF) \ > + -DMDBX_BUILD_CXX=$(if $(BR2_PACKAGE_LIBMDBX_CXX),ON,OFF) \ > + -DMDBX_BUILD_TOOLS=$(if $(BR2_PACKAGE_LIBMDBX_TOOLS),ON,OFF) \ > + -DMDBX_LINK_TOOLS_NONSTATIC=$(if $(BR2_SHARED_LIBS),ON,OFF) > + > +$(eval $(cmake-package)) > -- > 2.28.0 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Hello Leonid, Thanks for this contribution and new iteration! On Tue, 6 Oct 2020 22:27:09 +0300 Leonid Yuriev <leo@yuriev.ru> wrote: > This patch adds libmdbx v0.9.1: > - libmdbx is one of the fastest compact embeddable key-value ACID database. > - libmdbx has a specific set of properties and capabilities, > focused on creating unique lightweight solutions. > - libmdbx surpasses the legendary LMDB (Lightning Memory-Mapped Database) > in terms of reliability, features and performance. > > https://github.com/erthink/libmdbx > Your Signed-off-by line should be here... and not after the changelog. > --- > Changes v1 -> v2: > - libmdbx version v0.8.2 -> v0.9.1 (released 2020-09-30) > > Changes v2 -> v3: > - removed outcommented stuff (suggested by Heiko Thiery). > - cleaned up and simplified the makefile (suggested by Heiko Thiery). > - added patch for C++ header installation. > - added patch with fix minor copy&paste typo. > - added patch with pthread workaround for buggy toolchain/cmake/buildroot. > - added patch for `pthread_yield()`. > - passed `utils/check-package package/libmdbx/*` (suggested by Heiko Thiery) > - passed `utils/test-pkg -a -p libmdbx`, > except w/o threads & w/o MMU (suggested by Heiko Thiery). > > Changes v3 -> v4: > - fix passing BR2_PACKAGE_LIBMDBX_TOOLS option to cmake. > - fix using `depend on` instead of `select`, > and add `comment` for C++ toolchain (suggested by Heiko Thiery). > - fix minor help typo. > > Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > +N: Leonid Yuriev <leo@yuriev.ru> > +F: package/libmdbx Final / missing. > diff --git a/package/libmdbx/Config.in b/package/libmdbx/Config.in > new file mode 100644 > index 0000000000..dc36f12348 > --- /dev/null > +++ b/package/libmdbx/Config.in > @@ -0,0 +1,42 @@ > +config BR2_PACKAGE_LIBMDBX > + bool "libmdbx" > + depends on BR2_USE_MMU > + depends on BR2_TOOLCHAIN_HAS_THREADS > + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 > + depends on BR2_TOOLCHAIN_HAS_SYNC_4 > + help > + One of the fastest compact key-value ACID database > + without WAL. libmdbx has a specific set of properties > + and capabilities, focused on creating unique lightweight > + solutions. > + > + libmdbx surpasses the legendary LMDB in terms of > + reliability, features and performance. > + > + https://github.com/erthink/libmdbx > + > +if BR2_PACKAGE_LIBMDBX > + > +config BR2_PACKAGE_LIBMDBX_TOOLS > + bool "install tools" > + help > + Install libmdbx tools for checking, dump, restore > + and show statistics of databases. > + > +config BR2_PACKAGE_LIBMDBX_CXX I don't think this option is needed, just enable C++ support in the .mk file when the relevant conditions are met. > + bool "C++ API" > + depends on BR2_INSTALL_LIBSTDCPP > + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 > + help > + Enable modern C++11/14/17/20 API for libmdbx. > + > +comment "libmdbx C++ support needs a toolchain w/ C++11, gcc >= 4.8" > + depends on !BR2_INSTALL_LIBSTDCPP || \ > + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 > + > +endif > + > +comment "libmdbx needs a toolchain w/ threads, gcc >= 4.4" > + depends on BR2_USE_MMU depends on BR2_TOOLCHAIN_HAS_SYNC_4 should be added here as well. > + depends on !BR2_TOOLCHAIN_HAS_THREADS || \ > + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 > diff --git a/package/libmdbx/libmdbx.hash b/package/libmdbx/libmdbx.hash > new file mode 100644 > index 0000000000..f48cd81a7d > --- /dev/null > +++ b/package/libmdbx/libmdbx.hash > @@ -0,0 +1,2 @@ # Locally calculated > +sha256 310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569 LICENSE > +sha256 c7fb24381eb4d92f2e2edc17e577cb721269683c816c6cca307c58f6f346e786 libmdbx-amalgamated-0.9.1.tar.gz Please put the tarball hash before the license hash. > diff --git a/package/libmdbx/libmdbx.mk b/package/libmdbx/libmdbx.mk > new file mode 100644 > index 0000000000..be0c2d7b06 > --- /dev/null > +++ b/package/libmdbx/libmdbx.mk > @@ -0,0 +1,24 @@ > +################################################################################ > +# > +# libmdbx > +# > +################################################################################ > + > +LIBMDBX_VERSION = 0.9.1 > +LIBMDBX_SOURCE = libmdbx-amalgamated-$(LIBMDBX_VERSION).tar.gz > +LIBMDBX_SITE = https://github.com/erthink/libmdbx/releases/download/v$(LIBMDBX_VERSION) > +LIBMDBX_SUPPORTS_IN_SOURCE_BUILD = NO > +LIBMDBX_LICENSE = OLDAP-2.8 > +LIBMDBX_LICENSE_FILES = LICENSE > +LIBMDBX_REDISTRIBUTE = YES Not needed, this is the default. > +LIBMDBX_STRIP_COMPONENTS = 0 Quite odd, why do you generate your tarballs like this ? > +LIBMDBX_INSTALL_STAGING = YES > + > +LIBMDBX_CONF_OPTS = -DMDBX_INSTALL_MANPAGES=OFF -DBUILD_FOR_NATIVE_CPU=OFF \ > + -DMDBX_INSTALL_STATIC=$(if $(BR2_STATIC_LIBS),ON,OFF) \ > + -DMDBX_BUILD_SHARED_LIBRARY=$(if $(BR2_SHARED_LIBS),ON,OFF) \ This is not good as it doesn't account for the BR2_SHARED_STATIC_LIBS situation. So it should be: ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y) LIBMDBX_CONF_OPTS += -DMDBX_INSTALL_STATIC=ON else LIBMDBX_CONF_OPTS += -DMDBX_INSTALL_STATIC=OFF endif ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y) LIBMDBX_CONF_OPTS += -DMDBX_BUILD_SHARED_LIBRARY=ON else LIBMDBX_CONF_OPTS += -DMDBX_BUILD_SHARED_LIBRARY=OFF endif > + -DMDBX_BUILD_CXX=$(if $(BR2_PACKAGE_LIBMDBX_CXX),ON,OFF) \ > + -DMDBX_BUILD_TOOLS=$(if $(BR2_PACKAGE_LIBMDBX_TOOLS),ON,OFF) \ > + -DMDBX_LINK_TOOLS_NONSTATIC=$(if $(BR2_SHARED_LIBS),ON,OFF) Ditto here. However, the bigger problem is that it doesn't build for me. I used the following defconfig: BR2_arm=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2020.02.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_5=y BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y BR2_TOOLCHAIN_EXTERNAL_LOCALE=y # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set BR2_TOOLCHAIN_EXTERNAL_CXX=y BR2_INIT_NONE=y BR2_SYSTEM_BIN_SH_NONE=y # BR2_PACKAGE_BUSYBOX is not set BR2_PACKAGE_LIBMDBX=y BR2_PACKAGE_LIBMDBX_TOOLS=y BR2_PACKAGE_LIBMDBX_CXX=y # BR2_TARGET_ROOTFS_TAR is not set And it fails like this: In file included from /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.c++:105:0: /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:223:10: error: ‘exception_ptr’ in namespace ‘std’ does not name a type ::std::exception_ptr captured_; ^ /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++: In member function ‘bool mdbx::exception_thunk::is_clean() const’: /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2730:66: error: ‘captured_’ was not declared in this scope inline bool exception_thunk::is_clean() const noexcept { return !captured_; } ^ /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++: In member function ‘void mdbx::exception_thunk::capture()’: /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2734:3: error: ‘captured_’ was not declared in this scope captured_ = ::std::current_exception(); ^ /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2734:15: error: ‘current_exception’ is not a member of ‘std’ captured_ = ::std::current_exception(); ^ /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++: In member function ‘void mdbx::exception_thunk::rethrow_captured() const’: /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2738:7: error: ‘captured_’ was not declared in this scope if (captured_) ^ /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2739:25: error: ‘rethrow_exception’ is not a member of ‘std’ MDBX_CXX20_UNLIKELY ::std::rethrow_exception(captured_); ^ make[3]: *** [CMakeFiles/mdbx.dir/build.make:96: CMakeFiles/mdbx.dir/mdbx.c++.o] Error 1 Some older versions of gcc had an issue with exception_ptr, see BR2_TOOLCHAIN_HAS_GCC_BUG_64735. You might need to depend on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735. See other packages that have this dependency in Buildroot. Thanks! Thomas
Hi, Thomas. Thank you for the review, I will definitely take your comments and suggestions into account when preparing the next version of my patch. The next version/iteration will be based on the next release of libmdbx library, i.e. some internal patches will be dropped. I am currently working on the next release of the library, which had to be postponed due to a couple of bugs. This was the reason for the delay in my response, sorry. Regards, Leonid. On Thu, Oct 15, 2020 at 12:50 AM Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > Hello Leonid, > > Thanks for this contribution and new iteration! > > On Tue, 6 Oct 2020 22:27:09 +0300 > Leonid Yuriev <leo@yuriev.ru> wrote: > > > This patch adds libmdbx v0.9.1: > > - libmdbx is one of the fastest compact embeddable key-value ACID database. > > - libmdbx has a specific set of properties and capabilities, > > focused on creating unique lightweight solutions. > > - libmdbx surpasses the legendary LMDB (Lightning Memory-Mapped Database) > > in terms of reliability, features and performance. > > > > https://github.com/erthink/libmdbx > > > > Your Signed-off-by line should be here... and not after the changelog. > > > --- > > Changes v1 -> v2: > > - libmdbx version v0.8.2 -> v0.9.1 (released 2020-09-30) > > > > Changes v2 -> v3: > > - removed outcommented stuff (suggested by Heiko Thiery). > > - cleaned up and simplified the makefile (suggested by Heiko Thiery). > > - added patch for C++ header installation. > > - added patch with fix minor copy&paste typo. > > - added patch with pthread workaround for buggy toolchain/cmake/buildroot. > > - added patch for `pthread_yield()`. > > - passed `utils/check-package package/libmdbx/*` (suggested by Heiko Thiery) > > - passed `utils/test-pkg -a -p libmdbx`, > > except w/o threads & w/o MMU (suggested by Heiko Thiery). > > > > Changes v3 -> v4: > > - fix passing BR2_PACKAGE_LIBMDBX_TOOLS option to cmake. > > - fix using `depend on` instead of `select`, > > and add `comment` for C++ toolchain (suggested by Heiko Thiery). > > - fix minor help typo. > > > > Signed-off-by: Leonid Yuriev <leo@yuriev.ru> > > > > +N: Leonid Yuriev <leo@yuriev.ru> > > +F: package/libmdbx > > Final / missing. > > > > diff --git a/package/libmdbx/Config.in b/package/libmdbx/Config.in > > new file mode 100644 > > index 0000000000..dc36f12348 > > --- /dev/null > > +++ b/package/libmdbx/Config.in > > @@ -0,0 +1,42 @@ > > +config BR2_PACKAGE_LIBMDBX > > + bool "libmdbx" > > + depends on BR2_USE_MMU > > + depends on BR2_TOOLCHAIN_HAS_THREADS > > + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 > > + depends on BR2_TOOLCHAIN_HAS_SYNC_4 > > + help > > + One of the fastest compact key-value ACID database > > + without WAL. libmdbx has a specific set of properties > > + and capabilities, focused on creating unique lightweight > > + solutions. > > + > > + libmdbx surpasses the legendary LMDB in terms of > > + reliability, features and performance. > > + > > + https://github.com/erthink/libmdbx > > + > > +if BR2_PACKAGE_LIBMDBX > > + > > +config BR2_PACKAGE_LIBMDBX_TOOLS > > + bool "install tools" > > + help > > + Install libmdbx tools for checking, dump, restore > > + and show statistics of databases. > > + > > +config BR2_PACKAGE_LIBMDBX_CXX > > I don't think this option is needed, just enable C++ support in the .mk > file when the relevant conditions are met. > > > + bool "C++ API" > > + depends on BR2_INSTALL_LIBSTDCPP > > + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 > > + help > > + Enable modern C++11/14/17/20 API for libmdbx. > > + > > +comment "libmdbx C++ support needs a toolchain w/ C++11, gcc >= 4.8" > > + depends on !BR2_INSTALL_LIBSTDCPP || \ > > + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 > > + > > +endif > > + > > +comment "libmdbx needs a toolchain w/ threads, gcc >= 4.4" > > + depends on BR2_USE_MMU > > depends on BR2_TOOLCHAIN_HAS_SYNC_4 > > should be added here as well. > > > + depends on !BR2_TOOLCHAIN_HAS_THREADS || \ > > + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 > > diff --git a/package/libmdbx/libmdbx.hash b/package/libmdbx/libmdbx.hash > > new file mode 100644 > > index 0000000000..f48cd81a7d > > --- /dev/null > > +++ b/package/libmdbx/libmdbx.hash > > @@ -0,0 +1,2 @@ > > # Locally calculated > > > +sha256 310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569 LICENSE > > +sha256 c7fb24381eb4d92f2e2edc17e577cb721269683c816c6cca307c58f6f346e786 libmdbx-amalgamated-0.9.1.tar.gz > > Please put the tarball hash before the license hash. > > > diff --git a/package/libmdbx/libmdbx.mk b/package/libmdbx/libmdbx.mk > > new file mode 100644 > > index 0000000000..be0c2d7b06 > > --- /dev/null > > +++ b/package/libmdbx/libmdbx.mk > > @@ -0,0 +1,24 @@ > > +################################################################################ > > +# > > +# libmdbx > > +# > > +################################################################################ > > + > > +LIBMDBX_VERSION = 0.9.1 > > +LIBMDBX_SOURCE = libmdbx-amalgamated-$(LIBMDBX_VERSION).tar.gz > > +LIBMDBX_SITE = https://github.com/erthink/libmdbx/releases/download/v$(LIBMDBX_VERSION) > > +LIBMDBX_SUPPORTS_IN_SOURCE_BUILD = NO > > +LIBMDBX_LICENSE = OLDAP-2.8 > > +LIBMDBX_LICENSE_FILES = LICENSE > > +LIBMDBX_REDISTRIBUTE = YES > > Not needed, this is the default. > > > +LIBMDBX_STRIP_COMPONENTS = 0 > > Quite odd, why do you generate your tarballs like this ? > > > +LIBMDBX_INSTALL_STAGING = YES > > + > > +LIBMDBX_CONF_OPTS = -DMDBX_INSTALL_MANPAGES=OFF -DBUILD_FOR_NATIVE_CPU=OFF \ > > + -DMDBX_INSTALL_STATIC=$(if $(BR2_STATIC_LIBS),ON,OFF) \ > > + -DMDBX_BUILD_SHARED_LIBRARY=$(if $(BR2_SHARED_LIBS),ON,OFF) \ > > This is not good as it doesn't account for the BR2_SHARED_STATIC_LIBS > situation. So it should be: > > ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y) > LIBMDBX_CONF_OPTS += -DMDBX_INSTALL_STATIC=ON > else > LIBMDBX_CONF_OPTS += -DMDBX_INSTALL_STATIC=OFF > endif > > ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y) > LIBMDBX_CONF_OPTS += -DMDBX_BUILD_SHARED_LIBRARY=ON > else > LIBMDBX_CONF_OPTS += -DMDBX_BUILD_SHARED_LIBRARY=OFF > endif > > > > + -DMDBX_BUILD_CXX=$(if $(BR2_PACKAGE_LIBMDBX_CXX),ON,OFF) \ > > + -DMDBX_BUILD_TOOLS=$(if $(BR2_PACKAGE_LIBMDBX_TOOLS),ON,OFF) \ > > + -DMDBX_LINK_TOOLS_NONSTATIC=$(if $(BR2_SHARED_LIBS),ON,OFF) > > Ditto here. > > > However, the bigger problem is that it doesn't build for me. I used the > following defconfig: > > BR2_arm=y > BR2_TOOLCHAIN_EXTERNAL=y > BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y > BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y > BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2020.02.tar.bz2" > BR2_TOOLCHAIN_EXTERNAL_GCC_5=y > BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y > BR2_TOOLCHAIN_EXTERNAL_LOCALE=y > # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set > BR2_TOOLCHAIN_EXTERNAL_CXX=y > BR2_INIT_NONE=y > BR2_SYSTEM_BIN_SH_NONE=y > # BR2_PACKAGE_BUSYBOX is not set > BR2_PACKAGE_LIBMDBX=y > BR2_PACKAGE_LIBMDBX_TOOLS=y > BR2_PACKAGE_LIBMDBX_CXX=y > # BR2_TARGET_ROOTFS_TAR is not set > > And it fails like this: > > In file included from /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.c++:105:0: > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:223:10: error: ‘exception_ptr’ in namespace ‘std’ does not name a type > ::std::exception_ptr captured_; > ^ > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++: In member function ‘bool mdbx::exception_thunk::is_clean() const’: > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2730:66: error: ‘captured_’ was not declared in this scope > inline bool exception_thunk::is_clean() const noexcept { return !captured_; } > ^ > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++: In member function ‘void mdbx::exception_thunk::capture()’: > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2734:3: error: ‘captured_’ was not declared in this scope > captured_ = ::std::current_exception(); > ^ > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2734:15: error: ‘current_exception’ is not a member of ‘std’ > captured_ = ::std::current_exception(); > ^ > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++: In member function ‘void mdbx::exception_thunk::rethrow_captured() const’: > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2738:7: error: ‘captured_’ was not declared in this scope > if (captured_) > ^ > /home/thomas/projets/buildroot/output/build/libmdbx-0.9.1/mdbx.h++:2739:25: error: ‘rethrow_exception’ is not a member of ‘std’ > MDBX_CXX20_UNLIKELY ::std::rethrow_exception(captured_); > ^ > make[3]: *** [CMakeFiles/mdbx.dir/build.make:96: CMakeFiles/mdbx.dir/mdbx.c++.o] Error 1 > > Some older versions of gcc had an issue with exception_ptr, see > BR2_TOOLCHAIN_HAS_GCC_BUG_64735. You might need to depend on > !BR2_TOOLCHAIN_HAS_GCC_BUG_64735. See other packages that have this > dependency in Buildroot. > > Thanks! > > Thomas > -- > Thomas Petazzoni, CTO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com
diff --git a/DEVELOPERS b/DEVELOPERS index f8655fa054..924e70e30c 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1551,6 +1551,9 @@ N: Leon Anavi <leon.anavi@konsulko.com> F: board/olimex/a10_olinuxino F: configs/olimex_a10_olinuxino_lime_defconfig +N: Leonid Yuriev <leo@yuriev.ru> +F: package/libmdbx + N: Lionel Flandrin <lionel@svkt.org> F: package/python-babel/ F: package/python-daemonize/ diff --git a/package/Config.in b/package/Config.in index 51583d07d6..f87e0388a0 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1370,6 +1370,7 @@ menu "Database" source "package/kompexsqlite/Config.in" source "package/leveldb/Config.in" source "package/libgit2/Config.in" + source "package/libmdbx/Config.in" source "package/libodb/Config.in" source "package/libodb-boost/Config.in" source "package/libodb-mysql/Config.in" diff --git a/package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch b/package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch new file mode 100644 index 0000000000..d9ff3c5e71 --- /dev/null +++ b/package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch @@ -0,0 +1,27 @@ +From 5807e2eda046bff35946972289236bbef5c0c597 Mon Sep 17 00:00:00 2001 +From: Leonid Yuriev <leo@yuriev.ru> +Date: Thu, 1 Oct 2020 02:27:29 +0300 +Subject: [PATCH] mdbx++: fix minor copy&paste typo. + +Change-Id: I0af3e7ffbbd1231069a60f9f48880df3df2141d7 +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> +--- + mdbx.h++ | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mdbx.h++ b/mdbx.h++ +index 095ff9abb..2050f4b92 100644 +--- a/mdbx.h++ ++++ b/mdbx.h++ +@@ -538,7 +538,7 @@ struct LIBMDBX_API_TYPE slice : public ::MDBX_val { + byte *from_base58(byte *dest, size_t dest_size, + bool ignore_spaces = false) const; + +- /// vReturns the buffer size in bytes needed for conversion ++ /// \brief Returns the buffer size in bytes needed for conversion + /// [Base58](https://en.wikipedia.org/wiki/Base58) dump to data. + MDBX_CXX11_CONSTEXPR size_t from_base58_bytes() const noexcept { + return length() / 11 * 8 + length() % 11 * 32 / 43; +-- +2.28.0 + diff --git a/package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch b/package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch new file mode 100644 index 0000000000..df49342ccb --- /dev/null +++ b/package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch @@ -0,0 +1,54 @@ +From dc2cd19d566e84451ee47cf04277f97bc22771c5 Mon Sep 17 00:00:00 2001 +From: Leonid Yuriev <leo@yuriev.ru> +Date: Fri, 2 Oct 2020 00:05:02 +0300 +Subject: [PATCH] mdbx-cmake: fix missing installation of `mdbx.h++` + +Change-Id: I41975e4eeff6583a266b273b9a4f8486982ede90 +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> +--- + CMakeLists.txt | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 28db425c5..95f116521 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -485,7 +485,8 @@ fetch_version(MDBX "${CMAKE_CURRENT_SOURCE_DIR}" FALSE) + message(STATUS "libmdbx version is ${MDBX_VERSION}") + + # sources list +-set(LIBMDBX_SOURCES mdbx.h "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) ++set(LIBMDBX_PUBLIC_HEADERS mdbx.h) ++set(LIBMDBX_SOURCES mdbx.h "${CMAKE_CURRENT_BINARY_DIR}/config.h") + if(MDBX_AMALGAMATED_SOURCE) + list(APPEND LIBMDBX_SOURCES mdbx.c) + else() +@@ -511,6 +512,7 @@ else() + endif(MDBX_AMALGAMATED_SOURCE) + if(MDBX_BUILD_CXX) + message(STATUS "Use C${MDBX_C_STANDARD} and C++${MDBX_CXX_STANDARD} for libmdbx") ++ list(APPEND LIBMDBX_PUBLIC_HEADERS mdbx.h++) + list(APPEND LIBMDBX_SOURCES "${MDBX_SOURCE_DIR}/mdbx.c++" mdbx.h++) + else() + message(STATUS "Use C${MDBX_C_STANDARD} for libmdbx but C++ portion is disabled") +@@ -561,7 +563,7 @@ if(MDBX_INSTALL_STATIC) + else() + add_library(mdbx-static STATIC EXCLUDE_FROM_ALL ${LIBMDBX_SOURCES}) + endif() +-set_target_properties(mdbx-static PROPERTIES PUBLIC_HEADER mdbx.h) ++set_target_properties(mdbx-static PROPERTIES PUBLIC_HEADER "${LIBMDBX_PUBLIC_HEADERS}") + target_compile_definitions(mdbx-static PRIVATE MDBX_BUILD_SHARED_LIBRARY=0) + target_setup_options(mdbx-static) + libmdbx_setup_libs(mdbx-static INTERFACE) +@@ -576,7 +578,7 @@ endif() + # build shared library + if(MDBX_BUILD_SHARED_LIBRARY) + add_library(mdbx SHARED ${LIBMDBX_SOURCES}) +- set_target_properties(mdbx PROPERTIES PUBLIC_HEADER mdbx.h) ++ set_target_properties(mdbx PROPERTIES PUBLIC_HEADER "${LIBMDBX_PUBLIC_HEADERS}") + target_compile_definitions(mdbx PRIVATE LIBMDBX_EXPORTS MDBX_BUILD_SHARED_LIBRARY=1 INTERFACE LIBMDBX_IMPORTS) + target_setup_options(mdbx) + libmdbx_setup_libs(mdbx PRIVATE) +-- +2.28.0 + diff --git a/package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch b/package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch new file mode 100644 index 0000000000..cb04334220 --- /dev/null +++ b/package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch @@ -0,0 +1,27 @@ +From 280ed17ea2dff464c9688fcc92079f36d8b74621 Mon Sep 17 00:00:00 2001 +From: Leonid Yuriev <leo@yuriev.ru> +Date: Sat, 3 Oct 2020 11:35:26 +0300 +Subject: [PATCH] mdbx: fix obsolete `__noreturn`. + +Change-Id: Ic78843d6f16de2a409c16ceecc7acb2ed8aa3e68 +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> +--- + mdbx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mdbx.c b/mdbx.c +index 04ea5140d..9212640fe 100644 +--- a/mdbx.c ++++ b/mdbx.c +@@ -141,7 +141,7 @@ __extern_C void __assert(const char *, const char *, unsigned int, const char *) + #else + __nothrow + #endif /* __THROW */ +- __noreturn; ++ MDBX_NORETURN; + #define __assert_fail(assertion, file, line, function) \ + __assert(assertion, file, line, function) + +-- +2.28.0 + diff --git a/package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch b/package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch new file mode 100644 index 0000000000..23f91d859b --- /dev/null +++ b/package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch @@ -0,0 +1,28 @@ +From 70b615e8d4d10cda2d961a815dd15eb87a1f3925 Mon Sep 17 00:00:00 2001 +From: Leonid Yuriev <leo@yuriev.ru> +Date: Sun, 4 Oct 2020 14:54:11 +0300 +Subject: [PATCH] mdbx: don't use `yield` instruction on ARM if unsupported. + +Change-Id: I0b01d783fe4336b089f4b051fb61c203b5879aa5 +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> +--- + mdbx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/mdbx.c b/mdbx.c +index aba445424..a9ba1ee85 100644 +--- a/mdbx.c ++++ b/mdbx.c +@@ -763,7 +763,8 @@ static __always_inline void atomic_yield(void) { + #else + __asm__ __volatile__("hint @pause"); + #endif +-#elif defined(__arm__) || defined(__aarch64__) ++#elif defined(__aarch64__) || (defined(__ARM_ARCH) && __ARM_ARCH > 6) || \ ++ defined(__ARM_ARCH_6K__) + #ifdef __CC_ARM + __yield(); + #else +-- +2.28.0 + diff --git a/package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch b/package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch new file mode 100644 index 0000000000..29d69e3faa --- /dev/null +++ b/package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch @@ -0,0 +1,27 @@ +From 8d4e7994c0c5c0cf69326139717e324f90bff65b Mon Sep 17 00:00:00 2001 +From: Leonid Yuriev <leo@yuriev.ru> +Date: Mon, 5 Oct 2020 15:09:10 +0300 +Subject: [PATCH] mdbx-load: fix minor false-positive GCC warning. + +Change-Id: Ie75c793712d050e8d3da76a4d0a8df9b81dc5275 +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> +--- + mdbx_load.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mdbx_load.c b/mdbx_load.c +index e5e72fc8f..54e179553 100644 +--- a/mdbx_load.c ++++ b/mdbx_load.c +@@ -318,7 +318,7 @@ static int readhdr(void) { + } + + for (int i = 0; dbflags[i].bit; i++) { +- bool value; ++ bool value = false; + if (valbool(dbuf.iov_base, dbflags[i].name, &value)) { + if (value) + dbi_flags |= dbflags[i].bit; +-- +2.28.0 + diff --git a/package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch b/package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch new file mode 100644 index 0000000000..37525cf0d5 --- /dev/null +++ b/package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch @@ -0,0 +1,65 @@ +From 787eaaa373073e17f3a53658b085c255bc2c8ff8 Mon Sep 17 00:00:00 2001 +From: Leonid Yuriev <leo@yuriev.ru> +Date: Mon, 5 Oct 2020 19:12:20 +0300 +Subject: [PATCH] mdbx-cmake: pthread workaround for buggy + toolchain/cmake/buildroot. + +Change-Id: I0d95e783abbd10a63cd1595a9de50593e814a967 +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> +--- + CMakeLists.txt | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 95f116521..20a50a453 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -173,10 +173,27 @@ if(NOT CMAKE_BUILD_TYPE) + endif() + string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE) + ++set(CMAKE_THREAD_PREFER_PTHREAD TRUE) ++set(THREADS_PREFER_PTHREAD_FLAG TRUE) ++find_package(Threads REQUIRED) ++ + include(cmake/utils.cmake) + include(cmake/compiler.cmake) + include(cmake/profile.cmake) + ++# Workaround for `-pthread` toolchain/cmake bug ++if(NOT APPLE AND NOT MSVC ++ AND CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_THREAD_LIBS_INIT ++ AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)) ++ check_compiler_flag("-pthread" CC_HAS_PTHREAD) ++ if(CC_HAS_PTHREAD AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-pthread") ++ message(STATUS "Force add -pthread for linker flags to avoid troubles") ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread") ++ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pthread") ++ endif() ++endif() ++ + CHECK_FUNCTION_EXISTS(pow NOT_NEED_LIBM) + if(NOT_NEED_LIBM) + set(LIB_MATH "") +@@ -190,8 +207,6 @@ else() + endif() + endif() + +-find_package(Threads REQUIRED) +- + if(SUBPROJECT) + if(NOT DEFINED BUILD_SHARED_LIBS) + option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)" OFF) +@@ -541,7 +556,7 @@ macro(target_setup_options TARGET) + endmacro() + + macro(libmdbx_setup_libs TARGET MODE) +- target_link_libraries(${TARGET} ${MODE} ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries(${TARGET} ${MODE} Threads::Threads) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(${TARGET} ${MODE} ntdll.lib) + if(MDBX_NTDLL_EXTRA_IMPLIB AND MDBX_AVOID_CRT) +-- +2.28.0 + diff --git a/package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch b/package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch new file mode 100644 index 0000000000..5d7e83d4c7 --- /dev/null +++ b/package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch @@ -0,0 +1,42 @@ +From 16d43332a9d28ba27aa3d127e8f6b77a87b2f5eb Mon Sep 17 00:00:00 2001 +From: Leonid Yuriev <leo@yuriev.ru> +Date: Mon, 5 Oct 2020 21:08:09 +0300 +Subject: [PATCH] mdbx: fix `pthread_yield()` for non-GLIBC. + +Change-Id: I080e37a42b62e524896dea8747e9f23e2fcd584f +Signed-off-by: Leonid Yuriev <leo@yuriev.ru> +--- + mdbx.c | 4 +++- + mdbx.c | 1 + + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/mdbx.c b/mdbx.c +index a9ba1ee85..ace6f2756 100644 +--- a/mdbx.c ++++ b/mdbx.c +@@ -777,7 +777,9 @@ static __always_inline void atomic_yield(void) { + defined(__mips64__) || defined(_M_MRX000) || defined(_MIPS_) || \ + defined(__MWERKS__) || defined(__sgi) + __asm__ __volatile__(".word 0x00000140"); +-#else ++#elif defined(__linux__) || defined(__gnu_linux__) || defined(_UNIX03_SOURCE) ++ sched_yield(); ++#elif (defined(_GNU_SOURCE) && __GLIBC_PREREQ(2, 1)) || defined(_OPEN_THREADS) + pthread_yield(); + #endif + } +diff --git a/mdbx.c b/mdbx.c +index 3509942dc..3af23ce0b 100644 +--- a/mdbx.c ++++ b/mdbx.c +@@ -119,6 +119,7 @@ + + #if defined(__linux__) || defined(__gnu_linux__) + #include <linux/sysctl.h> ++#include <sched.h> + #include <sys/sendfile.h> + #include <sys/statfs.h> + #endif /* Linux */ +-- +2.28.0 + diff --git a/package/libmdbx/Config.in b/package/libmdbx/Config.in new file mode 100644 index 0000000000..dc36f12348 --- /dev/null +++ b/package/libmdbx/Config.in @@ -0,0 +1,42 @@ +config BR2_PACKAGE_LIBMDBX + bool "libmdbx" + depends on BR2_USE_MMU + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 + depends on BR2_TOOLCHAIN_HAS_SYNC_4 + help + One of the fastest compact key-value ACID database + without WAL. libmdbx has a specific set of properties + and capabilities, focused on creating unique lightweight + solutions. + + libmdbx surpasses the legendary LMDB in terms of + reliability, features and performance. + + https://github.com/erthink/libmdbx + +if BR2_PACKAGE_LIBMDBX + +config BR2_PACKAGE_LIBMDBX_TOOLS + bool "install tools" + help + Install libmdbx tools for checking, dump, restore + and show statistics of databases. + +config BR2_PACKAGE_LIBMDBX_CXX + bool "C++ API" + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + help + Enable modern C++11/14/17/20 API for libmdbx. + +comment "libmdbx C++ support needs a toolchain w/ C++11, gcc >= 4.8" + depends on !BR2_INSTALL_LIBSTDCPP || \ + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + +endif + +comment "libmdbx needs a toolchain w/ threads, gcc >= 4.4" + depends on BR2_USE_MMU + depends on !BR2_TOOLCHAIN_HAS_THREADS || \ + !BR2_TOOLCHAIN_GCC_AT_LEAST_4_4 diff --git a/package/libmdbx/libmdbx.hash b/package/libmdbx/libmdbx.hash new file mode 100644 index 0000000000..f48cd81a7d --- /dev/null +++ b/package/libmdbx/libmdbx.hash @@ -0,0 +1,2 @@ +sha256 310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569 LICENSE +sha256 c7fb24381eb4d92f2e2edc17e577cb721269683c816c6cca307c58f6f346e786 libmdbx-amalgamated-0.9.1.tar.gz diff --git a/package/libmdbx/libmdbx.mk b/package/libmdbx/libmdbx.mk new file mode 100644 index 0000000000..be0c2d7b06 --- /dev/null +++ b/package/libmdbx/libmdbx.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# libmdbx +# +################################################################################ + +LIBMDBX_VERSION = 0.9.1 +LIBMDBX_SOURCE = libmdbx-amalgamated-$(LIBMDBX_VERSION).tar.gz +LIBMDBX_SITE = https://github.com/erthink/libmdbx/releases/download/v$(LIBMDBX_VERSION) +LIBMDBX_SUPPORTS_IN_SOURCE_BUILD = NO +LIBMDBX_LICENSE = OLDAP-2.8 +LIBMDBX_LICENSE_FILES = LICENSE +LIBMDBX_REDISTRIBUTE = YES +LIBMDBX_STRIP_COMPONENTS = 0 +LIBMDBX_INSTALL_STAGING = YES + +LIBMDBX_CONF_OPTS = -DMDBX_INSTALL_MANPAGES=OFF -DBUILD_FOR_NATIVE_CPU=OFF \ + -DMDBX_INSTALL_STATIC=$(if $(BR2_STATIC_LIBS),ON,OFF) \ + -DMDBX_BUILD_SHARED_LIBRARY=$(if $(BR2_SHARED_LIBS),ON,OFF) \ + -DMDBX_BUILD_CXX=$(if $(BR2_PACKAGE_LIBMDBX_CXX),ON,OFF) \ + -DMDBX_BUILD_TOOLS=$(if $(BR2_PACKAGE_LIBMDBX_TOOLS),ON,OFF) \ + -DMDBX_LINK_TOOLS_NONSTATIC=$(if $(BR2_SHARED_LIBS),ON,OFF) + +$(eval $(cmake-package))
This patch adds libmdbx v0.9.1: - libmdbx is one of the fastest compact embeddable key-value ACID database. - libmdbx has a specific set of properties and capabilities, focused on creating unique lightweight solutions. - libmdbx surpasses the legendary LMDB (Lightning Memory-Mapped Database) in terms of reliability, features and performance. https://github.com/erthink/libmdbx --- Changes v1 -> v2: - libmdbx version v0.8.2 -> v0.9.1 (released 2020-09-30) Changes v2 -> v3: - removed outcommented stuff (suggested by Heiko Thiery). - cleaned up and simplified the makefile (suggested by Heiko Thiery). - added patch for C++ header installation. - added patch with fix minor copy&paste typo. - added patch with pthread workaround for buggy toolchain/cmake/buildroot. - added patch for `pthread_yield()`. - passed `utils/check-package package/libmdbx/*` (suggested by Heiko Thiery) - passed `utils/test-pkg -a -p libmdbx`, except w/o threads & w/o MMU (suggested by Heiko Thiery). Changes v3 -> v4: - fix passing BR2_PACKAGE_LIBMDBX_TOOLS option to cmake. - fix using `depend on` instead of `select`, and add `comment` for C++ toolchain (suggested by Heiko Thiery). - fix minor help typo. Signed-off-by: Leonid Yuriev <leo@yuriev.ru> --- DEVELOPERS | 3 + package/Config.in | 1 + .../0001-mdbx-fix-minor-copy-paste-typo.patch | 27 ++++++++ ...e-fix-missing-installation-of-mdbx.h.patch | 54 +++++++++++++++ .../0003-mdbx-fix-obsolete-__noreturn.patch | 27 ++++++++ ...ield-instruction-on-ARM-if-unsupport.patch | 28 ++++++++ ...fix-minor-false-positive-GCC-warning.patch | 27 ++++++++ ...ad-workaround-for-buggy-toolchain-cm.patch | 65 +++++++++++++++++++ ...mdbx-fix-pthread_yield-for-non-GLIBC.patch | 42 ++++++++++++ package/libmdbx/Config.in | 42 ++++++++++++ package/libmdbx/libmdbx.hash | 2 + package/libmdbx/libmdbx.mk | 24 +++++++ 12 files changed, 342 insertions(+) create mode 100644 package/libmdbx/0001-mdbx-fix-minor-copy-paste-typo.patch create mode 100644 package/libmdbx/0002-mdbx-cmake-fix-missing-installation-of-mdbx.h.patch create mode 100644 package/libmdbx/0003-mdbx-fix-obsolete-__noreturn.patch create mode 100644 package/libmdbx/0004-mdbx-don-t-use-yield-instruction-on-ARM-if-unsupport.patch create mode 100644 package/libmdbx/0005-mdbx-load-fix-minor-false-positive-GCC-warning.patch create mode 100644 package/libmdbx/0006-mdbx-cmake-pthread-workaround-for-buggy-toolchain-cm.patch create mode 100644 package/libmdbx/0007-mdbx-fix-pthread_yield-for-non-GLIBC.patch create mode 100644 package/libmdbx/Config.in create mode 100644 package/libmdbx/libmdbx.hash create mode 100644 package/libmdbx/libmdbx.mk