409 Commits

Author SHA1 Message Date
Bo Anderson
6fed6c10e2
Use PAC+BTI where possible on arm64 Linux 2025-03-18 06:14:16 +00:00
Michael Cho
4ff6ac09c2
extend/ENV/super: always set PKG_CONFIG_LIBDIR
Setting PKG_CONFIG_LIBDIR overrides compiled default. This helps reduce
opportunistic linkage when pkg-config call finds modules installed on
system but not included in a formula's dependency tree.
2024-12-31 20:15:38 -05:00
Michael Cho
89fe201ad9
extend/ENV/super: use brew libs for some Python packages
This avoids using bundled libraries for:

* `hidapi`[^1]
* `pynacl`[^2]
* `pyzmq`[^3]

The build should now fail if dependency is missing.

Essentially reverses default so now that using bundled copy is now
opt-in via `ENV` modification, e.g. `ENV.delete "SODIUM_INSTALL"`

[^1]: https://github.com/trezor/cython-hidapi/blob/0.14.0.post2/setup.py#L229
[^2]: https://github.com/pyca/pynacl/blob/1.5.0/setup.py#L71-L73
[^3]: https://github.com/zeromq/pyzmq/blob/v26.2.0/CMakeLists.txt#L41-L43
2024-10-12 18:23:18 -04:00
Douglas Eichelberger
d3d25beb35 Use requires_ancestor consistently 2024-10-06 09:25:57 -07:00
Carlo Cabrera
66ba1f10c7
shims/super/ninja: respect Homebrew parallelism
`ninja` currently doesn't respect `HOMEBREW_MAKE_JOBS` or
`ENV.deparallelize`. This change fixes that.
2024-09-09 10:50:52 +08:00
Bo Anderson
98fb5f9dea
Don't assume ENV is a superenv in RBI 2024-08-23 05:59:00 +01:00
Bo Anderson
d24686ac50
extend/ENV: remove fake EnvMethods from RBI 2024-08-23 05:28:52 +01:00
Carlo Cabrera
5316627621
extend/ENV/super: set GOTOOLCHAIN
This will prevent Go from automatically downloading a newer toolchain
when one is requested by a `go.mod` file. See:
- https://tip.golang.org/doc/toolchain
- https://kokada.capivaras.dev/blog/quick-bits-go-automatically-downloads-a-newer-toolchain-if-needed/
2024-08-20 21:50:37 +08:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Michael Cho
0477944e71
shims/super/cc: pass -ld_classic if needed for -dead_strip_dylibs 2024-08-03 14:46:18 -04:00
Henry
22d42efb5c
Use effective_arch for rustflags 2024-06-30 02:23:29 -04:00
Mike McQuaid
6e9288470e
brew style --fix 2024-05-23 17:15:43 +01:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Mike McQuaid
af31d36295
Merge pull request #17156 from reitermarkus/unused-method
Remove unused private method.
2024-04-26 15:03:32 +01:00
Markus Reiter
7c8c75aa37
Remove unused method. 2024-04-26 12:34:50 +02:00
Carlo Cabrera
4f31a3e8df
extend/ENV/super: avoid adding llvm to HOMEBREW_LIBRARY_PATHS
This leads to undesired linkage with LLVM's `libunwind` (because it
shadows the system's `libunwind`).

See, for example, Homebrew/homebrew-core#169354.
2024-04-18 23:15:47 +08:00
Bo Anderson
5582849ae7
Reproducible builds for native compiled binaries 2024-03-11 16:06:55 +00:00
Douglas Eichelberger
aab04229d1 Code review fixes 2024-02-11 20:27:39 -08:00
Douglas Eichelberger
5b5cfe89de Resolve violations from removing hidden.rbi 2024-02-11 20:27:38 -08:00
Michael Cho
0ff2458952
extend/ENV/shared: effective_arch as public API 2024-01-13 15:26:38 -05:00
Mike McQuaid
ff404fe5ab
Merge pull request #16184 from dduugg/rm-try
Remove use of ActiveSupport try
2023-11-06 13:11:01 +00:00
Shu Niu
2809678f77
Fix TypeError with gcc compiler in deprecated MacOS
In some deprecated MacOS, e.g.10.13 High Sierra, when compiling formulae with --cc=gcc-XX, homebrew will raise "TypeError: Return value: Expected type Symbol, got type String with value".
Convert "other" string to symbol to solve this.
2023-11-06 14:08:41 +08:00
Douglas Eichelberger
00ba09d73d Remove use of ActiveSupport try 2023-11-05 09:28:19 -08:00
Carlo Cabrera
0a37af54be
Merge pull request #15680 from carlocab/ENV.O2
extend/ENV/super: add `ENV.O3`
2023-07-27 19:15:19 +08:00
Carlo Cabrera
91fe645750
extend/ENV/super: add ENV.O3
Having this would have been, or would be, useful on multiple occassions:

- Homebrew/homebrew-core#94724
- Homebrew/homebrew-core#136551
- #15372

I think it's time that we added this back.
2023-07-27 13:57:48 +08:00
Emilio López
5b042b8641 extend/ENV/super: correct deparallelize signature
The block is optional, so it should be marked `T.nilable`
2023-07-21 16:46:32 -03:00
Mike McQuaid
fd4f488072
Merge pull request #15544 from Tokarak/cargo_cpu
Apply cpu-optimisation to Rust projects
2023-07-04 12:04:24 +01:00
Carlo Cabrera
b214ccd86d
extend/ENV/super: add comment for OPENSSL_NO_VENDOR
This is based on feedback from #15613.
2023-07-04 16:21:35 +08:00
Carlo Cabrera
c3be703e02
extend/ENV/super: set OPENSSL_NO_VENDOR
Many (~60) formulae in Homebrew/core set this manually to prevent the
`openssl` Rust crate from vendoring OpenSSL.

Let's make handling this simpler by setting it globally instead.
2023-07-01 04:16:20 +08:00
Tokarak
9a99b932e8 Add RUSTFLAGS to ENV/super 2023-06-17 10:16:53 +01:00
Tokarak
2133da8597 Set target-cpu through RUSTFLAGS 2023-06-14 17:26:01 +01:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Carlo Cabrera
1b12d74945
Pass -no_fixup_chains to linker when required
Invoking `ld` with `-undefined dynamic_lookup` emits a warning starting
Xcode 14:

    ld: warning: -undefined dynamic_lookup may not work with chained fixups

Chained fixups is a linker optimisation that results in faster binary
load times, and is enabled by default starting Xcode 13 when the target
is macOS 12 or newer.

However, this interacts poorly with `-undefined dynamic_lookup`, and
Xcode will disable chained fixups when it is invoked with this flag
starting Xcode 14.3. Until then, we may be shipping binaries that are
broken in subtle ways, so let's disable chained fixups when necessary
instead.

I patterned the changes here after the handling of `-no_weak_imports`.
The only difference is that we need to check the flags that were passed
to the linker first to see if we do need to disable chained fixups.

For additional context, see:

https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes
https://www.wwdcnotes.com/notes/wwdc22/110362/
https://www.emergetools.com/blog/posts/iOS15LaunchTime
https://github.com/python/cpython/issues/97524
https://github.com/pybind/pybind11/pull/4301
2023-03-04 00:19:13 +08:00
Mike McQuaid
612c27cd2d
extend/ENV/shared: use try.
`version_suffix` exists (or doesn't) depending on the GCC formula being
available and not loaded from the API.
2023-01-25 16:07:23 +00:00
Mike McQuaid
6a25229567
brew style --fix 2023-01-02 19:18:51 +00:00
Carlo Cabrera
1d9ee93e6e
Apply suggestions from code review
Co-authored-by: Bo Anderson <mail@boanderson.me>
2022-09-21 23:05:00 +08:00
Carlo Cabrera
e9bcab6986
extend/ENV/std: ignore fails_with during brew test.
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.
2022-09-21 22:55:42 +08:00
Carlo Cabrera
fb4c6d92bc
Merge pull request #13677 from carlocab/python-libexec
ENV/super: add Python's `libexec/"bin"` directory when applicable
2022-08-15 18:47:02 +08:00
Carlo Cabrera
8064a39c18
Prefer newer versions of Python
Some formulae declare multiple Python dependencies, and they can appear
in any order in the `deps` array. Let's make sure to prefer the newest
one when adding their `libexec/"bin"` directory to `PATH`.
2022-08-15 18:18:21 +08:00
Carlo Cabrera
999623b45d
ENV/super: add Python's libexec/"bin" directory when applicable
When Homebrew/homebrew-core#107517 is merged, builds will no longer be
able to find `python@3.9` as `python3`. This is also what is likely to
happen to `python@3.10` when we add a `python@3.11`.

This is likely to break many builds, so let's make sure they can keep
finding a `python3` for formulae that don't have a dependency on the
latest Python3.

This is arguably something we should've done earlier: it also means that
builds that go looking for an unversioned `python` end up finding our
Python3 (whenever present in the build environment) instead of, say,
`/usr/bin/python` which is typically Python2.
2022-08-10 22:51:44 +08:00
Lukas Oberhuber
cd9fe97c55 Improve style 2022-07-30 11:10:26 +01:00
Lukas Oberhuber
22b1b61b73 Fix brew typecheck 2022-07-26 19:36:43 +01:00
Lukas Oberhuber
6551b25b07 Compile with symbols when requested on all plats 2022-07-26 17:56:11 +01:00
Lukas Oberhuber
c2a95f077f Compiler -g flag set based on --debug-symbols 2022-07-26 17:18:01 +01:00
Lukas Oberhuber
d195f22522 Connecting up --debug-symbols flag
This connects the calling of dsymutil and the retention of temporary
files. Still need to connect compilation to flag.
2022-07-26 12:15:53 +01:00
Lukas Oberhuber
74dd365a56 Hardcoded symbol production
Needs to be toggled by the `--debug-symbols` flag instead of hard coded
2022-07-26 12:13:38 +01:00
Bo Anderson
02164a35db
Use ORIGINAL_PATHS over envs; reject nil PATH 2022-06-17 19:47:57 +01:00
Rylan Polster
2e6b6ab3a2
Fix style 2021-12-24 21:15:21 -05:00