93 Commits

Author SHA1 Message Date
Mike McQuaid
9ac306e464
Remove alias generic_* definitions in favour of using super
This is the pattern we've been adopting for a while and it's a bit
cleaner. Let's remove all of the existing usage of the existing pattern
to avoid confusion when adopting the new one.
2025-06-16 08:10:08 +00:00
Caleb Xu
9a61ad68d9
hardware: recognize 10 cores as deca 2025-01-18 18:40:21 -05:00
Caleb Xu
878d5d1633
hardware: rename none optimization flags to dunno 2024-11-16 14:44:37 -05:00
Caleb Xu
a70d15c80d
shared: only fall back to -march=native on supported architectures 2024-11-12 11:34:40 -05:00
Patrick Linnane
a3600d07a2
Apply suggestions from code review
Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-08-18 21:20:23 -06:00
Patrick Linnane
d992a4f923
hardware.rb: use typed: strict
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-08-18 20:28:02 -06: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
Henry
0147c3f2cb
Fix for 'brew style' 2024-06-30 02:35:29 -04:00
Henry
22d42efb5c
Use effective_arch for rustflags 2024-06-30 02:23:29 -04:00
Markus Reiter
4b432c7ea4
Explicitly mark non-private APIs. 2024-04-22 21:16:49 +02:00
Patrick Linnane
74a487ccfc
hardware/cpu: add virtualized? check
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-01-18 16:46:59 -08:00
Bo Anderson
fba5a874fc os/mac/hardware: use Westmere on >= Ventura 2023-12-23 04:58:53 +00:00
Nazar
521fdcb506
Wording
Co-authored-by: Alexander Bayandin <alexander@bayandin.dev>
2023-06-24 11:09:28 +01:00
Tokarak
55bdbabaae brew style --fix 2023-06-20 23:48:10 +01:00
Nazar
87158acfe0
Improve logic (code review)
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-06-20 23:44:25 +01:00
Tokarak
40aa41929f More cpus in rust_optimisation_flags 2023-06-17 12:14:21 +01:00
Tokarak
73c339d82b Style changes 2023-06-17 10:51:48 +01:00
Tokarak
9a19f5bcd2 Refactor to use oldest_cpu 2023-06-17 10:38:32 +01:00
Tokarak
d4bfbb1d02 Remove FIXMEs 2023-06-13 19:32:18 +01:00
Tokarak
066a88855b Add rustflags_target_cpu method 2023-06-13 19:22:12 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Bo Anderson
bca9eb05d1
dev-cmd/unbottled: simulate target tag 2022-11-16 00:07:31 +00:00
Adrian Ho
4b560e11e7 Enable Linux AArch64 support
Register system loader and arch tag for proper builds and bottling.
2022-09-29 16:33:44 +08:00
Mike McQuaid
30a65342e8
Deprecate, disable, delete code for Homebrew 3.2.0
Do the usual deprecation, disable, delete dance for Homebrew 3.2.0.
2021-06-17 11:34:32 +01:00
Mike McQuaid
d73351251c
Deprecate, disable, delete code for next major/minor version.
Do the usual dance for bumping our major/minor version.
2021-04-09 09:30:36 +01:00
Mike McQuaid
cdaeee03c4
GitHub Packages cleanup
- `download_strategy`: only request image index JSON for downloading
  the manifest for the tab
- use a shared `OS` constant for the version of `glibc` we use in CI
- fix `skoepeo` typo
- ensure that blank hash values are deleted (again) rather than just
  `nil` ones
- use a shared `Hardware::CPU` constant for oldest CPU we're
  supporting/using on Intel 64-bit
- re-add comment to `software_spec`
2021-04-05 14:58:17 +01:00
Bo Anderson
b670ab1c7b Deprecate additional arch functions 2021-02-02 16:19:24 +00:00
Jonathan Chang
095798be40 hardware: optimize Big Sur bottles for Ivy Bridge 2020-12-23 00:00:01 +11:00
Mike McQuaid
566ebf2a98
Revert "Revert "Fix :arm64_big_sur bottle ordering.""
This reverts commit 399cc56d034a3314f428683b7872b4d67063be9a.
2020-12-08 16:28:45 +00:00
Francois-Xavier Coudert
399cc56d03 Revert "Fix :arm64_big_sur bottle ordering."
This reverts commit 66d1b929a5b134ee93caf9237e7074a195c1b523.
2020-12-08 13:00:22 +01:00
Mike McQuaid
66d1b929a5
Fix :arm64_big_sur bottle ordering.
This wasn't being parsed correctly so was being put below the Linux
bottle which is less readable, less intuitive and will cause a bunch
of merge conflicts.
2020-12-07 12:09:29 +00:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Mike McQuaid
5afff3f3aa
Handle macOS Homebrew on ARM
- Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead
- Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not)
- Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture.
- Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa
- Actually write out the architecture of dependencies to the tab rather than generating and throwing them away
- Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux

While we're here:
- Don't say Big Sur is a prerelease version but still make it clear we
  don't support it (yet).
- Don't reference non-existent IRC channel
2020-11-12 17:06:47 +00:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid
74d3f0b153 hardware: rename rosetta method. 2020-09-01 14:52:37 +01:00
Misty De Meo
d9135c5a57 CPU: add ability to check for Rosetta
When running within an Intel terminal, `uname -m` and friends return Intel-based
values for compatibility. An Intel shell will also prefer to launch Intel slices of
programs unless the program is ARM-only.

It's an open question how Homebrew should manage running in Intel mode. Should it
continue to behave as though the Mac is Intel-based, like it does now? Should it
recognize it's ARM-based? Either way, it's useful for us to be able to tell whether
the Mac is running under Rosetta or whether it's a real Intel Mac.
2020-09-01 14:52:37 +01:00
Markus Reiter
33c138751e Refactor and document Hardware. 2020-08-23 04:19:46 +02:00
Fred Emmott
10feb68128
Add support for -march=sandybridge
HHVM's been building with this (or equivalent predecessor patches); it
gets us a 20x speedup on real-world workloads, at the cost of slightly
worse compatibility.

This doesn't change the default, just makes it available as an explicit
choice.
2020-07-10 10:32:30 -07:00
Claudia
374c734d9b
Make Hardware.oldest_cpu depend on architecture
Starting with Xcode 12 Beta 2, builds that used to work on Apple Silicon
now break due to `Hardware#oldest_cpu` returning `:nehalem` [1].

This commit is the first in a series of improvements to
`Hardware#oldest_cpu`. It resolves the Xcode 12 Beta 2 issue for now.

[1]: https://github.com/Homebrew/brew/issues/7857#issuecomment-655536261
2020-07-08 20:59:10 +02:00
Trung Le
d6c80c8671 Update Hardware::CPU.oldest_family with ppc64 2020-05-01 23:21:28 +10:00
Trung Le
3df97b20d5 Add PowerPC64 CPU
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
2020-04-30 23:37:45 +10:00
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Shaun Jackman
c20044b43f Fix Hardware::CPU.arm? for aarch64 2019-02-21 21:15:01 -08:00
Mike McQuaid
28fa8a7c97
version: add CPU tests.
Add a new API inspired by discussion in
https://github.com/Homebrew/homebrew-core/pull/36435 to query if a given
CPU option is supported by a version of macOS.
2019-01-28 19:31:21 +00:00
Mike McQuaid
1aa8ad09e2
Deprecate macOS versions below Mavericks
And remove all dead/unneeded code.
2019-01-27 12:27:47 +00:00
Mike McQuaid
96207c05d3
Merge pull request #5506 from MikeMcQuaid/no-penryn
hardware: no special penryn CFLAGS.
2019-01-08 19:40:03 +00:00
Mike McQuaid
b1e60f9c76
hardware: no special penryn CFLAGS.
These are the same as `core2` (at least for `gcc`).

Fixes #5502.
2019-01-08 19:14:29 +00:00
Shaun Jackman
23ea066a0f Use -march=native for non-bottle source builds [Linux] 2019-01-08 09:39:37 -08:00
Mike McQuaid
a2f93fe018
hardware: tweak macOS CFLAGS.
- High Sierra and Sierra support Penryn CPUs.
- `-march` implies the relevant `-msse*` flags.
2018-12-22 11:41:49 +00:00