The compiler used to a build a formula is typically not needed during
the test.
This will allow us to get rid of some `:test` dependencies, which were
added to prevent `brew` from throwing a `CompilerSelectionError` because
the formula declares `fails_with` the default compiler.
This also helps us get more accurate results from `brew linkage` in
cases of unintended linkage with the compiler used to build.
Fixes#11795.
One of the more curious bugs, if you use
-Wl,-headerpad_max_install_names on linux, it tries to link a library
named "eaderpath_max_install_names" in, which causes all kinds of weird
havoc.
Most notably, gtester inside glib fails to run for bizarre reasons.
-Wl,-headerpad_max_install_names is not an option anywhere outside macos
anyway, so move it to macos only and avoid the heartache of extremely
weild bugs.
These are still used in Homebrew/homebrew-core. The others are either
- default (Os on macOS, O2 on Linux)
- less reliable than the default (O3)
While we're here, also remove an outdated `ncurses_define` comment.
This probably has to wait until 2.7.0 now and will require a bunch of
formula changes/deprecations but we should probably start moving in this
direction given we're not installing any of these on our CI any more.
In `extend/ENV/std.rb`, the methods `set_cpu_flags` and
`set_cpu_cflags` have been violating the `Naming/AccessorMethodName`
cop.
A recent modification in #7e13b3749 woke up the cop. That means we’re
likely dealing with legacy code here, predating the introduction of
RuboCop into Homebrew.
This commit disables the cop for either method. I believe refactoring
wouldn’t currently be worth the effort, especially given that
`#set_cpu_cflags` is mostly called without arguments.
This reduces the deviation in compilation flags on a given OS between
users and between bottling/not bottling to provide a consistent
behaviour for debugging and support.
Unlike macOS, Linux installations can be installed/deployed on a
variety of hardware. The HOMEBREW_ARCH environment variable
allows the end user to set a custom -march=... option for the
compiler. If the variable is not set, it defaults to "native".
This only applies on Linux; on macOS, behavior remains unchanged.
Rather than just re-adding HOMEBREW_PREFIX/bin if it's missing re-add
everything from HOMEBREW_PATH. This works well with or without
environment filtering being enabled but with environment filtering it
ensures that ENV/std just builds on the original user environment.