taler-rust

GNU Taler code in Rust. Largely core banking integrations.
Log | Files | Refs | Submodules | README | LICENSE

commit d05b51e0311cc01db1202d43f201ccdb9e4d6e2a
parent 3e47690be266b15c9f61478f8914c9a89e461774
Author: Antoine A <>
Date:   Thu, 15 Oct 2026 18:14:01 +0200

cli: cross compile deb packages

Diffstat:
MCargo.lock | 18+++++++++---------
MCargo.toml | 8++------
MMakefile | 2+-
MREADME.md | 2+-
Mbuild-system/configure.py | 14++------------
Mcontrib/ci/Containerfile | 15+++++++++------
Dcontrib/ci/jobs/4-deb-amd64/config.ini | 6------
Dcontrib/ci/jobs/4-deb-amd64/job.sh | 23-----------------------
Acontrib/ci/jobs/4-deb/config.ini | 5+++++
Acontrib/ci/jobs/4-deb/job.sh | 31+++++++++++++++++++++++++++++++
Rcontrib/ci/jobs/6-deploy/config.ini -> contrib/ci/jobs/5-deploy/config.ini | 0
Rcontrib/ci/jobs/6-deploy/job.sh -> contrib/ci/jobs/5-deploy/job.sh | 0
Mdebian/control | 9++-------
Mdebian/rules | 21+++++++++------------
14 files changed, 71 insertions(+), 83 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -400,9 +400,9 @@ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "combine" -version = "4.6.8" +version = "4.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" dependencies = [ "bytes", "memchr", @@ -624,9 +624,9 @@ dependencies = [ [[package]] name = "defmt" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2953bfe4f93bbd20cc71198842756f77d161884c99ebbabc41d80231ded88d1" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" dependencies = [ "bitflags 1.3.2", "defmt-macros", @@ -634,21 +634,21 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad9c72e7ca2137e0dc3813245a0d282fd6daad32fd800af018306a9169b5fe8" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" dependencies = [ "defmt-parser", "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.9", ] [[package]] name = "defmt-parser" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" dependencies = [ "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml @@ -5,12 +5,8 @@ members = ["common/*", "adapters/*", "taler-apns-relay"] [workspace.package] version = "1.5.0" edition = "2024" -# Newest standard-library item the tree uses is std::fmt::from_fn (1.93); let -# chains (1.88) and Vec::pop_if (1.86) sit below it, edition 2024 needs 1.85. -# Declared so that cargo rejects an old toolchain with one clear message instead -# of hundreds of errors. Keep in step with RUST_MIN_VERSION in -# build-system/configure.py. -rust-version = "1.93" +# Keep in sync with RUST_MIN_VERSION in build-system/configure.py. +rust-version = "1.95" authors = ["Taler Systems SA <deb@taler.net>"] homepage = "https://taler.net/" repository = "https://git.taler.net/taler-rust.git" diff --git a/Makefile b/Makefile @@ -66,7 +66,7 @@ doc: .PHONY: deb deb: - dpkg-buildpackage -b -uc -us + dpkg-buildpackage -b -uc -us $(if $(DEB_HOST_ARCH),-a$(DEB_HOST_ARCH)) .PHONY: ci ci: diff --git a/README.md b/README.md @@ -48,7 +48,7 @@ file and fail if it is missing or does not contain a nonempty single-line version. Any Rust toolchain on `$PATH` will do, distribution packages included; `rustup` -is not required. The tree needs **rustc >= 1.93**, so on Debian stable install +is not required. The tree needs **rustc >= 1.95**, so on Debian stable install it from backports (`sudo apt install -t trixie-backports rustc cargo`). ```sh diff --git a/build-system/configure.py b/build-system/configure.py @@ -13,18 +13,8 @@ import subprocess import sys -# Oldest Rust release that can build this tree. Keep the reason for the number -# next to it -- the point of the check is to report an unusable toolchain here, -# once, instead of as a wall of parse errors in the middle of the build. -# -# 1.85 edition 2024 / resolver "3" (Cargo.toml) -# 1.86 Vec::pop_if (common/failure-injection) -# 1.88 let chains (used throughout) -# 1.93 std::fmt::from_fn (taler-common, taler-api, taler-wise) -# -# Debian trixie ships 1.85, which is too old; trixie-backports and testing both -# ship a new enough rustc. Keep this in step with `rust-version` in Cargo.toml. -RUST_MIN_VERSION = "1.93" +# Supported Rust baseline from trixie-backports; keep in sync with Cargo.toml. +RUST_MIN_VERSION = "1.95" BUILD_VARIABLE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*=.*", re.DOTALL) diff --git a/contrib/ci/Containerfile b/contrib/ci/Containerfile @@ -3,7 +3,9 @@ FROM docker.io/library/debian:trixie ENV DEBIAN_FRONTEND=noninteractive # Apt sync -RUN apt-get update -yq && \ +RUN dpkg --add-architecture amd64 && \ + dpkg --add-architecture arm64 && \ + apt-get update -yq && \ apt-get upgrade -yq && \ # Install build & test dependencies apt-get install -yq \ @@ -15,15 +17,16 @@ RUN apt-get update -yq && \ postgresql \ debhelper \ build-essential \ + crossbuild-essential-amd64 \ + crossbuild-essential-arm64 \ git-buildpackage && \ - # Rust from trixie-backports: trixie itself ships 1.85, this tree needs - # >= 1.93 (std::fmt::from_fn). Backports keeps the base image -- and - # therefore the glibc the .deb is linked against -- on stable, which - # matters because the artifacts are published to a trixie repository. + # Use Rust from backports while keeping the trixie base system. echo 'deb http://deb.debian.org/debian trixie-backports main' \ > /etc/apt/sources.list.d/backports.list && \ apt-get update -yq && \ - apt-get install -yq -t trixie-backports rustc cargo rust-clippy && \ + # Native rustc and both target libraries must have the same version. + apt-get install -yq -t trixie-backports rustc cargo rust-clippy \ + libstd-rust-dev:amd64 libstd-rust-dev:arm64 && \ rm -rf /var/lib/apt/lists/* WORKDIR /workdir diff --git a/contrib/ci/jobs/4-deb-amd64/config.ini b/contrib/ci/jobs/4-deb-amd64/config.ini @@ -1,6 +0,0 @@ -[build] -HALT_ON_FAILURE = True -WARN_ON_FAILURE = True -CONTAINER_BUILD = True -CONTAINER_NAME = localhost/taler-rust:amd64 -CONTAINER_ARCH = amd64 diff --git a/contrib/ci/jobs/4-deb-amd64/job.sh b/contrib/ci/jobs/4-deb-amd64/job.sh @@ -1,22 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# Update system -apt-get update -yq -apt-get upgrade -yq - -# Build package -VERSION="$(./contrib/ci/version.sh)" -export VERSION -: "${VERSION:?version generation returned an empty version}" -echo "Building package version ${VERSION}" -EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" -make deb - -# Test package -sudo ./contrib/ci/deb-test.sh - -# Move to artifact -ls -alh ../*.deb -mkdir -p /artifacts/taler-rust/${CI_COMMIT_REF} -mv ../*.deb /artifacts/taler-rust/${CI_COMMIT_REF} -\ No newline at end of file diff --git a/contrib/ci/jobs/4-deb/config.ini b/contrib/ci/jobs/4-deb/config.ini @@ -0,0 +1,5 @@ +[build] +HALT_ON_FAILURE = True +WARN_ON_FAILURE = True +CONTAINER_BUILD = True +CONTAINER_NAME = localhost/taler-rust diff --git a/contrib/ci/jobs/4-deb/job.sh b/contrib/ci/jobs/4-deb/job.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -exuo pipefail + +# Update system +apt-get update -yq +apt-get upgrade -yq + +./bootstrap + +# Build package +VERSION="$(./contrib/ci/version.sh)" +export VERSION +: "${VERSION:?version generation returned an empty version}" +echo "Building package version ${VERSION}" +EMAIL=none gbp dch --dch-opt=-b --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}" +make deb + +# Test package +sudo ./contrib/ci/deb-test.sh + +# Cross-compile the other supported architecture. +case "$(dpkg --print-architecture)" in + amd64) make deb DEB_HOST_ARCH=arm64 ;; + arm64) make deb DEB_HOST_ARCH=amd64 ;; +esac + +# Move to artifact +ls -alh ../*.deb +mkdir -p /artifacts/taler-rust/${CI_COMMIT_REF} +mv ../*.deb /artifacts/taler-rust/${CI_COMMIT_REF} +\ No newline at end of file diff --git a/contrib/ci/jobs/6-deploy/config.ini b/contrib/ci/jobs/5-deploy/config.ini diff --git a/contrib/ci/jobs/6-deploy/job.sh b/contrib/ci/jobs/5-deploy/job.sh diff --git a/debian/control b/debian/control @@ -6,13 +6,8 @@ Uploaders: Christian Grothoff <grothoff@gnu.org>, Florian Dold <dold@taler.net> Rules-Requires-Root: no Build-Depends: debhelper-compat (= 13), - cargo | rustup, -# 1.93, not 1.85: taler-common/taler-api use std::fmt::from_fn, stabilised in -# 1.93 (let-chains, 1.88, and Vec::pop_if, 1.86, put the floor above trixie's -# 1.85 already). Use trixie-backports for the packaged compiler, or rustup -# with a toolchain >= 1.93 as in the taler-deployment build images. -# Cargo.toml enforces the compiler minimum for either toolchain source. - rustc (>= 1.93) | rustup + cargo:native, + rustc:native (>= 1.95) Standards-Version: 4.7.2 Vcs-Git: https://git.taler.net/taler-rust.git Homepage: https://taler.net/ diff --git a/debian/rules b/debian/rules @@ -1,23 +1,20 @@ #!/usr/bin/make -f +export CARGO_BUILD_TARGET = $(DEB_HOST_GNU_CPU)-unknown-linux-gnu +export RUSTFLAGS += -C linker=$(DEB_HOST_GNU_TYPE)-gcc + +# Keep Debian flags off native build dependencies. +export CFLAGS_$(subst -,_,$(CARGO_BUILD_TARGET)) = $(CFLAGS) $(CPPFLAGS) + %: dh $@ --no-parallel -override_dh_auto_configure: - # Nothing to configure: debian/*.install hardcodes the /usr paths and the - # build only needs a cargo from $PATH (see Build-Depends). The step is - # still overridden so that dh does not hand ./configure the autoconf-style - # arguments it does not accept. +override_dh_auto_configure override_dh_auto_test override_dh_auto_install: true override_dh_auto_build: - make build - -override_dh_auto_test: - true - -override_dh_auto_install: - true + env -u CFLAGS $(MAKE) build + install -t target/release $(addprefix target/$(CARGO_BUILD_TARGET)/release/,$(shell dh_listpackages)) override_dh_installsystemd: dh_installsystemd --no-enable --no-start --no-stop-on-upgrade --name taler-magnet-bank-httpd