diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,12 @@ endif() add_subdirectory(src) + +option(BUILD_BITCOIN_CHRONIK "Activate the Chronik indexer" OFF) +if(BUILD_BITCOIN_CHRONIK) + add_subdirectory(chronik) +endif() + add_subdirectory(test) add_subdirectory(contrib) diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitcoinsuite-core" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +# Copyright (c) 2022 The Bitcoin developers + +[workspace] + +members = [ + "chronik/bitcoinsuite-core", +] diff --git a/chronik/CMakeLists.txt b/chronik/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/chronik/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (c) 2022 The Bitcoin developers + +find_package(Corrosion 0.2.0 REQUIRED) + +set(REQUIRED_RUST_VERSION "1.61.0") +if(Rust_VERSION VERSION_LESS REQUIRED_RUST_VERSION) + message(FATAL_ERROR "Minimum required Rust version is " + "${REQUIRED_RUST_VERSION}, but found ${Rust_VERSION}") +endif() + +set(CARGO_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/cargo/build") + +add_custom_target(check-bitcoinsuite +COMMAND + "${CMAKE_COMMAND}" + -E env + CARGO_TARGET_DIR="${CARGO_BUILD_DIR}" + CARGO_BUILD_RUSTC="$" + "$" + test + --package bitcoinsuite-* +WORKING_DIRECTORY + "${CMAKE_SOURCE_DIR}" +) diff --git a/chronik/bitcoinsuite-core/Cargo.toml b/chronik/bitcoinsuite-core/Cargo.toml new file mode 100644 --- /dev/null +++ b/chronik/bitcoinsuite-core/Cargo.toml @@ -0,0 +1,8 @@ +# Copyright (c) 2022 The Bitcoin developers + +[package] +name = "bitcoinsuite-core" +version = "0.1.0" +edition = "2021" +rust-version = "1.61.0" +license = "MIT" diff --git a/chronik/bitcoinsuite-core/src/lib.rs b/chronik/bitcoinsuite-core/src/lib.rs new file mode 100644 --- /dev/null +++ b/chronik/bitcoinsuite-core/src/lib.rs @@ -0,0 +1,10 @@ +// Copyright (c) 2022 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#![deny(unsafe_code)] + +//! Core primitives for dealing with Bitcoin-like chains. +//! +//! Note: This is a general purpose library, but has been optimized for the +//! usage in Chronik, an indexer for Bitcoin ABC. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -73,6 +73,7 @@ include(NativeExecutable) native_add_cmake_flags( "-DBUILD_BITCOIN_WALLET=OFF" + "-DBUILD_BITCOIN_CHRONIK=OFF" "-DBUILD_BITCOIN_QT=OFF" "-DBUILD_BITCOIN_ZMQ=OFF" "-DENABLE_QRCODE=OFF"