pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

rust: sync cargo.mk from pkgsrc



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By:	wiz
Date:		Mon May 15 22:07:57 2023 +0200
Changeset:	9e91a207a48946c983a3bb568f762a821ad27447

Modified Files:
	rust/cargo.mk

Log Message:
rust: sync cargo.mk from pkgsrc

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=9e91a207a48946c983a3bb568f762a821ad27447

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 rust/cargo.mk | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diffs:
diff --git a/rust/cargo.mk b/rust/cargo.mk
index a0e70fd58b..6441b7d125 100644
--- a/rust/cargo.mk
+++ b/rust/cargo.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cargo.mk,v 1.24 2021/01/12 15:37:32 jperkin Exp $
+# $NetBSD: cargo.mk,v 1.34 2023/05/15 20:07:36 wiz Exp $
 #
 # Common logic that can be used by packages that depend on cargo crates
 # from crates.io. This lets existing pkgsrc infrastructure fetch and verify
@@ -29,6 +29,7 @@ USE_TOOLS+=		bsdtar
 CARGO_VENDOR_DIR=	${WRKDIR}/vendor
 CARGO_WRKSRC?=		${WRKSRC}
 
+# TODO: some Cargo.lock files include git+https sources which need to be fetched from the URL (not necessarily resolving to a crate.io url)
 DISTFILES?=			${DEFAULT_DISTFILES}
 .for crate in ${CARGO_CRATE_DEPENDS}
 DISTFILES+=			${crate}.crate
@@ -69,11 +70,12 @@ print-cargo-depends:
 			print "CARGO_CRATE_DEPENDS+=\t" name "-" vers;	\
 			}' ${CARGO_WRKSRC}/Cargo.lock
 
-DEFAULT_CARGO_ARGS=	build --offline --release -j${_MAKE_JOBS_N}	\
+DEFAULT_CARGO_ARGS=	--offline -j${_MAKE_JOBS_N}	\
 			  ${CARGO_NO_DEFAULT_FEATURES:M[yY][eE][sS]:C/[yY][eE][sS]/--no-default-features/}	\
 			  ${CARGO_FEATURES:C/.*/--features/W}	\
 			  ${CARGO_FEATURES:S/ /,/Wg}
-CARGO_ARGS?=		${DEFAULT_CARGO_ARGS}
+CARGO_ARGS?=		build --release ${DEFAULT_CARGO_ARGS}
+CARGO_INSTALL_ARGS?=	install --path . --root ${DESTDIR}${PREFIX} ${DEFAULT_CARGO_ARGS}
 
 MAKE_ENV+=		RUSTFLAGS=${RUSTFLAGS:Q}
 
@@ -84,3 +86,14 @@ do-build: do-cargo-build
 .PHONY: do-cargo-build
 do-cargo-build:
 	${RUN} cd ${CARGO_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_ARGS}
+
+.if !target(do-install)
+do-install: do-cargo-install
+.endif
+
+.PHONY: do-cargo-install
+do-cargo-install:
+	${RUN} cd ${CARGO_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_INSTALL_ARGS}
+	# remove files cargo uses for tracking installations
+	${RM} -f ${DESTDIR}${PREFIX}/.crates.toml
+	${RM} -f ${DESTDIR}${PREFIX}/.crates2.json


Home | Main Index | Thread Index | Old Index