-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Allow formulae to prevent optimization level stripping #11201
Conversation
Some upstream build systems require finer control over the optimization level. For example, `libgcrypt` sets `-O0` when building its jitter-based entropy collector, but `-O2` otherwise. This allows formulae to set `ENV.permit_optimization_level` in the install method to prevent the stripping of `-O[0-9zs]` flags. While we're here, clean up an old comment referencing `ENV.libstdcxx`.
Review period will end on 2021-04-21 at 22:33:15 UTC. |
I'll admit that I'm not sure how I feel about making these changes to superenv for one formula. On the other hand, it's an important formula, and has security-relevant consequences. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit that I'm not sure how I feel about making these changes to superenv for one formula
I'm definitely opposed, I'm afraid.
What happens with the status quo? Does it fail to build? Does it fail to build the relevant component? Can we make use of the existing ENV.Ox
methods to do any of this?
With the status quo, we need to disable the
We can build the So our alternatives to not making this change are:
I don't think either of 1 or 2 are good options. I've looked into the third, and I'm not sure it's possible. It likely involves patching to the build system that I am sceptical we would be able to upstream (which would also make it a not good option). Making changes to superenv seems to me like it would be the least bad option here. However, I will keep looking into option 3. It might be better than my initial impression suggests it is. |
This is the current default/status quo, right?
This seems ideal to me if possible.
I'm the opposite. I hate patching software in Homebrew but I think it's preferable rather than introducing a new DSL and the relevant superenv logic for a single formula, particularly considering the current status quo doesn't seem too awful. |
It's what the formula does currently, but it's not the default build configuration. We need to pass
Ok, will look into this some more then. |
I had forgotten the fourth option, which I did contemplate (but don't remember why I didn't pursue it): make superenv smarter about handling This will avoid the need for:
I think I can make it a change I'd feel good about. Will work on a PR. Thanks for the motivation here, Mike. |
@carlocab To save you some work: mind pitching it here and we can discuss it? |
Just to explain my radio silence here: your last comment read a little like (completely warranted) scepticism to me, so I started second-guessing myself. Taking the time to mull over a proper solution here. Will be back with one in the next few days. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Review period ended. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Some upstream build systems require finer control over the optimisation
level. For example,
libgcrypt
sets-O0
when building itsjitter-based entropy collector (
jent
), but-O2
otherwise.This allows formulae to set
ENV.permit_optimization_level
in theinstall method to prevent the stripping of
-O[0-9zs]
flags. In particular,it will allow us to build
libgcrypt
with the jitter-based entropy collectorwhich, as far as I can tell, is a valuable additional source of entropy. (Not
an expert though. But I assume there's a good reason upstream build this
unless you explicitly disable it.)
While we're here, clean up an old comment referencing
ENV.libstdcxx
.