1
0
Fork 0
forked from lthn/blockchain

Add CPack packaging and update build system

Introduces CPack-based packaging with a new CPackConfig.cmake and related configuration variables. Updates Makefile and CMakeLists.txt to support packaging, renames project to Lethean, and adjusts workflow files to use unified 'release' build and artifact upload. Also adds install rules for main binaries and comments out install steps in libmdbx submodules.
This commit is contained in:
Snider 2025-09-28 14:35:11 +01:00
parent 7d7cfb7a5b
commit 9412c22166
11 changed files with 146 additions and 30 deletions

View file

@ -28,13 +28,21 @@ jobs:
home: ${{ github.workspace }}/build/sdk
cache_packages: true
- name: Compile Release
run: make apple-clang-armv8 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
# - name: Compile Release
# run: make apple-clang-armv8 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
- name: CLI Artifacts
uses: ./.github/actions/upload-artifacts
- name: Compile Release
run: make release TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
- uses: actions/upload-artifact@v4
with:
chain-network: ${{ inputs.chain-network }}
assets: lethean-*
asset-type: 'cli'
asset-directory: ${{ github.workspace }}/build/apple-clang-armv8/src
name: "${{ inputs.chain-network == 'testnet' && 'testnet-' || '' }}apple-clang-armv8"
path: ${{ github.workspace }}/build/release/packages/lethean-*
# - name: CLI Artifacts
# uses: ./.github/actions/upload-artifacts
# with:
# chain-network: ${{ inputs.chain-network }}
# assets: lethean-*
# asset-type: 'cli'
# asset-directory: ${{ github.workspace }}/build/apple-clang-armv8/src

View file

@ -28,12 +28,19 @@ jobs:
cache_packages: true
- name: Compile Release
run: make msvc-194-x86_64 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
run: make release TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
#
# - name: Compile Release
# run: make msvc-194-x86_64 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
- name: CLI Artifacts
uses: ./.github/actions/upload-artifacts
- uses: actions/upload-artifact@v4
with:
chain-network: ${{ inputs.chain-network }}
assets: lethean-*
asset-type: 'cli'
asset-directory: ${{ github.workspace }}/build/msvc-194-x86_64/src/Release
name: "${{ inputs.chain-network == 'testnet' && 'testnet-' || '' }}cli-msvc-194-x86_64"
path: ${{ github.workspace }}/build/release/packages/lethean-*
# - name: CLI Artifacts
# uses: ./.github/actions/upload-artifacts
# with:
# chain-network: ${{ inputs.chain-network }}
# assets: lethean-*
# asset-type: 'cli'
# asset-directory: ${{ github.workspace }}/build/release/packages

View file

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
set(DISABLE_TOR TRUE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
PROJECT(Zano)
PROJECT(Lethean)
set(VERSION "1.0")
message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
@ -297,7 +297,7 @@ else()
endif()
endif()
set(BUILD_TESTS FALSE CACHE BOOL "Build Zano tests")
set(BUILD_TESTS FALSE CACHE BOOL "Build Lethean tests")
set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
if(NOT DISABLE_MDBX)
add_definitions(-DENABLED_ENGINE_MDBX)
@ -310,3 +310,5 @@ add_subdirectory(src)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
include(CPackConfig)

View file

@ -11,7 +11,7 @@
# Default to “unknown” will be overwritten below.
CPU_CORES := 1
TESTNET ?= 0
TESTNET:= 0
BUILD_TYPE ?=Release
# -----------------------------------------------------------------
@ -80,10 +80,11 @@ CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile
all: help
release: conan-profile-detect
@echo "Building profile: release"
@echo "Building profile: release $(TESTNET)"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=$(BUILD_TYPE)
cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=$(TESTNET)
cmake --build build/release --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
(cd build/release && cpack)
debug: conan-profile-detect
@echo "Building profile: debug"

79
cmake/CPackConfig.cmake Normal file
View file

@ -0,0 +1,79 @@
include(${CMAKE_SOURCE_DIR}/cmake/config-vars.cmake)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CPACK_PACKAGE_NAME "${package_name}")
set(CPACK_PACKAGE_VENDOR "${package_vendor}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${package_description}")
set(CPACK_PACKAGE_VERSION "${package_version}")
set(CPACK_PACKAGE_CONTACT "${package_contact}")
set(CPACK_PACKAGE_HOMEPAGE_URL "${package_website}")
# set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") # Linux/macOS default
# if(WIN32)
# set(CPACK_PACKAGING_INSTALL_PREFIX "C:/Program Files/${PROJECT_NAME}")
# endif()
if(APPLE)
if("${package_macos_installer}" STREQUAL "DMG")
set(CPACK_GENERATOR "DragNDrop")
# set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/resources/dmg_background.png")
set(CPACK_DMG_VOLUME_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
message("Registered CPACK_GENERATOR: DragNDrop")
else ()
set(CPACK_GENERATOR "productbuild")
set(CPACK_PRODUCTBUILD_IDENTIFIER "${package_macos_pkg_productbuild_identifier}")
# set(CPACK_PRODUCTBUILD_SIGNING_IDENTITY "Developer ID Installer: Your Company (TEAMID)")
message("Registered CPACK_GENERATOR: productbuild")
endif ()
elseif(WIN32)
set(CPACK_GENERATOR "WIX")
message("Registered CPACK_GENERATOR: WIX")
# set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/resources/windows_icon.ico")
# set(CPACK_WIX_LICENSE_RTF "${CMAKE_SOURCE_DIR}/LICENSE.rtf")
# set(CPACK_WIX_UPGRADE_GUID "D3F5A9C1-4B2E-4F5A-9C71-123456789ABC") # change once per major version
else()
set(CPACK_GENERATOR "DEB")
message("Registered CPACK_GENERATOR: deb")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${package_contact}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28)")
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
# postinstall script (e.g., to register a systemd service)
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# "${CMAKE_SOURCE_DIR}/scripts/postinstall.sh")
endif()
list(APPEND CPACK_GENERATOR "TXZ" "ZIP")
message( "Registered CPACK_GENERATOR: tgz")
message( "Registered CPACK_GENERATOR: zip")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
set(CPACK_COMPONENTS_ALL)
set(CPACK_GENERATE_SHASUM ON)
set(CPACK_SHASUM_ALGORITHM SHA256)
message( "Using SHA256 Checksums")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
# set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/packages")
install(FILES README.md LICENSE.txt
DESTINATION .
)
set(_arch "${CMAKE_SYSTEM_PROCESSOR}")
if(_arch MATCHES "AMD64|x86_64")
set(_arch "x86_64")
elseif(_arch MATCHES "arm64|aarch64")
set(_arch "arm64")
endif()
string(TOLOWER "${CMAKE_SYSTEM_NAME}" _sys_name_lc)
set(CPACK_PACKAGE_FILE_NAME
"${package_name}-${CPACK_PACKAGE_VERSION}-${_sys_name_lc}-${_arch}")
include(CPack)
endif()

View file

@ -10,6 +10,8 @@ set(currency_display_decimal_point 12 CACHE STRING "CURRENCY_DISPLAY_DECIMAL_POI
set(currency_name_abr "LTHN" CACHE STRING "CURRENCY_NAME_ABR" )
set(currency_name_base "Lethean" CACHE STRING "CURRENCY_NAME_BASE" )
set(currency_name_short_base "Lethean" CACHE STRING "CURRENCY_NAME_SHORT_BASE" )
# prefix is 'iT', non auditable wallets then use 'H', auditable wallets use 'h'; 'N' is a base addr, 'n' is a sub address,
set(address_prefix 0x1eaf7 CACHE STRING "CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX" ) # addresses start with 'iTHN'
set(address_prefix_integrated 0xdeaf7 CACHE STRING "CURRENCY_PUBLIC_INTEG_ADDRESS_V2_BASE58_PREFIX" ) # integrated addresses start with 'iTHn'
@ -29,8 +31,22 @@ if (TESTNET)
set(p2p_default_port 36942 CACHE STRING "P2P_DEFAULT_PORT" )
set(rpc_default_port 36941 CACHE STRING "RPC_DEFAULT_PORT" )
set(stratum_default_port 36940 CACHE STRING "STRATUM_DEFAULT_PORT" )
set(package_name "lethean-testnet-cli" CACHE STRING "CPACK_PACKAGE_NAME" )
else ()
message(CHECK_FAIL "bad")
set(p2p_default_port 36942 CACHE STRING "P2P_DEFAULT_PORT" )
set(rpc_default_port 36941 CACHE STRING "RPC_DEFAULT_PORT" )
set(stratum_default_port 36940 CACHE STRING "STRATUM_DEFAULT_PORT" )
set(package_name "lethean-cli" CACHE STRING "CPACK_PACKAGE_NAME" )
endif ()
# installer config
set(package_vendor "Lethean Community" CACHE STRING "CPACK_PACKAGE_VENDOR" )
set(package_description "A privacypreserving blockchain node" CACHE STRING "CPACK_PACKAGE_DESCRIPTION_SUMMARY" )
set(package_version "1.0.0" CACHE STRING "CPACK_PACKAGE_VERSION" )
set(package_contact "support@lt.hn" CACHE STRING "CPACK_PACKAGE_CONTACT" )
set(package_website "https://github.com/letheanVPN/blockchain" CACHE STRING "CPACK_PACKAGE_HOMEPAGE_URL" )
set(package_macos_installer "PKG" CACHE STRING "CPACK_GENERATOR" )
set(package_macos_dmg_background "DMG" CACHE STRING "CPACK_DMG_BACKGROUND_IMAGE" )
set(package_macos_pkg_productbuild_identifier "com.lethean.blockchainnode" CACHE STRING "CPACK_PRODUCTBUILD_IDENTIFIER" )
set(package_macos_pkg_productbuild_signer "Developer ID Installer: Your Company (TEAMID)" CACHE STRING "CPACK_PRODUCTBUILD_SIGNING_IDENTITY" )

View file

@ -126,9 +126,9 @@ if(UNIX AND NOT APPLE)
target_link_libraries(${TARGET}_SHARED rt)
endif()
install(TARGETS ${TARGET}_STATIC DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
install(TARGETS ${TARGET}_SHARED DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
install(FILES mdbx.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include COMPONENT mdbx-devel)
#install(TARGETS ${TARGET}_STATIC DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
#install(TARGETS ${TARGET}_SHARED DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
#install(FILES mdbx.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include COMPONENT mdbx-devel)
add_subdirectory(src/tools)
add_subdirectory(test)

View file

@ -61,12 +61,12 @@ if(CC_HAS_VISIBILITY)
target_compile_options(mdbx PRIVATE "-fvisibility=hidden")
endif()
install(TARGETS mdbx
LIBRARY DESTINATION lib COMPONENT runtime
RUNTIME DESTINATION bin COMPONENT runtime
ARCHIVE DESTINATION lib/static COMPONENT devel
PUBLIC_HEADER DESTINATION include
INCLUDES DESTINATION include COMPONENT devel)
#install(TARGETS mdbx
# LIBRARY DESTINATION lib COMPONENT runtime
# RUNTIME DESTINATION bin COMPONENT runtime
# ARCHIVE DESTINATION lib/static COMPONENT devel
# PUBLIC_HEADER DESTINATION include
# INCLUDES DESTINATION include COMPONENT devel)
################################################################################
#

View file

@ -32,8 +32,8 @@ foreach(TOOL ${MDBX_TOOLS})
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT mdbx)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../man1/${TOOL}.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1 COMPONENT mdbx)
# install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT mdbx)
# install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../man1/${TOOL}.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1 COMPONENT mdbx)
endforeach()
if(LIB_MATH)

View file

@ -189,3 +189,6 @@ else ()
set_property(TARGET connectivity_tool PROPERTY OUTPUT_NAME "lethean-testnet-chain-tool")
endif ()
install(TARGETS daemon simplewallet
RUNTIME DESTINATION bin)