Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post cargo install hook #11539

Closed
NicholasLYang opened this issue Jan 4, 2023 · 1 comment
Closed

Post cargo install hook #11539

NicholasLYang opened this issue Jan 4, 2023 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@NicholasLYang
Copy link

Problem

I'm building a Rust binary that relies on a second binary1 that the first one executes. I have the build.rs file that builds this second binary and places it next to the Rust binary. However, when I run cargo install, if I'm understanding this correctly, the Rust binary is first built then copied into the installation root. Is there a way to execute some code after cargo install that moves the second binary to the installation root as well?

Proposed Solution

Either a way of detecting in build.rs that we are running cargo install (maybe an environment variable?), or some sort of post-install hook that can let users customize the cargo install process.

Notes

No response

Footnotes

  1. I can't link the two programs because of complicated issues.

@NicholasLYang NicholasLYang added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 4, 2023
@ehuss
Copy link
Contributor

ehuss commented Jan 4, 2023

I don't believe there is currently a mechanism to do that. The current recommended approach is to use an outer general-purpose build system (or write your own scripts using the cargo-xtask pattern). I believe this is more or less a duplicate of #2386, so closing in favor of that.

@NicholasLYang NicholasLYang closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants