From 449307a69f9a4bce0c5836a50dc5d9d4acf3ba79 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Thu, 5 Sep 2019 11:57:52 +0300 Subject: [PATCH] mdbx-build: sourcery pinning (but cmake requires manually config-files removal for now). --- .gitignore | 3 +- CMakeLists.txt | 45 +++++++++++------------- GNUmakefile | 25 ++++++------- mdbx.h | 5 +-- src/CMakeLists.txt | 71 +++++++++++++++++-------------------- src/alloy.c | 5 +-- src/elements/config.h.in | 27 +++++++++++--- src/elements/core.c | 47 +++++++++++++++++++++++++ src/elements/defs.h | 3 ++ src/elements/internals.h | 72 +++++++++++++++++++++++++++----------- src/elements/lck-posix.c | 24 ------------- src/elements/lck-windows.c | 10 +++--- src/elements/osal.h | 5 +-- src/elements/version.c.in | 55 +++++++++++++++++++---------- src/tools/CMakeLists.txt | 2 +- src/tools/mdbx_chk.c | 6 ++-- src/tools/mdbx_copy.c | 6 ++-- src/tools/mdbx_dump.c | 6 ++-- src/tools/mdbx_load.c | 6 ++-- src/tools/mdbx_stat.c | 6 ++-- 20 files changed, 261 insertions(+), 168 deletions(-) diff --git a/.gitignore b/.gitignore index 1f5359ae..718307f8 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,5 @@ test/tmp.db-lck tmp.db tmp.db-lck valgrind.* -version.c +src/elements/version.c +src/elements/config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b5fcbee0..fd1f01a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,11 +50,13 @@ endif() if(DEFINED PROJECT_NAME) set(SUBPROJECT ON) + set(NOT_SUBPROJECT OFF) if(NOT DEFINED BUILD_TESTING) set(BUILD_TESTING OFF) endif() else() set(SUBPROJECT OFF) + set(NOT_SUBPROJECT ON) project(libmdbx C CXX) if(NOT DEFINED BUILD_TESTING) set(BUILD_TESTING ON) @@ -131,7 +133,6 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE) include(cmake/utils.cmake) include(cmake/compiler.cmake) include(cmake/profile.cmake) -option(PROVIDE_VERSIONINFO "Provide library's version information." ON) find_program(ECHO echo) find_program(CAT cat) @@ -159,13 +160,16 @@ find_package(Threads REQUIRED) if(SUBPROJECT) if(NOT DEFINED BUILD_SHARED_LIBS) - option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) + option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)" OFF) + endif() + if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + option(CMAKE_POSITION_INDEPENDENT_CODE "Generate position independed (PIC)" ON) endif() else() - option(CMAKE_POSITION_INDEPENDENT_CODE "Generate position independed (PIC)." ON) - option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." ON) + option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)" ON) + option(CMAKE_POSITION_INDEPENDENT_CODE "Generate position independed (PIC)" ON) if (CC_HAS_ARCH_NATIVE) - option(BUILD_FOR_NATIVE_CPU "Generate code for the compiling machine CPU." OFF) + option(BUILD_FOR_NATIVE_CPU "Generate code for the compiling machine CPU" OFF) endif() if(CMAKE_CONFIGURATION_TYPES OR NOT CMAKE_BUILD_TYPE_UPPERCASE STREQUAL "DEBUG") @@ -176,7 +180,7 @@ else() if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_AVAILABLE OR GCC_LTO_AVAILABLE OR MSVC_LTO_AVAILABLE OR CLANG_LTO_AVAILABLE) - option(INTERPROCEDURAL_OPTIMIZATION "Enable interprocedural/LTO optimization." ${INTERPROCEDURAL_OPTIMIZATION_DEFAULT}) + option(INTERPROCEDURAL_OPTIMIZATION "Enable interprocedural/LTO optimization" ${INTERPROCEDURAL_OPTIMIZATION_DEFAULT}) endif() if(INTERPROCEDURAL_OPTIMIZATION) @@ -276,16 +280,17 @@ option(MDBX_ENABLE_TESTS "Build MDBX tests." ${BUILD_TESTING}) # set(MDBX_BUILD_OPTIONS ENABLE_ASAN ENABLE_VALGRIND ENABLE_GPROF ENABLE_GCOV) +add_mdbx_option(MDBX_BUILD_SHARED_LIBRARY "Build libmdbx as shared library (DLL)" ${BUILD_SHARED_LIBS}) add_mdbx_option(MDBX_ALLOY_BUILD "Build MDBX library as single object file" ON) add_mdbx_option(MDBX_TXN_CHECKOWNER "Checking transaction matches the calling thread inside libmdbx's API" ON) -add_mdbx_option(MDBX_TXN_CHECKPID "Paranoid checking PID inside libmdbx's API" OFF) +add_mdbx_option(MDBX_TXN_CHECKPID "Paranoid checking PID inside libmdbx's API" AUTO) mark_as_advanced(MDBX_TXN_CHECKPID) if(APPLE) add_mdbx_option(MDBX_OSX_SPEED_INSTEADOF_DURABILITY "Disable use fcntl(F_FULLFSYNC) in favor of speed" OFF) mark_as_advanced(MDBX_OSX_SPEED_INSTEADOF_DURABILITY) endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - add_mdbx_option(MDBX_AVOID_CRT "Avoid dependence from MSVC CRT" ${BUILD_SHARED_LIBS}) + add_mdbx_option(MDBX_AVOID_CRT "Avoid dependence from MSVC CRT" ${NOT_SUBPROJECT}) if(NOT BUILD_SHARED_LIBS) add_mdbx_option(MDBX_CONFIG_MANUAL_TLS_CALLBACK "Provide mdbx_dll_callback() for manual initialization" OFF) @@ -301,27 +306,17 @@ endif() ################################################################################ ################################################################################ -################################################################################ - -if(PROVIDE_VERSIONINFO) - set(HAVE_MDBX_VERSIONINFO TRUE) -else() - set(HAVE_MDBX_VERSIONINFO FALSE) -endif() - add_subdirectory(src) if(MDBX_ENABLE_TESTS) add_subdirectory(test) endif() -if(HAVE_MDBX_VERSIONINFO) - set(PACKAGE "libmdbx") - set(CPACK_PACKAGE_VERSION_MAJOR ${MDBX_VERSION_MAJOR}) - set(CPACK_PACKAGE_VERSION_MINOR ${MDBX_VERSION_MINOR}) - set(CPACK_PACKAGE_VERSION_PATCH ${MDBX_VERSION_RELEASE}) - set(CPACK_PACKAGE_VERSION_COMMIT ${MDBX_VERSION_REVISION}) - set(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${CPACK_PACKAGE_VERSION_COMMIT}") - message(STATUS "libmdbx package version is ${PACKAGE_VERSION}") -endif() +set(PACKAGE "libmdbx") +set(CPACK_PACKAGE_VERSION_MAJOR ${MDBX_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${MDBX_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${MDBX_VERSION_RELEASE}) +set(CPACK_PACKAGE_VERSION_COMMIT ${MDBX_VERSION_REVISION}) +set(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${CPACK_PACKAGE_VERSION_COMMIT}") +message(STATUS "libmdbx package version is ${PACKAGE_VERSION}") cmake_policy(POP) diff --git a/GNUmakefile b/GNUmakefile index b91afc9e..bcf56c37 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -121,9 +121,8 @@ check-fault: all ; ./mdbx_chk -vvnw $(TESTDB) && ([ ! -e $(TESTDB)-copy ] || ./mdbx_chk -vvn $(TESTDB)-copy) MDBX_VERSION_GIT = ${shell set -o pipefail; git describe --tags | sed -n 's|^v*\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)\(.*\)|\1|p' || echo 'Please fetch tags and/or install latest git version'} -version.c: src/elements/version.c.in $(lastword $(MAKEFILE_LIST)) .git/HEAD .git/index .git/refs/tags +src/elements/version.c: src/elements/version.c.in $(lastword $(MAKEFILE_LIST)) .git/HEAD .git/index .git/refs/tags sed \ - -e "s|@MDBX_BUILD_TIMESTAMP@|$(shell date +%Y-%m-%dT%H:%M:%S%z)|" \ -e "s|@MDBX_GIT_TIMESTAMP@|$(shell git show --no-patch --format=%cI HEAD || echo 'Please install latest get version')|" \ -e "s|@MDBX_GIT_TREE@|$(shell git show --no-patch --format=%T HEAD || echo 'Please install latest get version')|" \ -e "s|@MDBX_GIT_COMMIT@|$(shell git show --no-patch --format=%H HEAD || echo 'Please install latest get version')|" \ @@ -132,16 +131,18 @@ version.c: src/elements/version.c.in $(lastword $(MAKEFILE_LIST)) .git/HEAD .git -e "s|\$${MDBX_VERSION_MINOR}|$(shell echo '$(MDBX_VERSION_GIT)' | cut -d . -f 2)|" \ -e "s|\$${MDBX_VERSION_RELEASE}|$(shell echo '$(MDBX_VERSION_GIT)' | cut -d . -f 3)|" \ -e "s|\$${MDBX_VERSION_REVISION}|$(shell git rev-list --count --no-merges HEAD || echo 'Please fetch tags and/or install latest git version')|" \ - -e "s|@MDBX_OPTIONS_STRING@|$(MDBX_OPTIONS)|" \ - -e "s|\$${MDBX_COMPILE_FLAGS}|$(CFLAGS) $(LDFLAGS)|" \ - -e "s|@MDBX_BUILD_COMPILER@|$(shell set -o pipefail; $(CC) --version | head -1 || echo 'Please use GCC or CLANG compatible compiler')|" \ - -e "s|\$${MDBX_BUILD_TARGET}|$(shell set -o pipefail; LC_ALL=C $(CC) -v 2>&1 | grep -i '^Target:' | cut -d ' ' -f 2- || echo 'Please use GCC or CLANG compatible compiler')|" \ - src/elements/version.c.in > $@ + src/elements/version.c.in > $@ || rm -f $@ -version.o: version.c $(lastword $(MAKEFILE_LIST)) - $(CC) $(CFLAGS) $(MDBX_OPTIONS) -I./src -c version.c -o $@ +src/elements/config.h: src/elements/version.c $(lastword $(MAKEFILE_LIST)) + (echo '#define MDBX_BUILD_TIMESTAMP "$(shell date +%Y-%m-%dT%H:%M:%S%z)"' \ + && echo '#define MDBX_BUILD_OPTIONS_STRING "$(MDBX_OPTIONS)"' \ + && echo '#define MDBX_BUILD_FLAGS "$(CFLAGS) $(LDFLAGS)"' \ + && echo '#define MDBX_BUILD_COMPILER "$(shell set -o pipefail; $(CC) --version | head -1 || echo 'Please use GCC or CLANG compatible compiler')"' \ + && echo '#define MDBX_BUILD_TARGET "$(shell set -o pipefail; LC_ALL=C $(CC) -v 2>&1 | grep -i '^Target:' | cut -d ' ' -f 2- || echo 'Please use GCC or CLANG compatible compiler')"' \ + && echo '#define MDBX_BUILD_SOURCERY $(shell set -o pipefail; ((openssl dgst -r -sha256 src/elements/version.c.in || sha256sum src/elements/version.c || shasum -a 256 src/elements/version.c) 2>/dev/null | cut -d ' ' -f 1 && echo -n `git describe --tags --long --dirty=-dirty`) | tr -c -s '[a-zA-Z0-9]' _ || echo 'Please install openssl or sha256sum or shasum')' \ + ) > $@ || rm -f $@ -libmdbx.o: src/alloy.c $(ALLOY_DEPS) $(lastword $(MAKEFILE_LIST)) +libmdbx.o: src/elements/config.h src/elements/version.c src/alloy.c $(ALLOY_DEPS) $(lastword $(MAKEFILE_LIST)) $(CC) $(CFLAGS) $(MDBX_OPTIONS) -c src/alloy.c -o $@ define test-rule @@ -151,10 +152,10 @@ $(patsubst %.cc,%.o,$(1)): $(1) $(TEST_INC) mdbx.h $(lastword $(MAKEFILE_LIST)) endef $(foreach file,$(TEST_SRC),$(eval $(call test-rule,$(file)))) -libmdbx.a: libmdbx.o version.o +libmdbx.a: libmdbx.o $(AR) rs $@ $? -libmdbx.$(SO_SUFFIX): libmdbx.o version.o +libmdbx.$(SO_SUFFIX): libmdbx.o $(CC) $(CFLAGS) $^ -pthread -shared $(LDFLAGS) -o $@ mdbx_%: src/tools/mdbx_%.c libmdbx.a diff --git a/mdbx.h b/mdbx.h index 49b5ab7a..2f471841 100644 --- a/mdbx.h +++ b/mdbx.h @@ -197,6 +197,7 @@ typedef struct mdbx_version_info { const char *commit; const char *describe; } git; + const char *sourcery; } mdbx_version_info; typedef struct mdbx_build_info { @@ -211,7 +212,7 @@ extern LIBMDBX_API const mdbx_version_info mdbx_version; extern LIBMDBX_API const mdbx_build_info mdbx_build; #if defined(_WIN32) || defined(_WIN64) -#ifndef MDBX_BUILD_DLL +#if !MDBX_BUILD_SHARED_LIBRARY /* Dll initialization callback for ability to dynamically load MDBX DLL by * LoadLibrary() on Windows versions before Windows Vista. This function MUST be @@ -227,7 +228,7 @@ extern LIBMDBX_API const mdbx_build_info mdbx_build; void LIBMDBX_API NTAPI mdbx_dll_callback(PVOID module, DWORD reason, PVOID reserved); #endif /* MDBX_CONFIG_MANUAL_TLS_CALLBACK */ -#endif /* MDBX_BUILD_DLL */ +#endif /* !MDBX_BUILD_SHARED_LIBRARY */ #endif /* Windows */ /* The name of the lock file in the DB environment */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5b61941a..800ad78e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,12 +13,8 @@ ## # Get version -if(HAVE_MDBX_VERSIONINFO) - fetch_version(MDBX "${CMAKE_CURRENT_SOURCE_DIR}/../VERSION") - message(STATUS "libmdbx version is ${MDBX_VERSION}") -else() - set(MDBX_VERSION "unversioned") -endif() +fetch_version(MDBX "${CMAKE_CURRENT_SOURCE_DIR}/../VERSION") +message(STATUS "libmdbx version is ${MDBX_VERSION}") if(MDBX_ALLOY_MODE) set(LIBMDBX_SOURCES alloy.c) @@ -33,10 +29,10 @@ else() elements/core.c elements/osal.c elements/lck-${LIBMDBX_OSAL}.c) endif() list(APPEND LIBMDBX_SOURCES ../mdbx.h - "${CMAKE_CURRENT_BINARY_DIR}/version.c" - "${CMAKE_CURRENT_BINARY_DIR}/mdbx-config.h") + "${CMAKE_CURRENT_SOURCE_DIR}/elements/version.c" + "${CMAKE_CURRENT_SOURCE_DIR}/elements/config.h") -if(BUILD_SHARED_LIBS) +if(MDBX_BUILD_SHARED_LIBRARY) add_library(mdbx SHARED ${LIBMDBX_SOURCES}) target_compile_definitions(mdbx PRIVATE LIBMDBX_EXPORTS INTERFACE LIBMDBX_IMPORTS) if(CC_HAS_VISIBILITY AND (LTO_ENABLED OR INTERPROCEDURAL_OPTIMIZATION)) @@ -52,43 +48,42 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if(MSVC) if(NOT MSVC_LIB_EXE) # Find lib.exe - get_filename_component (CL_NAME ${CMAKE_C_COMPILER} NAME) - string (REPLACE cl.exe lib.exe MSVC_LIB_EXE ${CL_NAME}) + get_filename_component(CL_NAME ${CMAKE_C_COMPILER} NAME) + string(REPLACE cl.exe lib.exe MSVC_LIB_EXE ${CL_NAME}) find_program(MSVC_LIB_EXE ${MSVC_LIB_EXE}) endif() if(MSVC_LIB_EXE) - message (STATUS "Found MSVC's lib tool: ${MSVC_LIB_EXE}") + message(STATUS "Found MSVC's lib tool: ${MSVC_LIB_EXE}") set(MDBX_NTDLL_EXTRA_IMPLIB ${CMAKE_CURRENT_BINARY_DIR}/mdbx_ntdll_extra.lib) add_custom_command(OUTPUT ${MDBX_NTDLL_EXTRA_IMPLIB} COMMENT "Create extra-import-library for ntdll.dll" MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/elements/ntdll.def" COMMAND ${MSVC_LIB_EXE} /def:"${CMAKE_CURRENT_SOURCE_DIR}/elements/ntdll.def" /out:"${MDBX_NTDLL_EXTRA_IMPLIB}" ${INITIAL_CMAKE_STATIC_LINKER_FLAGS}) else() - message (SEND_ERROR "MSVC's lib tool not found") + message(SEND_ERROR "MSVC's lib tool not found") endif() elseif(MINGW OR MINGW64) if(NOT DLLTOOL) # Find dlltool - get_filename_component (GCC_NAME ${CMAKE_C_COMPILER} NAME) - string (REPLACE gcc dlltool DLLTOOL_NAME ${GCC_NAME}) - find_program (DLLTOOL NAMES ${DLLTOOL_NAME}) + get_filename_component(GCC_NAME ${CMAKE_C_COMPILER} NAME) + string(REPLACE gcc dlltool DLLTOOL_NAME ${GCC_NAME}) + find_program(DLLTOOL NAMES ${DLLTOOL_NAME}) endif() if(DLLTOOL) - message (STATUS "Found dlltool: ${DLLTOOL}") + message(STATUS "Found dlltool: ${DLLTOOL}") set(MDBX_NTDLL_EXTRA_IMPLIB "${CMAKE_CURRENT_BINARY_DIR}/mdbx_ntdll_extra.a") add_custom_command(OUTPUT ${MDBX_NTDLL_EXTRA_IMPLIB} COMMENT "Create extra-import-library for ntdll.dll" MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/elements/ntdll.def" COMMAND ${DLLTOOL} -d "${CMAKE_CURRENT_SOURCE_DIR}/elements/ntdll.def" -l "${MDBX_NTDLL_EXTRA_IMPLIB}") else() - message (SEND_ERROR "dlltool not found") + message(SEND_ERROR "dlltool not found") endif() endif() endif() target_link_libraries(mdbx ${MDBX_LIBDEP_MODE} ${CMAKE_THREAD_LIBS_INIT}) if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_compile_definitions(mdbx ${MDBX_LIBDEP_MODE} MDBX_BUILD_DLL) target_link_libraries(mdbx ${MDBX_LIBDEP_MODE} ntdll.lib) if(MDBX_NTDLL_EXTRA_IMPLIB) # LY: Sometimes Cmake requires a nightmarish magic for simple things. @@ -110,8 +105,6 @@ set_target_properties(mdbx PROPERTIES C_STANDARD 11 C_STANDARD_REQUIRED OFF PUBLIC_HEADER "../mdbx.h") -target_include_directories(mdbx PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") if(CC_HAS_FASTMATH) target_compile_options(mdbx PRIVATE "-ffast-math") @@ -179,19 +172,19 @@ endif() list(REMOVE_DUPLICATES mdbx_compile_options) # make string of space separated flags -string(REPLACE ";" " " MDBX_COMPILE_FLAGS "${mdbx_compile_options}") +string(REPLACE ";" " " MDBX_BUILD_FLAGS "${mdbx_compile_options}") unset(mdbx_compile_options) -string(STRIP "${MDBX_COMPILE_FLAGS}${MDBX_DEFINITIONS}" MDBX_COMPILE_FLAGS) +string(STRIP "${MDBX_BUILD_FLAGS}${MDBX_DEFINITIONS}" MDBX_BUILD_FLAGS) if(CMAKE_CONFIGURATION_TYPES) # add dynamic part via per-configuration define - message(STATUS "MDBX Compile Flags: ${MDBX_COMPILE_FLAGS} ") - set(MDBX_COMPILE_FLAGS "${MDBX_COMPILE_FLAGS}") + message(STATUS "MDBX Compile Flags: ${MDBX_BUILD_FLAGS} ") + set(MDBX_BUILD_FLAGS "${MDBX_BUILD_FLAGS}") add_definitions( -DMDBX_COMPILE_FLAGS="$<$:${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_DEFINES_DEBUG}>$<$:${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_DEFINES_RELEASE}>$<$:${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CMAKE_C_DEFINES_RELWITHDEBINFO}>$<$:${CMAKE_C_FLAGS_MINSIZEREL} ${CMAKE_C_DEFINES_MINSIZEREL}>" ) else() - message(STATUS "MDBX Compile Flags: ${MDBX_COMPILE_FLAGS}") - set(MDBX_COMPILE_FLAGS "${MDBX_COMPILE_FLAGS}") + message(STATUS "MDBX Compile Flags: ${MDBX_BUILD_FLAGS}") + set(MDBX_BUILD_FLAGS "${MDBX_BUILD_FLAGS}") endif() # get compiler info @@ -201,11 +194,8 @@ execute_process(COMMAND sh -c "${CMAKE_C_COMPILER} --version | head -1" ERROR_QUIET RESULT_VARIABLE rc) if(rc OR NOT MDBX_BUILD_COMPILER) - set(MDBX_BUILD_COMPILER "") -else() - set(MDBX_BUILD_COMPILER " | ${MDBX_BUILD_COMPILER}" ) + string(STRIP "${CMAKE_C_COMPILER_ID}-${CMAKE_C_COMPILER_VERSION}" MDBX_BUILD_COMPILER) endif() -string(STRIP "${CMAKE_C_COMPILER_ID}-${CMAKE_C_COMPILER_VERSION}${MDBX_BUILD_COMPILER}" MDBX_BUILD_COMPILER) # make a build-target triplet if(CMAKE_C_COMPILER_TARGET) @@ -229,15 +219,15 @@ endif() # options string(TIMESTAMP MDBX_BUILD_TIMESTAMP UTC) -set(MDBX_OPTIONS_STRING -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") +set(MDBX_BUILD_OPTIONS_STRING -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") foreach(item IN LISTS MDBX_BUILD_OPTIONS) if(DEFINED ${item} AND NOT "${${item}}" STREQUAL "AUTO") - string(APPEND MDBX_OPTIONS_STRING " -D${item}=${${item}}") + string(APPEND MDBX_BUILD_OPTIONS_STRING " -D${item}=${${item}}") message(STATUS "${item}: ${${item}}") else() unset(${item} CACHE) set(${item}_AUTO ON) - string(APPEND MDBX_OPTIONS_STRING " -D${item}=AUTO") + string(APPEND MDBX_BUILD_OPTIONS_STRING " -D${item}=AUTO") message(STATUS "${item}: AUTO") endif() endforeach() @@ -257,12 +247,15 @@ foreach(item IN LISTS options) message(STATUS "${item}: ${value}") endforeach(item) -# generate version file +# generate version and config files configure_file("${CMAKE_CURRENT_SOURCE_DIR}/elements/version.c.in" - "${CMAKE_CURRENT_BINARY_DIR}/version.c" ESCAPE_QUOTES) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/elements/config.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/mdbx-config.h" ESCAPE_QUOTES) + "${CMAKE_CURRENT_SOURCE_DIR}/elements/version.c" ESCAPE_QUOTES) -target_compile_definitions(mdbx PRIVATE MDBX_CONFIG_H="${CMAKE_CURRENT_BINARY_DIR}/mdbx-config.h") +file(SHA256 "${CMAKE_CURRENT_SOURCE_DIR}/elements/version.c" MDBX_SOURCERY_DIGEST) +string(MAKE_C_IDENTIFIER "${MDBX_GIT_DESCRIBE}" MDBX_SOURCERY_SUFFIX) +set(MDBX_BUILD_SOURCERY "${MDBX_SOURCERY_DIGEST}_${MDBX_SOURCERY_SUFFIX}") + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/elements/config.h.in" + "${CMAKE_CURRENT_SOURCE_DIR}/elements/config.h" ESCAPE_QUOTES) add_subdirectory(tools) diff --git a/src/alloy.c b/src/alloy.c index 20642f21..98f3aac3 100644 --- a/src/alloy.c +++ b/src/alloy.c @@ -15,12 +15,9 @@ #define MDBX_ALLOY 1 #include "elements/internals.h" /* must be included fisrt */ -#include "../mdbx.h" -#include "elements/defs.h" -#include "elements/osal.h" - #include "elements/core.c" #include "elements/osal.c" +#include "elements/version.c" #if defined(_WIN32) || defined(_WIN64) #include "elements/lck-windows.c" diff --git a/src/elements/config.h.in b/src/elements/config.h.in index 8a49b888..59f036fa 100644 --- a/src/elements/config.h.in +++ b/src/elements/config.h.in @@ -1,4 +1,7 @@ -#cmakedefine HAVE_VALGRIND_MEMCHECK_H +/* *INDENT-OFF* */ +/* clang-format off */ + +#cmakedefine HAVE_VALGRIND_MEMCHECK_H #cmakedefine HAS_RELAXED_CONSTEXPR #cmakedefine LTO_ENABLED @@ -7,16 +10,14 @@ #cmakedefine ENABLE_GCOV #cmakedefine ENABLE_ASAN -#cmakedefine01 HAVE_MDBX_VERSIONINFO - /* Common */ #cmakedefine01 MDBX_TXN_CHECKPID #cmakedefine01 MDBX_TXN_CHECKOWNER +#cmakedefine01 MDBX_BUILD_SHARED_LIBRARY /* Windows */ -#cmakedefine MDBX_BUILD_DLL #cmakedefine01 MDBX_CONFIG_MANUAL_TLS_CALLBACK -#cmakedefine MDBX_AVOID_CRT +#cmakedefine01 MDBX_AVOID_CRT /* MacOS */ #cmakedefine01 MDBX_OSX_SPEED_INSTEADOF_DURABILITY @@ -26,6 +27,10 @@ #cmakedefine01 MDBX_USE_OFDLOCKS /* Simulate "AUTO" values of tristate options */ +#cmakedefine MDBX_TXN_CHECKPID_AUTO +#ifdef MDBX_TXN_CHECKPID_AUTO +#undef MDBX_TXN_CHECKPID +#endif #cmakedefine MDBX_USE_ROBUST_AUTO #ifdef MDBX_USE_ROBUST_AUTO #undef MDBX_USE_ROBUST @@ -34,3 +39,15 @@ #ifdef MDBX_USE_OFDLOCKS_AUTO #undef MDBX_USE_OFDLOCKS #endif + +/* Build Info */ +#cmakedefine MDBX_BUILD_TIMESTAMP "@MDBX_BUILD_TIMESTAMP@" +#cmakedefine MDBX_BUILD_TARGET "@MDBX_BUILD_TARGET@" +#cmakedefine MDBX_BUILD_CONFIG "@MDBX_BUILD_CONFIG@" +#cmakedefine MDBX_BUILD_OPTIONS_STRING "@MDBX_BUILD_OPTIONS_STRING@" +#cmakedefine MDBX_BUILD_COMPILER "@MDBX_BUILD_COMPILER@" +#cmakedefine MDBX_BUILD_FLAGS "@MDBX_BUILD_FLAGS@" +#cmakedefine MDBX_BUILD_SOURCERY @MDBX_BUILD_SOURCERY@ + +/* *INDENT-ON* */ +/* clang-format on */ diff --git a/src/elements/core.c b/src/elements/core.c index 42efbf56..dc7c0ecd 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -14686,6 +14686,53 @@ int mdbx_set_attr(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, //---------------------------------------------------------------------------- +__dll_export +#ifdef __attribute_used__ + __attribute_used__ +#elif defined(__GNUC__) || __has_attribute(__used__) + __attribute__((__used__)) +#endif +#ifdef __attribute_externally_visible__ + __attribute_externally_visible__ +#elif (defined(__GNUC__) && !defined(__clang__)) || \ + __has_attribute(__externally_visible__) + __attribute__((__externally_visible__)) +#endif + const mdbx_build_info mdbx_build = { +#ifdef MDBX_BUILD_TIMESTAMP + MDBX_BUILD_TIMESTAMP +#else + __DATE__ " " __TIME__ +#endif + , +#ifdef MDBX_BUILD_TARGET + MDBX_BUILD_TARGET +#else + "UNKNOWN_BUILD_TARGET" +#endif +#ifdef MDBX_BUILD_CONFIG + "-" MDBX_BUILD_CONFIG +#endif + , +#ifdef MDBX_BUILD_OPTIONS_STRING + MDBX_BUILD_OPTIONS_STRING +#else + "@TODO: MDBX_BUILD_OPTIONS_STRING" +#endif + , +#ifdef MDBX_BUILD_COMPILER + MDBX_BUILD_COMPILER +#else + "@TODO: MDBX_BUILD_COMPILER" +#endif + , +#ifdef MDBX_BUILD_FLAGS + MDBX_BUILD_FLAGS +#else + "@TODO: MDBX_BUILD_FLAGS" +#endif + }; + #ifdef __SANITIZE_ADDRESS__ LIBMDBX_API __attribute__((__weak__)) const char *__asan_default_options() { return "symbolize=1:allow_addr2line=1:" diff --git a/src/elements/defs.h b/src/elements/defs.h index ba2a1484..e11134b0 100644 --- a/src/elements/defs.h +++ b/src/elements/defs.h @@ -417,6 +417,9 @@ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); # define STRINGIFY(x) STRINGIFY_HELPER(x) #endif /* STRINGIFY */ +#define CONCAT(a,b) a##b +#define XCONCAT(a,b) CONCAT(a,b) + #ifndef offsetof # define offsetof(type, member) __builtin_offsetof(type, member) #endif /* offsetof */ diff --git a/src/elements/internals.h b/src/elements/internals.h index a0626eb2..33eaa252 100644 --- a/src/elements/internals.h +++ b/src/elements/internals.h @@ -15,9 +15,7 @@ /* *INDENT-OFF* */ /* clang-format off */ -#ifdef MDBX_CONFIG_H -#include MDBX_CONFIG_H -#endif +#include "config.h" /* In case the MDBX_DEBUG is undefined set it corresponding to NDEBUG */ #ifndef MDBX_DEBUG @@ -153,6 +151,57 @@ #define MDBX_WORDBITS 32 #endif /* MDBX_WORDBITS */ +/* Some platforms define the EOWNERDEAD error code even though they + * don't support Robust Mutexes. Compile with -DMDBX_USE_ROBUST=0. */ +#ifndef MDBX_USE_ROBUST +#define MDBX_USE_ROBUST_CONFIG AUTO +/* Howard Chu: Android currently lacks Robust Mutex support */ +#if defined(EOWNERDEAD) && !defined(__ANDROID__) && !defined(__APPLE__) && \ + (!defined(__GLIBC__) || \ + __GLIBC_PREREQ( \ + 2, \ + 10) /* LY: glibc before 2.10 has a troubles with Robust Mutex too. */ \ + || _POSIX_C_SOURCE >= 200809L) +#define MDBX_USE_ROBUST 1 +#else +#define MDBX_USE_ROBUST 0 +#endif +#else +#define MDBX_USE_ROBUST_CONFIG MDBX_USE_ROBUST +#endif /* MDBX_USE_ROBUST */ + +#ifndef MDBX_USE_OFDLOCKS +#define MDBX_USE_OFDLOCKS_CONFIG AUTO +#if defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK) +#define MDBX_USE_OFDLOCKS 1 +#else +#define MDBX_USE_OFDLOCKS 0 +#endif +#else +#define MDBX_USE_OFDLOCKS_CONFIG MDBX_USE_OFDLOCKS +#endif /* MDBX_USE_OFDLOCKS */ + +/* Controls checking PID against reuse DB environment after the fork() */ +#ifndef MDBX_TXN_CHECKPID +#define MDBX_TXN_CHECKPID_CONFIG AUTO +#if defined(MADV_DONTFORK) || defined(_WIN32) || defined(_WIN64) +/* PID check could be ommited: + * - on Linux when madvise(MADV_DONTFORK) is available. i.e. after the fork() + * mapped pages will not be available for child process. + * - in Windows where fork() not available. */ +#define MDBX_TXN_CHECKPID 0 +#else +#define MDBX_TXN_CHECKPID 1 +#endif +#else +#define MDBX_TXN_CHECKPID_CONFIG MDBX_TXN_CHECKPID +#endif /* MDBX_TXN_CHECKPID */ + +#define mdbx_sourcery_anchor XCONCAT(mdbx_sourcery_, MDBX_BUILD_SOURCERY) +#if defined(MDBX_TOOLS) +extern LIBMDBX_API const char *const mdbx_sourcery_anchor; +#endif + /*----------------------------------------------------------------------------*/ /* Basic constants and types */ @@ -202,11 +251,7 @@ typedef uint32_t pgno_t; /* A transaction ID. */ typedef uint64_t txnid_t; #define PRIaTXN PRIi64 -#if MDBX_DEBUG #define MIN_TXNID UINT64_C(0x100000000) -#else -#define MIN_TXNID UINT64_C(1) -#endif /* MIN_TXNID */ /* Used for offsets within a single page. * Since memory pages are typically 4 or 8KB in size, 12-13 bits, @@ -1274,16 +1319,3 @@ static __inline void mdbx_jitter4testing(bool tiny) { (void)tiny; #endif } - -/* Controls checking PID against reuse DB environment after the fork() */ -#ifndef MDBX_TXN_CHECKPID -#if defined(MADV_DONTFORK) || defined(_WIN32) || defined(_WIN64) -/* PID check could be ommited: - * - on Linux when madvise(MADV_DONTFORK) is available. i.e. after the fork() - * mapped pages will not be available for child process. - * - in Windows where fork() not available. */ -#define MDBX_TXN_CHECKPID 0 -#else -#define MDBX_TXN_CHECKPID 1 -#endif -#endif /* MDBX_TXN_CHECKPID */ diff --git a/src/elements/lck-posix.c b/src/elements/lck-posix.c index 8eff61ef..b375ae46 100644 --- a/src/elements/lck-posix.c +++ b/src/elements/lck-posix.c @@ -14,30 +14,6 @@ #include "./internals.h" -/* Some platforms define the EOWNERDEAD error code even though they - * don't support Robust Mutexes. Compile with -DMDBX_USE_ROBUST=0. */ -#ifndef MDBX_USE_ROBUST -/* Howard Chu: Android currently lacks Robust Mutex support */ -#if defined(EOWNERDEAD) && !defined(__ANDROID__) && !defined(__APPLE__) && \ - (!defined(__GLIBC__) || \ - __GLIBC_PREREQ( \ - 2, \ - 10) /* LY: glibc before 2.10 has a troubles with Robust Mutex too. */ \ - || _POSIX_C_SOURCE >= 200809L) -#define MDBX_USE_ROBUST 1 -#else -#define MDBX_USE_ROBUST 0 -#endif -#endif /* MDBX_USE_ROBUST */ - -#ifndef MDBX_USE_OFDLOCKS -#if defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK) -#define MDBX_USE_OFDLOCKS 1 -#else -#define MDBX_USE_OFDLOCKS 0 -#endif -#endif /* MDBX_USE_OFDLOCKS */ - /*----------------------------------------------------------------------------*/ /* global constructor/destructor */ diff --git a/src/elements/lck-windows.c b/src/elements/lck-windows.c index 16362505..3c0f6aaa 100644 --- a/src/elements/lck-windows.c +++ b/src/elements/lck-windows.c @@ -26,7 +26,7 @@ static void mdbx_winnt_import(void); -#ifdef MDBX_BUILD_DLL +#ifdef MDBX_BUILD_SHARED_LIBRARY #if MDBX_AVOID_CRT && defined(NDEBUG) /* DEBUG/CHECKED builds still require MSVC's CRT for runtime checks. * @@ -44,7 +44,7 @@ static #endif /* !MDBX_CONFIG_MANUAL_TLS_CALLBACK */ void NTAPI mdbx_dll_callback(PVOID module, DWORD reason, PVOID reserved) -#endif /* MDBX_BUILD_DLL */ +#endif /* MDBX_BUILD_SHARED_LIBRARY */ { (void)reserved; switch (reason) { @@ -62,12 +62,12 @@ static mdbx_rthc_thread_dtor(module); break; } -#ifdef MDBX_BUILD_DLL +#if MDBX_BUILD_SHARED_LIBRARY return TRUE; #endif } -#if !defined(MDBX_BUILD_DLL) && !MDBX_CONFIG_MANUAL_TLS_CALLBACK +#if !MDBX_BUILD_SHARED_LIBRARY && !MDBX_CONFIG_MANUAL_TLS_CALLBACK /* *INDENT-OFF* */ /* clang-format off */ #if defined(_MSC_VER) @@ -105,7 +105,7 @@ static #endif /* *INDENT-ON* */ /* clang-format on */ -#endif /* !defined(MDBX_BUILD_DLL) && !MDBX_CONFIG_MANUAL_TLS_CALLBACK */ +#endif /* !MDBX_BUILD_SHARED_LIBRARY && !MDBX_CONFIG_MANUAL_TLS_CALLBACK */ /*----------------------------------------------------------------------------*/ diff --git a/src/elements/osal.h b/src/elements/osal.h index e6e8772e..ecf3ee86 100644 --- a/src/elements/osal.h +++ b/src/elements/osal.h @@ -34,7 +34,8 @@ #if !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif -#if !defined(_NO_CRT_STDIO_INLINE) && defined(MDBX_BUILD_DLL) +#if !defined(_NO_CRT_STDIO_INLINE) && MDBX_BUILD_SHARED_LIBRARY && \ + !defined(MDBX_TOOLS) #define _NO_CRT_STDIO_INLINE #endif #endif /* Windows */ @@ -109,7 +110,7 @@ typedef struct { } mdbx_condmutex_t; typedef CRITICAL_SECTION mdbx_fastmutex_t; -#ifdef MDBX_AVOID_CRT +#if MDBX_AVOID_CRT #ifndef mdbx_malloc static inline void *mdbx_malloc(size_t bytes) { return LocalAlloc(LMEM_FIXED, bytes); diff --git a/src/elements/version.c.in b/src/elements/version.c.in index a73a4a28..629cd6ad 100644 --- a/src/elements/version.c.in +++ b/src/elements/version.c.in @@ -12,14 +12,13 @@ * . */ -#include "elements/internals.h" +#include "internals.h" #if defined(_MSC_VER) && defined(MDBX_BUILD_TARGET) #pragma message("Configuration-depended MDBX_BUILD_TARGET: " MDBX_BUILD_TARGET) #endif -#if defined(_MSC_VER) && defined(MDBX_COMPILE_FLAGS) -#pragma message( \ - "Configuration-depended MDBX_COMPILE_FLAGS: " MDBX_COMPILE_FLAGS) +#if defined(_MSC_VER) && defined(MDBX_BUILD_FLAGS) +#pragma message("Configuration-depended MDBX_BUILD_FLAGS: " MDBX_BUILD_FLAGS) #endif #if MDBX_VERSION_MAJOR != ${MDBX_VERSION_MAJOR} || \ @@ -27,19 +26,39 @@ #error "API version mismatch! Had `git fetch --tags` done?" #endif -/*LIBMDBX_API*/ const mdbx_version_info mdbx_version = { - ${MDBX_VERSION_MAJOR}, - ${MDBX_VERSION_MINOR}, - ${MDBX_VERSION_RELEASE}, - ${MDBX_VERSION_REVISION}, - {"@MDBX_GIT_TIMESTAMP@", "@MDBX_GIT_TREE@", "@MDBX_GIT_COMMIT@", - "@MDBX_GIT_DESCRIBE@"}}; +static const char sourcery[] = STRINGIFY(MDBX_BUILD_SOURCERY); -/*LIBMDBX_API*/ const mdbx_build_info mdbx_build = { - "@MDBX_BUILD_TIMESTAMP@", - "${MDBX_BUILD_TARGET}" -#ifdef DMDBX_BUILD_CONFIG - "-" DMDBX_BUILD_CONFIG +__dll_export +#ifdef __attribute_used__ + __attribute_used__ +#elif defined(__GNUC__) || __has_attribute(__used__) + __attribute__((__used__)) #endif - , - "@MDBX_OPTIONS_STRING@", "@MDBX_BUILD_COMPILER@", "${MDBX_COMPILE_FLAGS}"}; +#ifdef __attribute_externally_visible__ + __attribute_externally_visible__ +#elif (defined(__GNUC__) && !defined(__clang__)) || \ + __has_attribute(__externally_visible__) + __attribute__((__externally_visible__)) +#endif + const mdbx_version_info mdbx_version = { + ${MDBX_VERSION_MAJOR}, + ${MDBX_VERSION_MINOR}, + ${MDBX_VERSION_RELEASE}, + ${MDBX_VERSION_REVISION}, + {"@MDBX_GIT_TIMESTAMP@", "@MDBX_GIT_TREE@", "@MDBX_GIT_COMMIT@", + "@MDBX_GIT_DESCRIBE@"}, + sourcery}; + +__dll_export +#ifdef __attribute_used__ + __attribute_used__ +#elif defined(__GNUC__) || __has_attribute(__used__) + __attribute__((__used__)) +#endif +#ifdef __attribute_externally_visible__ + __attribute_externally_visible__ +#elif (defined(__GNUC__) && !defined(__clang__)) || \ + __has_attribute(__externally_visible__) + __attribute__((__externally_visible__)) +#endif + const char *const mdbx_sourcery_anchor = sourcery; diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 46a0963a..57ac426e 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -13,7 +13,7 @@ foreach (TOOL ${MDBX_TOOLS}) add_executable(${TOOL} ${TOOL}.c) endif() - target_link_libraries(${TOOL} mdbx) + target_link_libraries(${TOOL} mdbx ${CMAKE_THREAD_LIBS_INIT}) set_target_properties(${TOOL} PROPERTIES INTERPROCEDURAL_OPTIMIZATION $) diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index e86fd44e..4dae74fc 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -938,14 +938,16 @@ int main(int argc, char *argv[]) { case 'V': printf("mdbx_chk version %d.%d.%d.%d\n" " - source: %s %s, commit %s, tree %s\n" + " - anchor: %s\n" " - build: %s for %s by %s\n" " - flags: %s\n" " - options: %s\n", mdbx_version.major, mdbx_version.minor, mdbx_version.release, mdbx_version.revision, mdbx_version.git.describe, mdbx_version.git.datetime, mdbx_version.git.commit, - mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, - mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + mdbx_version.git.tree, mdbx_sourcery_anchor, mdbx_build.datetime, + mdbx_build.target, mdbx_build.compiler, mdbx_build.flags, + mdbx_build.options); return EXIT_SUCCESS; case 'v': verbose++; diff --git a/src/tools/mdbx_copy.c b/src/tools/mdbx_copy.c index 4e1b88ce..29191848 100644 --- a/src/tools/mdbx_copy.c +++ b/src/tools/mdbx_copy.c @@ -58,14 +58,16 @@ int main(int argc, char *argv[]) { else if (argv[1][1] == 'V' && argv[1][2] == '\0') { printf("mdbx_copy version %d.%d.%d.%d\n" " - source: %s %s, commit %s, tree %s\n" + " - anchor: %s\n" " - build: %s for %s by %s\n" " - flags: %s\n" " - options: %s\n", mdbx_version.major, mdbx_version.minor, mdbx_version.release, mdbx_version.revision, mdbx_version.git.describe, mdbx_version.git.datetime, mdbx_version.git.commit, - mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, - mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + mdbx_version.git.tree, mdbx_sourcery_anchor, mdbx_build.datetime, + mdbx_build.target, mdbx_build.compiler, mdbx_build.flags, + mdbx_build.options); return EXIT_SUCCESS; } else argc = 0; diff --git a/src/tools/mdbx_dump.c b/src/tools/mdbx_dump.c index ccc37356..20cd3762 100644 --- a/src/tools/mdbx_dump.c +++ b/src/tools/mdbx_dump.c @@ -191,14 +191,16 @@ int main(int argc, char *argv[]) { case 'V': printf("mdbx_dump version %d.%d.%d.%d\n" " - source: %s %s, commit %s, tree %s\n" + " - anchor: %s\n" " - build: %s for %s by %s\n" " - flags: %s\n" " - options: %s\n", mdbx_version.major, mdbx_version.minor, mdbx_version.release, mdbx_version.revision, mdbx_version.git.describe, mdbx_version.git.datetime, mdbx_version.git.commit, - mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, - mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + mdbx_version.git.tree, mdbx_sourcery_anchor, mdbx_build.datetime, + mdbx_build.target, mdbx_build.compiler, mdbx_build.flags, + mdbx_build.options); return EXIT_SUCCESS; case 'l': list = 1; diff --git a/src/tools/mdbx_load.c b/src/tools/mdbx_load.c index 86dce66e..e15c0c9d 100644 --- a/src/tools/mdbx_load.c +++ b/src/tools/mdbx_load.c @@ -346,14 +346,16 @@ int main(int argc, char *argv[]) { case 'V': printf("mdbx_load version %d.%d.%d.%d\n" " - source: %s %s, commit %s, tree %s\n" + " - anchor: %s\n" " - build: %s for %s by %s\n" " - flags: %s\n" " - options: %s\n", mdbx_version.major, mdbx_version.minor, mdbx_version.release, mdbx_version.revision, mdbx_version.git.describe, mdbx_version.git.datetime, mdbx_version.git.commit, - mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, - mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + mdbx_version.git.tree, mdbx_sourcery_anchor, mdbx_build.datetime, + mdbx_build.target, mdbx_build.compiler, mdbx_build.flags, + mdbx_build.options); return EXIT_SUCCESS; case 'a': append = 1; diff --git a/src/tools/mdbx_stat.c b/src/tools/mdbx_stat.c index fd86d624..edcbaa62 100644 --- a/src/tools/mdbx_stat.c +++ b/src/tools/mdbx_stat.c @@ -88,14 +88,16 @@ int main(int argc, char *argv[]) { case 'V': printf("mdbx_stat version %d.%d.%d.%d\n" " - source: %s %s, commit %s, tree %s\n" + " - anchor: %s\n" " - build: %s for %s by %s\n" " - flags: %s\n" " - options: %s\n", mdbx_version.major, mdbx_version.minor, mdbx_version.release, mdbx_version.revision, mdbx_version.git.describe, mdbx_version.git.datetime, mdbx_version.git.commit, - mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, - mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + mdbx_version.git.tree, mdbx_sourcery_anchor, mdbx_build.datetime, + mdbx_build.target, mdbx_build.compiler, mdbx_build.flags, + mdbx_build.options); return EXIT_SUCCESS; case 'a': if (subname)