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

Enable writing custom profiles #601

Closed
jdm opened this issue Sep 18, 2014 · 9 comments · Fixed by #712
Closed

Enable writing custom profiles #601

jdm opened this issue Sep 18, 2014 · 9 comments · Fixed by #712
Labels
A-linkage Area: linker issues, dylib, cdylib, shared libraries, so

Comments

@jdm
Copy link

jdm commented Sep 18, 2014

For Servo, I'm interested in allowing developers to build either debug or opt builds of a native submodule. I can nearly get there by matching on the PROFILE environment variable in the makefile, but there's no way to specify arbitrary custom profiles for Cargo.

@alexcrichton
Copy link
Member

Could you elaborate a bit more on what you mean by a custom profile? Are you thinking something like:

[profile.my-profile]
...

and then cargo build --profile my-profile or something like that?

@jdm
Copy link
Author

jdm commented Sep 19, 2014

Maybe? I don't really know much about Cargo, and @metajack suggested that custom profiles might be a solution. I just want a way to provide developers with choices about certain aspects of the build beyond all optimized or all debug.

@metajack
Copy link

We also need this for skia. The old configure had --enable-skia-debug which would turn on Skia debugging which is extraordinarily expensive (it calls glGetError() after every call). You almost never want that in a debug build, except when you are debugging certain graphics problems.

@metajack
Copy link

The only other solution I can think of is to use environment variables that the Makefile.cargo's trigger off of, but that doesn't help when we want to make these kinds of decisions in crates instead of C libraries.

@larsbergstrom
Copy link

@alexcrichton mentioned we may be able to use --feature and pass the features down explicitly to subcrates and use that.

@jdm
Copy link
Author

jdm commented Oct 10, 2014

Features almost work for this (with a patch to add environment variables that can be accessed in native build commands), but they're not propagated to dependencies at the moment. We're back at no solution right now.

@jdm
Copy link
Author

jdm commented Oct 10, 2014

Do profiles propagate? If so, it sounds like my original request would be an acceptable short-term fix while we sort out the future of features.

@alexcrichton
Copy link
Member

@jdm not currently. After thinking more I don't think that features are sufficient for this use case, although I believe they should be. I'm going to talk more with @wycats about the design of features soon. Profiles do propagate, but the configuration for a profile always comes from the top-level package.

@alexcrichton
Copy link
Member

Ah, when I say "not currently", I actually mean that features do not currently work, not that profiles do not propagate. Words!

@alexcrichton alexcrichton added the A-linkage Area: linker issues, dylib, cdylib, shared libraries, so label Oct 13, 2014
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Oct 16, 2014
Closes rust-lang#97
Closes rust-lang#601 (this is an equivalent solution for that problem)
bors added a commit that referenced this issue Oct 17, 2014
As pointed in #633, it's currently not possible for a package to reexport the
feature of another package due to the limitations of how features are defined.

This commit adds support for this ability by allowing features of the form
`foo/bar` in the `features` section of the manifest. This form indicates that
the dependency `foo` should have its `bar` feature enabled. Additionally, it is
not required that `foo` is an optional dependency.

This does not allow features of the form `foo/bar` in a `[dependencies]`
features section as dependencies shouldn't be enabling features for other
dependencies.

At the same time, this passes through features to build commands to solve a few more issues.

Closes #97
Closes #601 (this is an equivalent solution for that problem)
Closes #633
Closes #674
@bors bors closed this as completed in #712 Oct 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linker issues, dylib, cdylib, shared libraries, so
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants