tech-pkg archive

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

Re: [PATCH] Cargo build product directory: CARGO_TARGET_DIR



On Thu, Feb 06, 2025 at 02:17:21PM +0000, Taylor R Campbell wrote:
> By default, cargo puts build products in ${WRKSRC}/target/release, and
> some do-install recipes use this, e.g. textproc/dbcat:
> 
> do-install:
> 	${INSTALL_PROGRAM} ${WRKSRC}/target/release/dbcat ${DESTDIR}${PREFIX}/bin

Since I think this accounts for 99% of the use cases, let me hijack
this thread.

These do-install rules are only needed because for some rust packages,
the default cargo-do-install target from lang/rust/cargo.mk doesn't
work.

On the example of ast-grep, when I remove the do-install target, I see:

===> Installing for ast-grep-0.34.4
=> Generating pre-install file lists
error: found a virtual manifest at `/scratch/devel/ast-grep/work/ast-grep-0.34.4/Cargo.toml` instead of a package manifest
*** Error code 101

The code in lang/rust/cargo.mk basically expands to:

cd ${WRKSRC} && /usr/pkg/bin/cargo install --path . --root /scratch/devel/ast-grep/work/.destdir/usr/pkg --offline -j16

Does anyone know what this error wants to tell us, and how to get
around it?


Even if we don't find a fix this, I think if we add a variable
CARGO_BINARIES and add a rule in cargo.mk to install the files listed
in it manually (with basically the do-install from your mail above),
we can limit the scope of the variable you want to introduce to that
file.

Cheers,
 Thomas


Home | Main Index | Thread Index | Old Index