mirror of
https://gitflic.ru/project/erthink/libmdbx.git
synced 2026-07-14 18:46:08 +00:00
mdbx: deduplicate/reduce amalgamated source code (v0.14.1-356-gadaf1352).
2026-01-28 mdbx: extract `wingetopt` into separated amalgamated file because of different licence. 2026-01-28 mdbx-cmake: update headed notice. 2026-01-28 mdbx: add `amalgam.in` header. 2026-01-28 mdbx-make: fix LDFLAGS for tools. 2026-01-28 mdbx-make: filter-out 'pragma once' from C++-probe. 2026-01-28 mdbx-test: drop unused code. 2026-01-28 mdbx: deduplicate/reduce amalgamated source code. 2026-01-28 mdbx: refine 64x64-to-128 multiplication. 2026-01-27 mdbx-make: cutoff useless C-portion of code from amalgamated `mdbx.c++`
This commit is contained in:
-47
@@ -1,47 +0,0 @@
|
||||
*[~#]
|
||||
@*
|
||||
*.[ao]
|
||||
*.autosave
|
||||
*.bak
|
||||
@buildflags.tag
|
||||
build.ninja
|
||||
cmake-build-*
|
||||
CMakeCache.txt
|
||||
CMakeFiles/
|
||||
cmake_install.cmake
|
||||
CMakeLists.txt.user
|
||||
config-cmake.h
|
||||
config-gnumake.h
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
*.dll
|
||||
*.dSYM
|
||||
*.dylib
|
||||
*.err
|
||||
*.exe
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.gcov
|
||||
.idea
|
||||
libmdbx.creator.user
|
||||
*.lo
|
||||
mdbx_chk
|
||||
mdbx_copy
|
||||
mdbx_drop
|
||||
mdbx_dump
|
||||
mdbx_legacy_example
|
||||
mdbx_modern_example
|
||||
mdbx_load
|
||||
mdbx_stat
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
*.orig
|
||||
*.rej
|
||||
*.so
|
||||
*.tar*
|
||||
Testing/
|
||||
tmp.db
|
||||
tmp.db-lck
|
||||
valgrind.*
|
||||
.vs/
|
||||
.vscode/
|
||||
+16
-10
@@ -1,15 +1,16 @@
|
||||
# Copyright (c) 2020-2026 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> ###############################################
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Donations are welcome to ETH `0xD104d8f8B2dC312aaD74899F83EBf3EEBDC1EA3A`,
|
||||
# libmdbx (aka MDBX) is an extremely fast, compact, powerful, embeddedable, transactional key-value storage engine with
|
||||
# open-source code. MDBX has a specific set of properties and capabilities, focused on creating unique lightweight
|
||||
# solutions. Please visit https://libmdbx.dqdkfa.ru for more information, changelog, documentation, C++ API description
|
||||
# and links to the original git repo with the source code. Questions, feedback and suggestions are welcome to the
|
||||
# Telegram' group https://t.me/libmdbx.
|
||||
#
|
||||
# The libmdbx code will forever remain open and with high-quality free support, as far as the life circumstances of the
|
||||
# project participants allow. Donations are welcome to ETH `0xD104d8f8B2dC312aaD74899F83EBf3EEBDC1EA3A`,
|
||||
# BTC `bc1qzvl9uegf2ea6cwlytnanrscyv8snwsvrc0xfsu`, SOL `FTCTgbHajoLVZGr8aEFWMzx3NDMyS5wXJgfeMTmJznRi`.
|
||||
# Всё будет хорошо!
|
||||
|
||||
# libmdbx = { Revised and extended descendant of Symas LMDB. }
|
||||
# Please see README.md at https://sourcecraft.dev/dqdkfa/libmdbx
|
||||
#
|
||||
# Libmdbx is superior to LMDB in terms of features and reliability, not inferior in performance. libmdbx works on Linux,
|
||||
# FreeBSD, MacOS X and other systems compliant with POSIX.1-2008, but also support Windows as a complementary platform.
|
||||
#
|
||||
# The next version is under active non-public development and will be released as MithrilDB and libmithrildb for
|
||||
# libraries & packages. Admittedly mythical Mithril is resembling silver but being stronger and lighter than steel.
|
||||
@@ -62,6 +63,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.json"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mdbx.c"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mdbx.c++"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mdbx.h"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mdbx-internals.h"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mdbx.h++"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mdbx_chk.c"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mdbx_copy.c"
|
||||
@@ -758,14 +760,18 @@ endif()
|
||||
|
||||
# build mdbx-tools
|
||||
if(MDBX_BUILD_TOOLS)
|
||||
set(WINGETOPT_SRC "")
|
||||
if(WIN32)
|
||||
if(MDBX_AMALGAMATED_SOURCE)
|
||||
set(WINGETOPT_SRC ${MDBX_SOURCE_DIR}/mdbx-wingetopt.h)
|
||||
else()
|
||||
set(WINGETOPT_SRC ${MDBX_SOURCE_DIR}/tools/wingetopt.c ${MDBX_SOURCE_DIR}/tools/wingetopt.h)
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
set(WINGETOPT_SRC "")
|
||||
endif()
|
||||
|
||||
foreach(TOOL chk copy stat dump load drop)
|
||||
if(MDBX_AMALGAMATED_SOURCE)
|
||||
add_executable(mdbx_${TOOL} mdbx.h ${MDBX_SOURCE_DIR}/mdbx_${TOOL}.c)
|
||||
add_executable(mdbx_${TOOL} mdbx.h ${MDBX_SOURCE_DIR}/mdbx_${TOOL}.c ${WINGETOPT_SRC})
|
||||
else()
|
||||
add_executable(mdbx_${TOOL} mdbx.h ${MDBX_SOURCE_DIR}/tools/${TOOL}.c ${WINGETOPT_SRC})
|
||||
endif()
|
||||
|
||||
+10
-10
@@ -78,12 +78,12 @@ ifneq ($(make_ge_4_1),1)
|
||||
# don't use variable expansion trick as workaround for bugs of GNU Make before 4.1
|
||||
LIBS ?= $(shell $(uname2libs))
|
||||
LDFLAGS ?= $(shell $(uname2ldflags))
|
||||
LIB_STDCXXFS ?= $(shell echo '$(cxx_filesystem_probe)' | cat mdbx.h++ - | sed $$'1s/\xef\xbb\xbf//' | $(CXX) -x c++ $(CXXFLAGS) -Wno-error - -Wl,--allow-multiple-definition -lstdc++fs $(LIBS) $(LDFLAGS) $(EXE_LDFLAGS) -o /dev/null 2>probe4lstdfs.err >/dev/null && echo '-Wl,--allow-multiple-definition -lstdc++fs')
|
||||
LIB_STDCXXFS ?= $(shell echo '$(cxx_filesystem_probe)' | cat mdbx.h++ - | sed $$'1s/\xef\xbb\xbf//' | grep -v 'pragma once' | $(CXX) -x c++ $(CXXFLAGS) -Wno-error - -Wl,--allow-multiple-definition -lstdc++fs $(LIBS) $(LDFLAGS) $(EXE_LDFLAGS) -o /dev/null 2>probe4lstdfs.err >/dev/null && echo '-Wl,--allow-multiple-definition -lstdc++fs')
|
||||
else
|
||||
# using variable expansion trick to avoid repeaded probes
|
||||
LIBS ?= $(eval LIBS := $$(shell $$(uname2libs)))$(LIBS)
|
||||
LDFLAGS ?= $(eval LDFLAGS := $$(shell $$(uname2ldflags)))$(LDFLAGS)
|
||||
LIB_STDCXXFS ?= $(eval LIB_STDCXXFS := $$(shell echo '$$(cxx_filesystem_probe)' | cat mdbx.h++ - | sed $$$$'1s/\xef\xbb\xbf//' | $(CXX) -x c++ $(CXXFLAGS) -Wno-error - -Wl,--allow-multiple-definition -lstdc++fs $(LIBS) $(LDFLAGS) $(EXE_LDFLAGS) -o /dev/null 2>probe4lstdfs.err >/dev/null && echo '-Wl,--allow-multiple-definition -lstdc++fs'))$(LIB_STDCXXFS)
|
||||
LIB_STDCXXFS ?= $(eval LIB_STDCXXFS := $$(shell echo '$$(cxx_filesystem_probe)' | cat mdbx.h++ - | sed $$$$'1s/\xef\xbb\xbf//' | grep -v '#pragma once' | $(CXX) -x c++ $(CXXFLAGS) -Wno-error - -Wl,--allow-multiple-definition -lstdc++fs $(LIBS) $(LDFLAGS) $(EXE_LDFLAGS) -o /dev/null 2>probe4lstdfs.err >/dev/null && echo '-Wl,--allow-multiple-definition -lstdc++fs'))$(LIB_STDCXXFS)
|
||||
endif
|
||||
|
||||
ifneq ($(make_ge_4_4),1)
|
||||
@@ -347,34 +347,34 @@ config-gnumake.h: @buildflags.tag mdbx.c $(lastword $(MAKEFILE_LIST)) LICENSE NO
|
||||
&& echo '#define MDBX_BUILD_METADATA "$(MDBX_BUILD_METADATA)"' \
|
||||
) >$@
|
||||
|
||||
mdbx-dylib.o: config-gnumake.h mdbx.c mdbx.h $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
mdbx-dylib.o: config-gnumake.h mdbx.c mdbx.h mdbx-internals.h $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
@echo ' CC $@'
|
||||
$(QUIET)$(CC) $(CFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' -DLIBMDBX_EXPORTS=1 -c mdbx.c -o $@
|
||||
|
||||
mdbx-static.o: config-gnumake.h mdbx.c mdbx.h $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
mdbx-static.o: config-gnumake.h mdbx.c mdbx.h mdbx-internals.h $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
@echo ' CC $@'
|
||||
$(QUIET)$(CC) $(CFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' -ULIBMDBX_EXPORTS -c mdbx.c -o $@
|
||||
|
||||
mdbx++-dylib.o: config-gnumake.h mdbx.c++ $(HEADERS) $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
mdbx++-dylib.o: config-gnumake.h mdbx.c++ $(HEADERS) mdbx-internals.h $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
@echo ' CC $@'
|
||||
$(QUIET)$(CXX) $(CXXFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' -DLIBMDBX_EXPORTS=1 -c mdbx.c++ -o $@
|
||||
|
||||
mdbx++-static.o: config-gnumake.h mdbx.c++ $(HEADERS) $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
mdbx++-static.o: config-gnumake.h mdbx.c++ $(HEADERS) mdbx-internals.h $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE COPYRIGHT
|
||||
@echo ' CC $@'
|
||||
$(QUIET)$(CXX) $(CXXFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' -ULIBMDBX_EXPORTS -c mdbx.c++ -o $@
|
||||
|
||||
mdbx_%: mdbx_%.c mdbx-static.o
|
||||
mdbx_%: mdbx_%.c mdbx-static.o mdbx-wingetopt.h
|
||||
@echo ' CC+LD $@'
|
||||
$(QUIET)$(CC) $(CFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' $^ $(EXE_LDFLAGS) $(LIBS) -o $@
|
||||
$(QUIET)$(CC) $(CFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' $< mdbx-static.o $(LDFLAGS) $(EXE_LDFLAGS) $(LIBS) -o $@
|
||||
|
||||
mdbx_%.static: mdbx_%.c mdbx-static.o
|
||||
@echo ' CC+LD $@'
|
||||
$(QUIET)$(CC) $(CFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' $^ $(EXE_LDFLAGS) -static -Wl,--strip-all -o $@
|
||||
$(QUIET)$(CC) $(CFLAGS) $(MDBX_BUILD_OPTIONS) '-DMDBX_CONFIG_H="config-gnumake.h"' $^ $(LDFLAGS) $(EXE_LDFLAGS) -static -Wl,--strip-all -o $@
|
||||
|
||||
mdbx_%.static-lto: mdbx_%.c config-gnumake.h mdbx.c mdbx.h
|
||||
@echo ' CC+LD $@'
|
||||
$(QUIET)$(CC) $(CFLAGS) -Os -flto $(MDBX_BUILD_OPTIONS) '-DLIBMDBX_API=' '-DMDBX_CONFIG_H="config-gnumake.h"' \
|
||||
$< mdbx.c $(EXE_LDFLAGS) $(LIBS) -static -Wl,--strip-all -o $@
|
||||
$< mdbx.c $(LDFLAGS) $(EXE_LDFLAGS) $(LIBS) -static -Wl,--strip-all -o $@
|
||||
|
||||
check smoke: test
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{ "git_describe": "v0.14.1-347-g34df8a6f", "git_timestamp": "2026-01-27T16:33:56+03:00", "git_tree": "93d7d95077dd6ce88eabe1259347e95ad56c5bd3", "git_commit": "34df8a6fcd56785fa2309daa0887eebff4f7b7c7", "semver": "0.14.1.347" }
|
||||
{ "git_describe": "v0.14.1-356-gadaf1352", "git_timestamp": "2026-01-29T18:08:07+03:00", "git_tree": "246a9ed8d7ad2d018c9bb365d96efd954af8debd", "git_commit": "adaf135226e1d53dd5cf49e1cba09eea202b32b2", "semver": "0.14.1.356" }
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
/* This is CMake-template for libmdbx's config.h
|
||||
/* This file is part of the libmdbx amalgamated source code (v0.14.1-356-gadaf1352 at 2026-01-29T18:08:07+03:00),
|
||||
* it is the template for libmdbx's config.h
|
||||
******************************************************************************/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
+3469
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* POSIX getopt for Windows
|
||||
*
|
||||
* AT&T Public License
|
||||
*
|
||||
* Code given out at the 1985 UNIFORUM conference in Dallas.
|
||||
*/
|
||||
|
||||
#ifndef _WINGETOPT_H_
|
||||
#define _WINGETOPT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int opterr;
|
||||
extern int optind;
|
||||
extern int optopt;
|
||||
extern char *optarg;
|
||||
int getopt(int argc, char *const argv[], const char *optstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETOPT_H_ */
|
||||
/*
|
||||
* POSIX getopt for Windows
|
||||
*
|
||||
* AT&T Public License
|
||||
*
|
||||
* Code given out at the 1985 UNIFORUM conference in Dallas.
|
||||
*/
|
||||
|
||||
/* Microsoft compiler generates a lot of warning for self includes... */
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable : 4548) /* expression before comma has no effect; \
|
||||
expected expression with side - effect */
|
||||
#pragma warning(disable : 4530) /* C++ exception handler used, but unwind \
|
||||
* semantics are not enabled. Specify /EHsc */
|
||||
#pragma warning(disable : 4577) /* 'noexcept' used with no exception handling \
|
||||
* mode specified; termination on exception is \
|
||||
* not guaranteed. Specify /EHsc */
|
||||
#if !defined(_CRT_SECURE_NO_WARNINGS)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
#endif
|
||||
|
||||
int optind = 1;
|
||||
int optopt;
|
||||
char *optarg;
|
||||
|
||||
int getopt(int argc, char *const argv[], const char *opts) {
|
||||
static int sp = 1;
|
||||
int c;
|
||||
const char *cp;
|
||||
|
||||
if (sp == 1) {
|
||||
if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
return EOF;
|
||||
else if (strcmp(argv[optind], "--") == 0) {
|
||||
optind++;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
optopt = c = argv[optind][sp];
|
||||
if (c == ':' || (cp = strchr(opts, c)) == NULL) {
|
||||
fprintf(stderr, "%s: %s -- %c\n", argv[0], "illegal option", c);
|
||||
if (argv[optind][++sp] == '\0') {
|
||||
optind++;
|
||||
sp = 1;
|
||||
}
|
||||
return '?';
|
||||
}
|
||||
if (*++cp == ':') {
|
||||
if (argv[optind][sp + 1] != '\0')
|
||||
optarg = &argv[optind++][sp + 1];
|
||||
else if (++optind >= argc) {
|
||||
fprintf(stderr, "%s: %s -- %c\n", argv[0], "option requires an argument", c);
|
||||
sp = 1;
|
||||
return '?';
|
||||
} else
|
||||
optarg = argv[optind++];
|
||||
sp = 1;
|
||||
} else {
|
||||
if (argv[optind][++sp] == '\0') {
|
||||
sp = 1;
|
||||
optind++;
|
||||
}
|
||||
optarg = NULL;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/** This file is part of the libmdbx amalgamated source code (v0.14.1-356-gadaf1352 at 2026-01-29T18:08:07+03:00).
|
||||
|
||||
\file mdbx.h
|
||||
\brief The libmdbx C API header file.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/// \file mdbx.h++
|
||||
/// This file is part of the libmdbx amalgamated source code (v0.14.1-356-gadaf1352 at 2026-01-29T18:08:07+03:00).
|
||||
/// \file mdbx.h++
|
||||
/// \brief The libmdbx C++ API header file.
|
||||
///
|
||||
/// \details _libmdbx_ (aka MDBX) is an extremely fast, compact, powerful, embeddable,
|
||||
|
||||
+27
-3508
File diff suppressed because it is too large
Load Diff
+27
-3508
File diff suppressed because it is too large
Load Diff
+27
-3508
File diff suppressed because it is too large
Load Diff
+48
-3529
File diff suppressed because it is too large
Load Diff
+27
-3508
File diff suppressed because it is too large
Load Diff
+27
-3508
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user