27 Commits

Author SHA1 Message Date
Michael Cho
f5c11fa342
Check host libstdc++ for brew gcc dependency
For most formulae, the bottles need a minimum libstdc++ rather than a
minimum GCC version. This is particularly important when building on
Ubuntu where the default compiler version is older than libstdc++.

So, checking the host libstdc++ version is a more accurate way to
determine whether brew GCC is needed at runtime. This can be improved in
the future to check symbol versions (e.g. GLIBCXX, CXXABI, GLIBC) which
can allow some bottles to be installed even with older glibc/libstdc++.
2025-09-12 14:15:56 -04:00
Michael Cho
896edb4451
os/linux/ld: add support for using system ld.so 2025-09-05 09:04:21 -04:00
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.

While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
2025-08-20 19:20:19 +01:00
Mike McQuaid
e10d4c43c2
Optionally use DownloadQueue for reinstall, upgrade.
Follow up on `DownloadQueue` for download concurrency on `brew fetch`
and `brew install` to also add support for `brew reinstall` and
`brew upgrade`.

This required a fair bit of refactoring to make this work so I've also
made `install.rb`, `reinstall.rb` and `upgrade.rb` `typed: strict` to
add some extra guardrails from Sorbet here.

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-24 15:41:03 +01:00
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
Bo Anderson
97866f8adf
Perform preinstall checks when a formula is installed via a cask 2024-10-11 16:57:47 +01: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
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Patrick Linnane
c56669e9cd
various: fix miscellaneous typos 2023-07-18 08:52:49 -07:00
Douglas Eichelberger
09c679e75f Refactor module_function to reduce rbi need 2023-04-17 10:37:59 -07:00
Carlo Cabrera
a2081b488c
Use unversioned GCC for runtime libraries when required.
See discussion at Homebrew/homebrew-core#110010.
2022-09-27 13:11:04 +08:00
Bo Anderson
ae3c6a6574
extend/os/linux/install: use arch-agnostic ld.so path 2022-09-19 07:06:22 +01:00
Bo Anderson
88ca45002d
extend/os/linux/install: update old ld.so symlinks 2022-09-19 07:06:22 +01:00
Bo Anderson
07f5951b76
extend/os/linux/install: use ld.so.conf.d where possible 2022-09-19 07:06:20 +01:00
Bo Anderson
66fa1f7e6a
Use GCC 12 for runtime libraries 2022-09-19 00:51:17 +01:00
Bo Anderson
9091ac0dad
Create GCC and glibc symlinks after install is complete
Fixes #13836.
2022-09-09 21:24:45 +01:00
danielnachun
3c014a0fc0
Library/Homebrew/extend/os/linux/install.rb: add symlink_gcc_libs 2022-08-31 17:39:55 -07:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
7fce76d176 Refactor and document Install. 2020-08-17 19:17:18 +02:00
Markus Reiter
20bd4280ff Pass args.cc to Install. 2020-07-30 03:21:12 +02:00
Mike McQuaid
11c875d747
macOS Big Sur tweaks
- output warnings when running on ARM
- require Xcode 12
- use 11.0 as the version number
2020-06-23 14:11:05 +01:00
Trung Le
3de9fc91a7 update dynamic linkers 2020-05-01 02:09:14 +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
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
3a0e0dca36
Output more warnings on unsupported configurations 2019-01-21 13:58:03 +00:00
Shaun Jackman
c0f07db656 Symlink ld.so [Linux] 2018-09-28 14:01:09 -07:00