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

Pass the value of project.links into the build script #1220

Closed
mzabaluev opened this issue Jan 24, 2015 · 5 comments · Fixed by #2710
Closed

Pass the value of project.links into the build script #1220

mzabaluev opened this issue Jan 24, 2015 · 5 comments · Fixed by #2710
Labels
E-easy Experience: Easy

Comments

@mzabaluev
Copy link

It would be nice if the project's links value was available to the build script.
Then build helpers like pkg-config could read that, so that build.rs could be a drop-in file suitable for all -sys projects where the library provides a pkg-config file with the same name.

@mzabaluev
Copy link
Author

Cc @alexcrichton

@alexcrichton
Copy link
Member

Sounds like a good idea to me! Passing something like LIB or some other environment variable to the build script should work ok.

@alexcrichton alexcrichton added the E-easy Experience: Easy label Jan 25, 2015
sbeckeriv added a commit to sbeckeriv/cargo that referenced this issue May 16, 2016
Dearest reviewer,

This pull request allows the value of project.links to be passed into
the build script via an environment variable. This closes rust-lang#1220 . I have
added a test that makes sure that the environment variable is set. Also
note I am using RUST_LIB not LIB because it appears to be used for
windows in appveyor. I think RUST_LIB fits better.

At the core of it when the manifest is created the code now check for
the environment variable and uses it instead of the value from the
file.

I have also updated the documentation to reflect the new variable.

Thanks!
Becker
@sbeckeriv
Copy link
Contributor

I did it backwards in my pull request. I was setting the links based on a variable. I am told I need to set the environment variable based on the links value. I am looking into setting the environment variable now. It looks like the standard lib https://doc.rust-lang.org/std/env/fn.set_var.html only sets the variable for the current running process. Which matches up with what I am seeing building /~https://github.com/PistonDevelopers/freetype-sys

Also I noticed pistion build parses 3 mainifest files but the last links is different. Im guessing you would only care about the first parsed.
/Users/becker/trash/cargo-becker/target/debug/cargo build setting RUST_LIB freetype setting RUST_LIB freetype setting RUST_LIB z

Let me know if there is a known way to leak out environment variable changes.

@alexcrichton
Copy link
Member

Ah yeah you'll probably want to call .env on the relevant Command builder where we run the build script, that'll set the environment variable for only that process

@sbeckeriv
Copy link
Contributor

I am understanding better. The value needs to be passed to the internal build command system. I need to read up on this and how it works! Thanks

sbeckeriv added a commit to sbeckeriv/cargo that referenced this issue May 18, 2016
Dearest Reviewer,

This pull request allows the value of project.links to be passed into
the build script via an environment variable. This closes rust-lang#1220 . I have
added a test that makes sure that the environment variable is set. Also
note I am using CARGO_LIB not LIB because it appears to be used for
windows in appveyor. I think CARGO_LIB fits better.

I have also updated the documentation to reflect the new variable.

Thanks!
Becker

[Updated]
Github comments moved to CARGO_MANIFEST_LINKS
Fix if statement
bors added a commit that referenced this issue May 18, 2016
The missing lib

Dearest Reviewer,

This pull request allows the value of project.links to be passed into
the build script via an environment variable. This closes #1220 . I have
added a test that makes sure that the environment variable is set. Also
note I am using CARGO_LIB not LIB because it appears to be used for
windows in appveyor. I think CARGO_LIB fits better.

I have also updated the documentation to reflect the new variable.

Thanks!
Becker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants