Files
rippled/pkgs/deb/debian/rules
2025-10-30 16:26:43 -07:00

78 lines
2.8 KiB
Makefile
Executable File

#!/usr/bin/make -f
export DH_VERBOSE = 1
export DH_OPTIONS = -v
## TODO: Confirm these are still required.
# debuild sets some warnings that don't work well
# for our curent build..so try to remove those flags here:
export CFLAGS:=$(subst -Wformat,,$(CFLAGS))
export CFLAGS:=$(subst -Werror=format-security,,$(CFLAGS))
export CXXFLAGS:=$(subst -Wformat,,$(CXXFLAGS))
export CXXFLAGS:=$(subst -Werror=format-security,,$(CXXFLAGS))
## TODO: Confirm these are still required.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_BUILD_OPTIONS = nodwz
export RIPPLE_REMOTE = xrplf
export RIPPLE_REMOTE_URL = https://conan.ripplex.io
# ## CMake Configure args
# export DEB_CMAKE_GENERATOR = Ninja
export DEB_CMAKE_BUILD_TYPE = Release
NPROC := $(shell nproc --ignore=2)
export DEB_BUILD_OPTIONS += parallel=$(NPROC)
CONAN_HOME := $(shell conan config home)
CONAN_PROFILE := $(shell conan profile path default)
CONAN_GCONF := $(CONAN_HOME)/global.conf
INSTALL_PREFIX := "/opt/ripple"
BUILD_DIR := obj-$(DEB_BUILD_GNU_TYPE)
.ONESHELL:
SHELL := /bin/bash
%:
dh $@ --buildsystem=cmake
override_dh_installsystemd:
dh_installsystemd --no-start
override_dh_auto_configure:
conan remote add --index 0 $(RIPPLE_REMOTE) $(RIPPLE_REMOTE_URL) --force
conan config install ./conan/profiles/default --target-folder $(CONAN_HOME)/profiles
echo "tools.build:jobs={{ os.cpu_count() - 2 }}" >> ${CONAN_HOME}/global.conf
echo "core.download:parallel={{ os.cpu_count() }}" >> $(CONAN_GCONF)
conan install . \
--settings:all build_type=$(DEB_CMAKE_BUILD_TYPE) \
--output-folder=$(BUILD_DIR) \
--options:host "&:xrpld=True" \
--options:host "&:tests=True" \
--build=missing
# Debian assumes an offline build process and sets CMake's FETCHCONTENT_FULLY_DISCONNECTED variable to ON
# To use as much as the default settings as possible we'll clone it where CMake's FetchContent expects it.
mkdir -p "$(BUILD_DIR)/_deps"
git clone https://github.com/ripple/validator-keys-tool.git "$(BUILD_DIR)/_deps/validator_keys-src"
dh_auto_configure --builddirectory=$(BUILD_DIR) -- \
-DCMAKE_BUILD_TYPE:STRING=$(DEB_CMAKE_BUILD_TYPE) \
-Dxrpld=ON -Dtests=ON -Dvalidator_keys=ON \
-DCMAKE_INSTALL_PREFIX:PATH=$(INSTALL_PREFIX) \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=$(BUILD_DIR)/build/generators/conan_toolchain.cmake
override_dh_auto_build:
dh_auto_build \
--builddirectory=$(BUILD_DIR) -- rippled validator-keys
override_dh_auto_install:
cmake --install $(BUILD_DIR) --prefix debian/tmp/opt/ripple
install -D update-rippled.sh debian/tmp/opt/ripple/bin/update-rippled.sh
install -D update-rippled-cron debian/tmp/opt/ripple/etc/update-rippled-cron
install -D rippled-logrotate debian/tmp/etc/logrotate.d/rippled
rm -rf debian/tmp/opt/ripple/lib64/cmake/date
override_dh_dwz:
@echo "Skipping DWZ due to huge debug info"