Skip to content

Install: add a bindir flag or similar #10748

Open
@1480c1

Description

@1480c1

Problem

Currently, "bin" is always suffixed onto the root, meaning it's really hard when trying to deal with installing binaries from a project into a separate directly, that's not specifically bin (for example, if I have a video related tool, I might install it into $root/bin-video, and $root/bin-audio for an audio related tool, and so on).

I currently have to do something like

cargo build --release ...
install -D -p target/*/release/*.exe "$root/bin-video"

and that's not very desirable and very fragile.

I tried looking to see if a similar issue existed, but could not find anything yet.

Proposed Solution

One solution would be to add a flag to cargo install that would take a relative path to --root, and if not provided, default to "bin", and that would be used in the below code locations instead of the current contant strings.

let dst = root.join("bin").into_path_unlocked();

let dst = root.join("bin").into_path_unlocked();

let dst = self.root.join("bin").into_path_unlocked();

So, something like --root /mycustomprefix --bindir bin-video would install the executables into /mycustomprefix/bin-video instead of /mycustomprefix/bin

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-installS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions