-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
A-build-scriptsArea: build.rs scriptsArea: build.rs scriptsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Description
Problem
i was trying to create an idiomatic template that uses clap_complete within build.rs in order to generate and install shell completions, when i realized it is basically impossible.
because cargo install only installs binaries, you have to use a Makefile, which is fine, but there's a problem:
build.rsis only supposed to create files under$OUT_DIR- the value of
$OUT_DIRis not easily accessible to outside programs - the makefile needs to know where the files are in order to install them
Proposed Solution
- add a mechanism for the main crate (i.e. the one the user said to build, not any of its dependancies) built to produce outputs in
$CARGO_TARGET_DIR(or a fixed subdir thereof, such astarget/release/aux) (low priority) add a(see Support installing manpages (and potentially other files) #2729)cargo::installinstruction that allows directingcargo installto install files relative to a configured prefix (eg..local,/usr, or/usr/local). usingcargo::install=$OUT_DIR/CMDNAME.bash=share/bash/bash-completions/completions/CMDNAMEwould install the completion in the specified completion dir.
Notes
No response
VorpalBlade, kornelski, BlueGlassBlock, ZeWaka and p--bultrasaurus and dphaldes
Metadata
Metadata
Assignees
Labels
A-build-scriptsArea: build.rs scriptsArea: build.rs scriptsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.