From d78c6cecd8ce07a1ddcf9dea080f86f88eb6712b Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 9 Oct 2025 13:44:34 +0100 Subject: [PATCH 1/6] Add initial Oatpp-based API server implementation Introduces a new API module using Oatpp and Oatpp-Swagger, including controllers, DTOs, and server setup. Updates build scripts and dependencies to support the new API layer for Lethean, providing endpoints and Swagger documentation. --- conanfile.py | 4 +- src/CMakeLists.txt | 1 + src/api/ApiServer.hpp | 38 +++++++++++ src/api/CMakeLists.txt | 30 +++++++++ src/api/controller/RootController.hpp | 35 ++++++++++ src/api/controller/info/InfoController.hpp | 37 +++++++++++ src/api/dto/DTOs.hpp | 36 ++++++++++ src/api/main.cpp | 76 ++++++++++++++++++++++ 8 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 src/api/ApiServer.hpp create mode 100644 src/api/CMakeLists.txt create mode 100644 src/api/controller/RootController.hpp create mode 100644 src/api/controller/info/InfoController.hpp create mode 100644 src/api/dto/DTOs.hpp create mode 100644 src/api/main.cpp diff --git a/conanfile.py b/conanfile.py index ab1a89cb..69cd53e7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -26,7 +26,9 @@ class BlockchainConan(ConanFile): "boost/1.85.0", "openssl/3.2.0", "miniupnpc/2.2.5", - "jwt-cpp/0.7.1" + "jwt-cpp/0.7.1", + "oatpp/1.3.0.latest", + "oatpp-swagger/1.3.0.latest" ] def generate(self): diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 541dc852..2132a36a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,6 +85,7 @@ INIT_SHARED_PCH() add_subdirectory(config) add_subdirectory(genesis) +add_subdirectory(api) add_library(common ${COMMON}) add_dependencies(common version config ${PCH_LIB_NAME}) diff --git a/src/api/ApiServer.hpp b/src/api/ApiServer.hpp new file mode 100644 index 00000000..2aa6f74a --- /dev/null +++ b/src/api/ApiServer.hpp @@ -0,0 +1,38 @@ +#ifndef ApiServer_hpp +#define ApiServer_hpp + +#include "oatpp/web/server/HttpConnectionHandler.hpp" +#include "oatpp/network/tcp/server/ConnectionProvider.hpp" +#include "oatpp/core/macro/component.hpp" +#include "oatpp-swagger/Resources.hpp" + +#include "oatpp/parser/json/mapping/ObjectMapper.hpp" +#include "oatpp-swagger/Resources.hpp" +#include "oatpp-swagger/Model.hpp" +class ApiServer { +public: + + OATPP_CREATE_COMPONENT(std::shared_ptr, serverConnectionProvider)([] { + return oatpp::network::tcp::server::ConnectionProvider::createShared({"0.0.0.0", 8000, oatpp::network::Address::IP_4}); + }()); + + OATPP_CREATE_COMPONENT(std::shared_ptr, httpRouter)([] { + return oatpp::web::server::HttpRouter::createShared(); + }()); + + OATPP_CREATE_COMPONENT(std::shared_ptr, serverConnectionHandler)([] { + OATPP_COMPONENT(std::shared_ptr, router); + return oatpp::web::server::HttpConnectionHandler::createShared(router); + }()); + + OATPP_CREATE_COMPONENT(std::shared_ptr, apiObjectMapper)([] { + return oatpp::parser::json::mapping::ObjectMapper::createShared(); + }()); + + OATPP_CREATE_COMPONENT(std::shared_ptr, swaggerResources)([] { + return oatpp::swagger::Resources::loadResources(OATPP_SWAGGER_RES_PATH); + }()); + +}; + +#endif /* ApiServer_hpp */ diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt new file mode 100644 index 00000000..cb452681 --- /dev/null +++ b/src/api/CMakeLists.txt @@ -0,0 +1,30 @@ +if(NOT PROJECT_NAME) + project(lethean-api) +endif() + +find_package(oatpp 1.3.0 REQUIRED) +if(oatpp_FOUND) + message(STATUS "Found oatpp version: ${oatpp_VERSION_STRING}") +else() + message(FATAL_ERROR "Could not find oatpp") +endif() + +find_package(oatpp-swagger 1.3.0 REQUIRED) +if(oatpp-swagger_FOUND) + message(STATUS "Found oatpp-swagger version: ${oatpp-swagger_VERSION_STRING}") +else() + message(FATAL_ERROR "Could not find oatpp-swagger") +endif() + +add_library(lthn_api INTERFACE) +add_library(lthn::api ALIAS lthn_api) + +target_include_directories(lthn_api INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${oatpp_INCLUDE_DIRS}) +include_directories(${oatpp-swagger_INCLUDE_DIRS}) +add_executable(lethean-api main.cpp) + +target_link_libraries(lethean-api PRIVATE lthn::api PUBLIC oatpp::oatpp oatpp::oatpp-swagger) + +add_definitions(-DOATPP_SWAGGER_RES_PATH="${oatpp-swagger_INCLUDE_DIRS}/../bin/oatpp-swagger/res") +#add_subdirectory(tests) diff --git a/src/api/controller/RootController.hpp b/src/api/controller/RootController.hpp new file mode 100644 index 00000000..37dd5745 --- /dev/null +++ b/src/api/controller/RootController.hpp @@ -0,0 +1,35 @@ +#ifndef RootController_hpp +#define RootController_hpp + +#include "./info/InfoController.hpp" +#include "../dto/DTOs.hpp" + +#include "oatpp/web/server/api/ApiController.hpp" +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/macro/component.hpp" + +#include OATPP_CODEGEN_BEGIN(ApiController) + +class RootController : public oatpp::web::server::api::ApiController { +private: + std::shared_ptr m_infoController; +public: + RootController(OATPP_COMPONENT(std::shared_ptr, objectMapper)) + : oatpp::web::server::api::ApiController(objectMapper), + m_infoController(std::make_shared(objectMapper)) + {} +public: + + // oatpp::web::server::api::Endpoints(m_infoController, "/info"); + + ENDPOINT("GET", "/hello", root) { + auto dto = MyDto::createShared(); + dto->message = "Hello World!"; + return createDtoResponse(Status::CODE_200, dto); + } + +}; + +#include OATPP_CODEGEN_END(ApiController) + +#endif /* RootController_hpp */ diff --git a/src/api/controller/info/InfoController.hpp b/src/api/controller/info/InfoController.hpp new file mode 100644 index 00000000..ab2ece69 --- /dev/null +++ b/src/api/controller/info/InfoController.hpp @@ -0,0 +1,37 @@ +#ifndef InfoController_hpp +#define InfoController_hpp + +#include "oatpp/web/server/api/ApiController.hpp" +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/macro/component.hpp" + +#include OATPP_CODEGEN_BEGIN(ApiController) + +class InfoController : public oatpp::web::server::api::ApiController { +public: + InfoController(OATPP_COMPONENT(std::shared_ptr, objectMapper)) + : oatpp::web::server::api::ApiController(objectMapper) + {} +public: + + ENDPOINT_INFO(version) { + info->summary = "Get API version"; + info->description = "Returns the current version of the API."; + } + ENDPOINT("GET", "/version", version) { + return createResponse(Status::CODE_200, "v0.0.1"); + } + + ENDPOINT_INFO(root) { + info->summary = "Get info root"; + info->description = "Returns a placeholder for the info root."; + } + ENDPOINT("GET", "/", root) { + return createResponse(Status::CODE_200, "Info root"); + } + +}; + +#include OATPP_CODEGEN_END(ApiController) + +#endif /* InfoController_hpp */ diff --git a/src/api/dto/DTOs.hpp b/src/api/dto/DTOs.hpp new file mode 100644 index 00000000..e8bd3111 --- /dev/null +++ b/src/api/dto/DTOs.hpp @@ -0,0 +1,36 @@ +// Copyright (c) 2014-2018 Zano Project +// Copyright (c) 2014-2018 The Louisdor Project +// Copyright (c) 2012-2013 The Boolberry developers +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; the MIT terms are therefore +// considered “grandfathered” under the EUPL for this code. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef DTOs_hpp +#define DTOs_hpp + +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class MyDto : public oatpp::DTO { + + DTO_INIT(MyDto, DTO); + + DTO_FIELD(String, message); + +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* DTOs_hpp */ diff --git a/src/api/main.cpp b/src/api/main.cpp new file mode 100644 index 00000000..dbea164d --- /dev/null +++ b/src/api/main.cpp @@ -0,0 +1,76 @@ +#include "controller/RootController.hpp" +#include "ApiServer.hpp" + +#include "oatpp/network/Server.hpp" +#include "oatpp-swagger/Controller.hpp" + +#include + +void run() { + /* Register Components in scope of run() method */ + ApiServer components; + + /* Get router component */ + OATPP_COMPONENT(std::shared_ptr, router); + + /* Create RootController and add all of its endpoints to router */ + auto rootController = std::make_shared(); + router->addController(rootController); + + OATPP_CREATE_COMPONENT(std::shared_ptr, swaggerDocumentInfo)([] { + + oatpp::swagger::DocumentInfo::Builder builder; + + builder + .setTitle("Lethean Blockchain API") + .setDescription("New API layer for Lethean") + .setVersion("1.0") + .setContactName("Lethean") + .setContactUrl("https://lt.hn/") + + .setLicenseName("EUPL-1.2") + .setLicenseUrl("https://joinup.ec.europa.eu/software/page/eupl/licence-eupl") + + .addServer("http://localhost:8000", "server on localhost"); + + // When you are using the AUTHENTICATION() Endpoint-Macro you must add an SecurityScheme object (https://swagger.io/specification/#securitySchemeObject) + // For basic-authentication you can use the default Basic-Authorization-Security-Scheme like this + // For more complex authentication schemes you can use the oatpp::swagger::DocumentInfo::SecuritySchemeBuilder builder + // Don't forget to add info->addSecurityRequirement("basic_auth") to your ENDPOINT_INFO() Macro! + //.addSecurityScheme("basic_auth", oatpp::swagger::DocumentInfo::SecuritySchemeBuilder::DefaultBasicAuthorizationSecurityScheme()); + + return builder.build(); + +}()); + + /* Create Swagger-UI controller and add its endpoints to router */ + auto swaggerController = oatpp::swagger::Controller::createShared(rootController->getEndpoints()); + router->addController(swaggerController); + + /* Get connection handler component */ + OATPP_COMPONENT(std::shared_ptr, connectionHandler); + + /* Get connection provider component */ + OATPP_COMPONENT(std::shared_ptr, connectionProvider); + + /* Create server which takes provided TCP connections and passes them to HTTP connection handler */ + oatpp::network::Server server(connectionProvider, connectionHandler); + + /* Print server port */ + OATPP_LOGI("lethean-api", "Server running on port %s", connectionProvider->getProperty("port").getData()); + + /* Run server */ + server.run(); +} + +int main(int argc, const char * argv[]) { + + oatpp::base::Environment::init(); + + run(); + + /* Destroy oatpp Environment */ + oatpp::base::Environment::destroy(); + + return 0; +} From c5c90dad6b3cb923670f97547b72fcd5b9664992 Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 9 Oct 2025 15:38:58 +0100 Subject: [PATCH 2/6] Update docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 12e20efc..5f842e05 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 12e20efce7eaf51e38d8953c318633b1c5189256 +Subproject commit 5f842e053886802d3ef5322e19442c84f3b4aa63 From bac3c459d24bea599e4795f3663b8cf0ada7eadf Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 9 Oct 2025 23:46:45 +0100 Subject: [PATCH 3/6] Update src/api/ApiServer.hpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/api/ApiServer.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/api/ApiServer.hpp b/src/api/ApiServer.hpp index 2aa6f74a..d02e4b0b 100644 --- a/src/api/ApiServer.hpp +++ b/src/api/ApiServer.hpp @@ -7,7 +7,6 @@ #include "oatpp-swagger/Resources.hpp" #include "oatpp/parser/json/mapping/ObjectMapper.hpp" -#include "oatpp-swagger/Resources.hpp" #include "oatpp-swagger/Model.hpp" class ApiServer { public: From 4cfc57b1f19e65f1019557a23874b0006e625a20 Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 9 Oct 2025 23:46:58 +0100 Subject: [PATCH 4/6] Update src/api/controller/RootController.hpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/api/controller/RootController.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/api/controller/RootController.hpp b/src/api/controller/RootController.hpp index 37dd5745..817fa833 100644 --- a/src/api/controller/RootController.hpp +++ b/src/api/controller/RootController.hpp @@ -20,7 +20,6 @@ public: {} public: - // oatpp::web::server::api::Endpoints(m_infoController, "/info"); ENDPOINT("GET", "/hello", root) { auto dto = MyDto::createShared(); From 10f35173eb63012db658514e70db4223869fce4f Mon Sep 17 00:00:00 2001 From: Snider Date: Fri, 10 Oct 2025 00:44:54 +0100 Subject: [PATCH 5/6] Revise README with updated build instructions Simplified and modernized the README to focus on Makefile-based build and packaging workflow. Removed outdated manual steps for Linux, Windows, and macOS, and added concise instructions for cloning, building, and customizing builds using Makefile variables. Updated Discord badge and removed legacy information. --- README.md | 222 +++++++++++++----------------------------------------- 1 file changed, 54 insertions(+), 168 deletions(-) diff --git a/README.md b/README.md index dcee9f03..03a00bd0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,4 @@ -[![Coverity Scan](https://scan.coverity.com/projects/18767/badge.svg)](https://scan.coverity.com/projects/zanoproject) -[![Discord](https://img.shields.io/discord/538361472691077130?label=discord&logo=discord)](https://discord.gg/wE3rmYY) - -## Cloning - -Be sure to clone the repository properly:\ -`$ git clone --recursive https://github.com/hyle-team/zano.git` - -# Building --------- - +[![Discord](https://img.shields.io/discord/379876792003067906?label=discord&logo=discord)](https://discord.gg/pfgT2Kz) ### Dependencies | component / version | minimum
(not recommended but may work) | recommended | most recent of what we have ever tested | @@ -18,179 +8,75 @@ Be sure to clone the repository properly:\ | [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2022 (17.11.5) | 2022 (17.12.3) | | [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 15.2 | | [CMake](https://cmake.org/download/) | 3.26.3 | 3.26.3 | 3.31.6 | -| [Boost](https://www.boost.org/users/download/) | 1.75 | 1.84 | 1.84 | -| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | 1.1.1n | 1.1.1w | 3.4 | -| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 6.8.3 | 6.8.3 | 6.8.3 | - -Note:\ -[*server version*] denotes steps required for building command-line tools (daemon, simplewallet, etc.).\ -[*GUI version*] denotes steps required for building Zano executable with GUI. - -
- -### Linux - -Recommended OS versions: Ubuntu 20.04, 22.04 LTS. - -1. Prerequisites - - [*server version*] - - sudo apt-get install -y build-essential g++ curl autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev libssl-dev bzip2 - - [*GUI version*] - - sudo apt-get install -y build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev libssl-dev bzip2 mesa-common-dev libglu1-mesa-dev - - Make sure you have correct versions installed (see 'Dependencies' section above): - - cmake --version && gcc --version - - -3. Clone Zano into a local folder\ - (If for some reason you need to use alternative Zano branch, change 'master' to the required branch name.) - - git clone --recursive https://github.com/hyle-team/zano.git -b master - - In the following steps we assume that you cloned Zano into '~/zano' folder in your home directory. - - 4. Download and build Boost\ - (Assuming you have cloned Zano into the 'zano' folder. If you used a different location for Zano, **edit line 4** accordingly.) - - curl -OL https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.bz2 - echo "cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454 boost_1_84_0.tar.bz2" | shasum -c && tar -xjf boost_1_84_0.tar.bz2 - rm boost_1_84_0.tar.bz2 && cd boost_1_84_0 - ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log - ./b2 && cd .. - Make sure that you see "The Boost C++ Libraries were successfully built!" message at the end. - - 5. Install Qt\ - (*GUI version only, skip this step if you're building server version*) - - [*GUI version*] - - curl -L -O https://download.qt.io/official_releases/online_installers/qt-online-installer-linux-x64-online.run && - chmod u+x qt-online-installer-linux-x64-online.run - ./qt-online-installer-linux-x64-online.run \ - --accept-licenses \ - --default-answer \ - --confirm-command install \ - qt.qt6.683.linux_gcc_64 \ - qt.qt6.683.addons.qt5compat.linux_gcc_64 \ - qt.qt6.683.addons.qtpositioning.linux_gcc_64 \ - qt.qt6.683.addons.qtwebchannel.linux_gcc_64 \ - qt.qt6.683.addons.qtwebsockets.linux_gcc_64 \ - qt.qt6.683.addons.qtwebengine.linux_gcc_64 \ - qt.qt6.683.addons.qtwebview.linux_gcc_64 - This will download the online installer and perform an unattended installation with the Chromium-based WebEngine -6. Install OpenSSL +## Cloning - We recommend installing OpenSSL v1.1.1w locally unless you would like to use the same version system-wide.\ - (Assuming that `$HOME` environment variable is set to your home directory. Otherwise, edit line 4 accordingly.) +Be sure to clone the repository properly, with `--recursive` flag, or you'll get angry: +`git clone --recursive https://github.com/letheanVPN/blockchain.git` - curl -OL https://www.openssl.org/source/openssl-1.1.1w.tar.gz - echo "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 openssl-1.1.1w.tar.gz" | shasum -c && tar xaf openssl-1.1.1w.tar.gz - cd openssl-1.1.1w/ - ./config --prefix=$HOME/openssl --openssldir=$HOME/openssl shared zlib - make && make test && make install && cd .. +# Building +-------- +The project uses a `Makefile` that provides a simple and powerful interface for building. It automatically handles dependency installation with Conan and compilation with CMake. -7. [*OPTIONAL*] Set global environment variables for convenient use\ -For instance, by adding the following lines to `~/.bashrc` +## Simple Workflow Builds (Recommended) - [*server version*] +For most use cases, these two commands are all you need. They handle the entire build process from start to finish. - export BOOST_ROOT=/home/user/boost_1_84_0 - export OPENSSL_ROOT_DIR=/home/user/openssl +* **Build for Mainnet:** + ```shell + make mainnet + ``` +* **Build for Testnet:** + ```shell + make testnet + ``` - [*GUI version*] +## Custom Builds - export BOOST_ROOT=/home/user/boost_1_84_0 - export OPENSSL_ROOT_DIR=/home/user/openssl - export QT_PREFIX_PATH=/home/user/Qt5.11.2/5.11.2/gcc_64 +You can use the `make build` target with variables for more control over the final binaries. - **NOTICE: Please edit the lines above according to your actual paths.** - - **NOTICE 2:** Make sure you've restarted your terminal session (by reopening the terminal window or reconnecting the server) to apply these changes. +* **Build a `testnet` version:** + ```shell + make build TESTNET=1 + ``` +* **Build a statically-linked version:** + ```shell + make build STATIC=1 + ``` -8. Build the binaries - 1. If you skipped step 6 and did not set the environment variables: +## Creating Release Packages - cd zano && mkdir build && cd build - BOOST_ROOT=$HOME/boost_1_84_0 OPENSSL_ROOT_DIR=$HOME/openssl cmake .. - make -j1 daemon simplewallet +To create distributable packages (e.g., `.zip`, `.deb`), run the `release` target. This will build the project, build the documentation, and then package everything. - 2. If you set the variables in step 6: + ```shell + make release + ``` +The final packages will be located in the `build/release/` directory - cd zano && mkdir build && cd build - cmake .. - make -j1 daemon simplewallet +## Advanced Build Customization (Makefile Variables) - or simply: +For advanced use cases, you can override variables in the `Makefile` to customize the build process. - cd zano && make -j1 - - **NOTICE**: If you are building on a machine with a relatively high amount of RAM or with the proper setting of virtual memory, then you can use `-j2` or `-j` option to speed up the building process. Use with caution. - - **NOTICE 2**: If you'd like to build binaries for the testnet, use `cmake -D TESTNET=TRUE ..` instead of `cmake ..` . - - 1. Build GUI: - - cd zano - utils/build_script_linux.sh - - Look for the binaries in `build` folder - -
- -### Windows -Recommended OS version: Windows 7 x64, Windows 11 x64. -1. Install required prerequisites (Boost, Qt, CMake, OpenSSL). -2. Edit paths in `utils/configure_local_paths.cmd`. -3. Run one of `utils/configure_win64_msvsNNNN_gui.cmd` according to your MSVC version. -4. Go to the build folder and open generated Zano.sln in MSVC. -5. Build. - -In order to correctly deploy Qt GUI application, you also need to do the following: - -6. Run `PATH_TO_QT\bin\windeployqt.exe PATH_TO_PROJECT_ROOT\build\src\Debug\Zano.exe` (choose the Debug or Release folder depending on the configuration you built). -7. You can now run the application using one of the following options: - * Start the program from Visual Studio - * Run `Zano.exe --html-path=PATH_TO_HTML`, where PATH_TO_HTML is by default located at PATH_TO_PROJECT_ROOT\src\gui\qt-daemon\layout\html - * Copy the contents of PATH_TO_PROJECT_ROOT\src\gui\qt-daemon\layout\html to a folder named "html" located in the same directory as the Zano.exe binary. -
- -### macOS -Recommended OS version: macOS Big Sur 11.4 x64. -1. Install required prerequisites. -2. Set environment variables as stated in `utils/macosx_build_config.command`. -3. `mkdir build`
`cd build`
`cmake ..`
`make` - -To build GUI application: - -1. Create self-signing certificate via Keychain Access:\ - a. Run Keychain Access.\ - b. Choose Keychain Access > Certificate Assistant > Create a Certificate.\ - c. Use “Zano” (without quotes) as certificate name.\ - d. Choose “Code Signing” in “Certificate Type” field.\ - e. Press “Create”, then “Done”.\ - f. Make sure the certificate was added to keychain "System". If not—move it to "System".\ - g. Double click the certificate you've just added, enter the trust section and under "When using this certificate" select "Always trust".\ - h. Unfold the certificate in Keychain Access window and double click the underlying private key "Zano". Select "Access Control" tab, then select "Allow all applications to access this item". Click "Save Changes". -2. Revise building script, comment out unwanted steps and run it: `utils/build_script_mac_osx.sh` -3. The application should be here: `/buid_mac_osx_64/release/src` - -
-
- -## Supporting project/donations - -ZANO @dev
-BTC bc1qpa8w8eaehlplfepmnzpd7v9j046899nktxnkxp
-BCH qqgq078vww5exd9kt3frx6krdyznmp80hcygzlgqzd
-ETH 0x206c52b78141498e74FF074301ea90888C40c178
-XMR 45gp9WTobeB5Km3kLQgVmPJkvm9rSmg4gdyHheXqXijXYMjUY48kLgL7QEz5Ar8z9vQioQ68WYDKsQsjAEonSeFX4UeLSiX
+Example: +```shell +make build BUILD_TYPE=Debug CPU_CORES=8 +``` +| Variable | Description | Default Value | +|--------------------|------------------------------------------------------------------------|-------------------------------------------------------------------| +| `BUILD_TYPE` | Sets the build configuration (e.g., `Release`, `Debug`). | `Release` | +| `TESTNET` | Set to `1` to build for the test network. | `0` | +| `STATIC` | Set to `1` to link libraries statically. | `0` | +| `CPU_CORES` | Number of CPU cores to use for parallel compilation. | Auto-detected | +| `BUILD_VERSION` | The version string to embed in the binaries. | `6.0.1` | +| `BUILD_FOLDER` | The output directory for the build. | `build/release` | +| `PRESET_CONFIGURE` | The CMake preset to use for the `configure` step. | `conan-release` | +| `PRESET_BUILD` | The CMake preset to use for the `build` step. | `conan-release` | +| `CONAN_CACHE` | The path for the local Conan cache, where the dependencies are stored. | `./build/sdk` | +| `CONAN_EXECUTABLE` | The path to the usable Conan executable. | `./build/bin/conan` | +| `CONAN_URL` | The URL for the Conan remote repository. | `https://artifacts.host.uk.com/artifactory/api/conan/conan-build` | +| `CONAN_USER` | The username for the Conan remote. | `public` | +| `CONAN_PASSWORD` | The password for the Conan remote. | | \ No newline at end of file From 4eebc0ac87aca7e2ee8ac950ce0eab1c5d9c9103 Mon Sep 17 00:00:00 2001 From: Snider Date: Fri, 10 Oct 2025 12:03:46 +0100 Subject: [PATCH 6/6] Update README with build and packaging instructions Improved documentation for build customization, added examples for using Makefile variables, clarified release packaging output directory, and included instructions for cleaning the build directory. Also updated formatting for better readability. --- README.md | 85 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 03a00bd0..1353c12f 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ [![Discord](https://img.shields.io/discord/379876792003067906?label=discord&logo=discord)](https://discord.gg/pfgT2Kz) ### Dependencies -| component / version | minimum
(not recommended but may work) | recommended | most recent of what we have ever tested | -|-----------------------------------------------------------------------------------------------------|--------------------------------------------|----------------|-----------------------------------------| -| gcc (Linux) | 8.4.0 | 9.4.0 | 12.3.0 | -| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 | -| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2022 (17.11.5) | 2022 (17.12.3) | -| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 15.2 | -| [CMake](https://cmake.org/download/) | 3.26.3 | 3.26.3 | 3.31.6 | +| component / version | minimum
(not recommended but may work) | recommended | most recent of what we have ever tested | +|-----------------------------------------------------------------------------|--------------------------------------------|----------------|-----------------------------------------| +| gcc (Linux) | 8.4.0 | 9.4.0 | 12.3.0 | +| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 | +| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2022 (17.11.5) | 2022 (17.12.3) | +| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 15.2 | +| [CMake](https://cmake.org/download/) | 3.26.3 | 3.26.3 | 3.31.6 | ## Cloning @@ -38,6 +38,20 @@ For most use cases, these two commands are all you need. They handle the entire You can use the `make build` target with variables for more control over the final binaries. + +## Creating Release Packages + +To create distributable packages (e.g., `.zip`, `.msi`, `.pkg`, `.deb`), run the `release` target. This will build the project, build the documentation, and then package everything. + + ```shell + make release TESTNET=1 + ``` +The final packages will be located in the `build/packages/` directory + +## Advanced Build Customization (Makefile Variables) + +For advanced use cases, you can override variables in the `Makefile` to customize the build process. + * **Build a `testnet` version:** ```shell make build TESTNET=1 @@ -46,37 +60,34 @@ You can use the `make build` target with variables for more control over the fin ```shell make build STATIC=1 ``` +* **Build a Debug build with 8 compile threads:** + ```shell + make build BUILD_TYPE=Debug CPU_CORES=8 + ``` +* **Use custom CMakePresets:** + ```shell + make build PRESET_CONFIGURE=my-config-preset PRESET_BUILD=my-build-preset + ``` -## Creating Release Packages +| Variable | Description | Default Value | +|--------------------|------------------------------------------------------------------------|-------------------------| +| `BUILD_TYPE` | Sets the build configuration (e.g., `Release`, `Debug`). | `Release` | +| `TESTNET` | Set to `1` to build for the test network. | `0` | +| `STATIC` | Set to `1` to link libraries statically. | `0` | +| `CPU_CORES` | Number of CPU cores to use for parallel compilation. | Auto-detected | +| `BUILD_VERSION` | The version string to embed in the binaries. | `6.0.1` | +| `BUILD_FOLDER` | The output directory for the build. | `build/release` | +| `PRESET_CONFIGURE` | The CMake preset to use for the `configure` step. | `conan-release` | +| `PRESET_BUILD` | The CMake preset to use for the `build` step. | `conan-release` | +| `CONAN_CACHE` | The path for the local Conan cache, where the dependencies are stored. | `./build/sdk` | +| `CONAN_EXECUTABLE` | The path to the usable Conan executable. | `./build/bin/conan` | +| `CONAN_URL` | The URL for the Conan remote repository. | `artifacts.host.uk.com` | +| `CONAN_USER` | The username for the Conan remote. | `public` | +| `CONAN_PASSWORD` | The password for the Conan remote. | | -To create distributable packages (e.g., `.zip`, `.deb`), run the `release` target. This will build the project, build the documentation, and then package everything. +## Cleaning the Build Directory - ```shell - make release - ``` -The final packages will be located in the `build/release/` directory +You can nuke the build directory with `make clean-build` -## Advanced Build Customization (Makefile Variables) - -For advanced use cases, you can override variables in the `Makefile` to customize the build process. - -Example: -```shell -make build BUILD_TYPE=Debug CPU_CORES=8 -``` - -| Variable | Description | Default Value | -|--------------------|------------------------------------------------------------------------|-------------------------------------------------------------------| -| `BUILD_TYPE` | Sets the build configuration (e.g., `Release`, `Debug`). | `Release` | -| `TESTNET` | Set to `1` to build for the test network. | `0` | -| `STATIC` | Set to `1` to link libraries statically. | `0` | -| `CPU_CORES` | Number of CPU cores to use for parallel compilation. | Auto-detected | -| `BUILD_VERSION` | The version string to embed in the binaries. | `6.0.1` | -| `BUILD_FOLDER` | The output directory for the build. | `build/release` | -| `PRESET_CONFIGURE` | The CMake preset to use for the `configure` step. | `conan-release` | -| `PRESET_BUILD` | The CMake preset to use for the `build` step. | `conan-release` | -| `CONAN_CACHE` | The path for the local Conan cache, where the dependencies are stored. | `./build/sdk` | -| `CONAN_EXECUTABLE` | The path to the usable Conan executable. | `./build/bin/conan` | -| `CONAN_URL` | The URL for the Conan remote repository. | `https://artifacts.host.uk.com/artifactory/api/conan/conan-build` | -| `CONAN_USER` | The username for the Conan remote. | `public` | -| `CONAN_PASSWORD` | The password for the Conan remote. | | \ No newline at end of file +To completely reset the build directory to its cached warm-up state, run `make clean`; +the selective clean script can be edited here: `cmake/CleanBuild.cmake` \ No newline at end of file