62 Commits

Author SHA1 Message Date
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
Mike McQuaid
04fbdce3bb
hardware: use Nehalem flags on >= Sierra.
See https://en.wikipedia.org/wiki/MacOS_Sierra#System_requirements.
2018-12-20 20:10:54 +00:00
Mike McQuaid
737b84b54b
brew style --fix fixes. 2018-11-02 17:29:23 +00:00
Shaun Jackman
4addff3b2b determine_optflags: Default is -march=native 2018-10-03 11:41:39 -07:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Dominyk Tiller
92c6e72a4a
hardware: add dodeca-core for 2018 MBPs 2018-07-13 10:50:30 +01:00
Shaun Jackman
5ca7cd3071 oldest_cpu: Bottling architecture of ARM is armv6
armv6 is the oldest supported 32-bit ARM architecture
armv8-a is the oldest 64-bit ARM architecture.

See https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
and https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
2018-05-15 17:20:51 -07:00
Markus Reiter
b91628a614 Refactor Hardware::CPU spec. 2018-04-20 19:11:22 +02:00
Mike McQuaid
9fca172d03 Fix HOMEBREW_RUBY_WARNINGS="-w"
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00
Shaun Jackman
0ce7a74c58 Hardware::CPU: Implement OS-agnostic methods 2017-12-01 15:18:35 -08:00
Misty De Meo
d7ff53fa1d Hardware: add helper to determine if an executable can be run 2017-04-15 22:59:55 +08:00
Shaun Jackman
ecb2246ab0 OPTIMIZATION_FLAGS: Use -march=native for Penryn
Use -march=native for Penryn as for other systems rather than
-march=core2 -msse4.1.
2017-03-13 15:54:20 -07:00
Mike McQuaid
d0f1fa668c hardware: use march=native for generic module.
This matches Linux where this behaviour was original imported from.
2017-03-11 08:40:48 +00:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
569c80323b hardware: add ARM detection from Linuxbrew. 2016-07-29 21:21:02 -06:00
Mike McQuaid
892a3239bc hardware: more porting to generic layer. 2016-07-27 15:05:42 -06:00
Mike McQuaid
11624b9a7d hardware: move generic logic from linux. (#454) 2016-07-06 10:43:54 +01:00
Martin Afanasjew
7727c7764c hardware: prettify config output on 6/8-core CPUs (#313) 2016-06-14 15:08:04 +02:00
Mike McQuaid
8d995e961f Make hardware code cross-platform. 2016-05-08 16:51:22 +01:00
Mike McQuaid
ddb576b582 Add support for testing generic OS.
If the environment variable HOMEBREW_TEST_GENERIC_OS is set ensure that
neither Mac nor Linux-specific code is loaded. This allows easier
testing of cross-platform code on OS X and will make it easier to port
Homebrew to platforms other than OS X and Linux.
2016-05-08 16:51:22 +01:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Jack Nagel
977981dcb9 Remove ivars from default Hardware::CPU methods
These methods are always overridden in the per-OS modules, so let's just
provide sensible defaults for documentation purposes.
2015-02-27 20:38:00 -05:00
Jack Nagel
1dc4412f69 Provide Hardware::CPU.feature? 2015-02-23 21:38:36 -05:00
Jack Nagel
6e92716642 Define Hardware::CPU.features on the base module 2015-02-23 21:38:36 -05:00
Jack Nagel
cb18b9e77e Add Hardware::CPU.intel? and Hardware::CPU.ppc? 2013-11-26 20:23:19 -06:00
Jack Nagel
c511d7d2f4 Add OS.mac? and OS.linux? 2013-10-18 12:56:51 -05:00
Misty De Meo
ab633864d5 Mach: improve PPC arch detection
Also adds some reusable constants into the global Hardware::CPU
namespace, available on both OS X and Linux.
2013-08-15 22:46:56 -07:00
Jack Nagel
50db35e5d3 Use Hardware::CPU module 2013-06-14 10:34:17 -05:00
Jack Nagel
159b9d8e2d Move oldest_cpu to Hardware 2013-06-06 16:02:27 -05:00
Jack Nagel
3be67f7252 Reorganize compat 2013-05-10 23:27:28 -05:00
Misty De Meo
2476801613 Hardware: separate out CPU values into CPU module
* CPU functions now exist in Hardware::CPU
* Added compatibility functions in compat/hardware_compat.rb
* Names are less specific to Mac hardware, e.g. CPU.family instead of
  Hardware.intel_family
* Hardware::CPU.family works for both Intel and PowerPC
* New helper methods on CPU, like .sse4? and .altivec?

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2013-03-23 13:40:18 -05:00
Shaun Jackman
258d70028f Portability fixes to run Homebrew on Linux systems
Closes Homebrew/homebrew#16344.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-11 18:26:25 +00:00