From 7ae095e8119337a2f09ab4f48da75110742fccfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?= Date: Tue, 1 Nov 2022 18:40:18 +0100 Subject: [PATCH] build-style/cargo: produce auditable binaries --- common/build-style/cargo.sh | 6 +++--- common/environment/build-style/cargo.sh | 4 ++++ srcpkgs/cargo-auditable-bootstrap/template | 21 +++++++++++++++++++++ srcpkgs/cargo-auditable/template | 8 ++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/cargo-auditable-bootstrap/template diff --git a/common/build-style/cargo.sh b/common/build-style/cargo.sh index 4c456394df5b..387e711060bc 100644 --- a/common/build-style/cargo.sh +++ b/common/build-style/cargo.sh @@ -3,20 +3,20 @@ # do_build() { - : ${make_cmd:=cargo} + : ${make_cmd:=cargo auditable} ${make_cmd} build --release --target ${RUST_TARGET} ${configure_args} } do_check() { - : ${make_cmd:=cargo} + : ${make_cmd:=cargo auditable} ${make_check_pre} ${make_cmd} test --release --target ${RUST_TARGET} ${configure_args} \ ${make_check_args} } do_install() { - : ${make_cmd:=cargo} + : ${make_cmd:=cargo auditable} : ${make_install_args:=--path .} ${make_cmd} install --target ${RUST_TARGET} --root="${DESTDIR}/usr" \ diff --git a/common/environment/build-style/cargo.sh b/common/environment/build-style/cargo.sh index c7c9863a055f..15f508651629 100644 --- a/common/environment/build-style/cargo.sh +++ b/common/environment/build-style/cargo.sh @@ -1,5 +1,9 @@ hostmakedepends+=" cargo" +if [ "$pkgname" != "cargo-auditable" ] && [ "$pkgname" != "cargo-auditable-bootstrap" ]; then + hostmakedepends+=" cargo-auditable" +fi + if [ "$CROSS_BUILD" ]; then makedepends+=" rust-std" fi diff --git a/srcpkgs/cargo-auditable-bootstrap/template b/srcpkgs/cargo-auditable-bootstrap/template new file mode 100644 index 000000000000..7658e1390f9b --- /dev/null +++ b/srcpkgs/cargo-auditable-bootstrap/template @@ -0,0 +1,21 @@ +# Template file for 'cargo-auditable-bootstrap' +# Keep synced with cargo-auditable +pkgname=cargo-auditable-bootstrap +version=0.5.2 +revision=1 +wrksrc=cargo-auditable-${version} +build_wrksrc=cargo-auditable +build_style=cargo +# Required for bootstrapping purposes +make_cmd=cargo +short_desc="Bootstrap package for cargo-auditable" +maintainer="Jan Christian Grünhage " +license="MIT,Apache-2.0" +homepage="https://github.com/rust-secure-code/cargo-auditable" +distfiles="https://github.com/rust-secure-code/cargo-auditable/archive/refs/tags/v${version}.tar.gz" +checksum=fee70e8d2354e47eba1fed767430c12423c2a93c37307ae4c7d977c7693b88dd +conflicts=cargo-auditable-bootstrap + +post_install() { + vlicense ../LICENSE-MIT +} diff --git a/srcpkgs/cargo-auditable/template b/srcpkgs/cargo-auditable/template index 0f95e6dc4d65..86f481e93ccf 100644 --- a/srcpkgs/cargo-auditable/template +++ b/srcpkgs/cargo-auditable/template @@ -1,4 +1,5 @@ # Template file for 'cargo-auditable' +# Keep synced with cargo-auditable-bootstrap pkgname=cargo-auditable version=0.5.2 revision=1 @@ -10,6 +11,13 @@ license="MIT,Apache-2.0" homepage="https://github.com/rust-secure-code/cargo-auditable" distfiles="https://github.com/rust-secure-code/cargo-auditable/archive/refs/tags/v${version}.tar.gz" checksum=fee70e8d2354e47eba1fed767430c12423c2a93c37307ae4c7d977c7693b88dd +conflicts=cargo-auditable-bootstrap + +if [ "$CROSS_BUILD" ]; then + hostmakedepends="cargo-auditable" +else + hostmakedepends="cargo-auditable-bootstrap" +fi post_install() { vlicense ../LICENSE-MIT