-
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-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
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.rs
is only supposed to create files under$OUT_DIR
- the value of
$OUT_DIR
is 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::install
instruction that allows directingcargo install
to install files relative to a configured prefix (eg..local
,/usr
, or/usr/local
). usingcargo::install=$OUT_DIR/CMDNAME.bash=share/bash/bash-completions/completions/CMDNAME
would install the completion in the specified completion dir.
Notes
No response
VorpalBlade, kornelski, BlueGlassBlock and ZeWaka
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-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.