50 Commits

Author SHA1 Message Date
Mike McQuaid
d240eda154
os/linux/extend/ENV/super: add comment. 2025-03-19 12:30:59 +00:00
Bo Anderson
6fed6c10e2
Use PAC+BTI where possible on arm64 Linux 2025-03-18 06:14:16 +00:00
Ruoyu Zhong
a818b25a8b
Add support for bottling Portable Ruby for ARM64 Linux 2025-01-19 17:06:32 +08:00
Douglas Eichelberger
0add431e69 Apply manual violation fixes 2025-01-12 10:06:00 -08:00
Douglas Eichelberger
dbb731bce2 brew style --fix 2025-01-12 10:05:21 -08: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
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
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Issy Long
f4218a6316
Fix RuboCop Performance/MapCompact offenses
- Rename an iterator variable since it would make the line too long.
2024-02-25 22:59:59 +00:00
Michael Cho
0ff2458952
extend/ENV/shared: effective_arch as public API 2024-01-13 15:26:38 -05:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Bo Anderson
cbc895ce2b
Add Pathname shim extension RBI definitions 2022-09-08 03:26:50 +01: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
Lukas Oberhuber
3d60d610dd Merge branch 'master' into debug-symbols 2022-08-10 18:44:09 -10: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
Carlo Cabrera
fa26b5a06d
linux/super: add unversioned GCC lib directory to RPATH
This adds GCC's runtime lib directory to the RPATH of every build on
Linux (unconditionally!).

This is useful for three things:

1. It fixes versioned GCC linkage for formulae that users build from
   source instead of pouring from a bottle. We currently only handle
   bottle installs. See #13633.

2. It helps minimise the GCC dependency explosion. When a formula has a
   Linux-only GCC dependency, then all its dependents that link with
   some GCC runtime library (typically `libstdc++`) must, before this
   change, also adopt a GCC dependency. This is a consequence of our
   injecting GCC's runtime library directory into RPATH only when a
   formula is built with GCC (this is done through the specs file). We
   can avoid the need to do this by always injecting this path instead.

3. This enables us to automatically install Homebrew GCC whenever the
   user's GCC is too old and the formula may need it. Without this
   change, auto-installing GCC is not that useful because formulae that
   need it may not know to look for our GCC, unless the formula already
   happened to be built with our GCC. With this change, these formulae
   will always be able to find our GCC when it is installed. This is
   particularly useful for when we start building with a version of GCC
   that is much closer to the latest than we currently do.

This approach comes with at least two drawbacks:

1. We will see spurious linkage warnings in CI about an undeclared
   dependency with linkage as soon as Homebrew GCC is installed, because
   formulae will link with our GCC instead of the host's. Users will
   also see a similar complaint if they do `brew linkage`.

2. This leans _very_ heavily on GCC delivering backward compatibility of
   their runtime libraries. If they do not, we could see different
   behaviour across different CI runs for the same formula depending on
   whether Homebrew GCC is installed.

It's worth noting that item 3 in the "useful" list above may rely on
features not yet implement in `brew`.
2022-08-06 13:21:18 +08:00
Lukas Oberhuber
cd9fe97c55 Improve style 2022-07-30 11:10:26 +01:00
Lukas Oberhuber
215e545660 brew style 2022-07-26 19:28:30 +01:00
Lukas Oberhuber
c2a95f077f Compiler -g flag set based on --debug-symbols 2022-07-26 17:18:01 +01:00
danielnachun
47b6492098
extend/os/linux/extend/ENV/super.rb: add homebrew_extra_include_paths 2022-07-17 17:15:06 -07:00
Michael Cho
b6905fe0f9
superenv: prioritize dependencies' opt_lib in Linux rpath 2022-05-03 23:14:30 -07:00
Douglas Eichelberger
65f1766497 Remove unknown YARD tags 2021-11-30 08:01:20 -08:00
Carlo Cabrera
22db7aa516
superenv: set M4 on Linux when bison is a dependency
Bison no longer remembers the path to `m4` as of
Homebrew/homebrew-core#84931. Since superenv does not put runtime
dependencies of build dependences in `PATH`, we now need to help Bison
find `m4` by setting `M4` in the environment.

See also Homebrew/homebrew-core#85260.
2021-09-16 21:11:12 +08:00
Bo Anderson
861dea9ada
Bump various type strictnesses 2021-09-11 01:00:23 +01:00
Mike McQuaid
2b6e580636
ENV/super: add shims_path helper method.
This allows us to stop repeatedly hardcoding this on macOS/Linux in
formulae.
2021-09-08 12:35:36 +01:00
Bo Anderson
65c03573c6
ENV: fix missing arg for generic OS and correct type sigs 2021-02-26 18:23:48 +00:00
Rylan Polster
af6be13e7c test: don't try to use Xcode SDK for build requirement 2020-12-21 09:25:29 -05:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Bo Anderson
e3372e2a14 Lazily require some heavy files 2020-08-20 02:05:17 +01:00
Markus Reiter
23340403c1 Fix effective_arch on Linux. 2020-07-28 12:58:21 +02:00
Bob Wombat Hogg
9b47057b12 Fix brew test on Linux stdenv 2020-07-27 21:41:03 -04:00
Markus Reiter
276c570c16 Pass individual args explicitly to ENV extensions. 2020-07-28 02:52:45 +02:00
Markus Reiter
25b3632c4c Pass args to ENV instead of using global args. 2020-07-25 03:57:43 +02:00
Mike McQuaid
3588e6a5c6
bottle_arch: ensure a symbol is used when needed.
Fixes #7597.
2020-05-19 08:47:59 +01:00
Mike McQuaid
07b19cba09
Replace ARGV#bottle_arch with Homebrew.args.bottle_arch
Part of https://github.com/Homebrew/brew/issues/5730
2020-05-10 15:15:41 +01:00
Gautham G
b0ac5bab31
ARGV: Deprecate ARGV.build_bottle? and replace with Homebrew.args.build_bottle 2020-04-26 13:28:44 +01:00
Issy Long
341ea60807
Auto-fix Style/RedundantBegin offenses
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
  Layout/InconsistentIndentation once the auto-fixer had got rid of the
  "redundant begin"s.
2019-10-13 16:04:27 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Shaun Jackman
23ea066a0f Use -march=native for non-bottle source builds [Linux] 2019-01-08 09:39:37 -08:00
Shaun Jackman
e1b1448fbd setup_build_environment: Set search path [Linux]
Set the header and library search path for Stdenv.
Fix brew test for Linux, which uses Stdenv.
2018-12-17 15:04:18 -08:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Michka Popoff
b7b5fb930d superenv: Use 02 optimization flag for Linux builds
`-Os` produces sometimes bigger binaries on Linux.
Also, llvm built with `-Os` is really slow at runtime for Linux.

Using `-02` aligns us with what Debian does, and as we are compiling most of our stuff with gcc (and not clang), it makes sense to use `-02` on Linux.
`-Os` does probably slightly different things when used on mac with llvm, compared to when it is used with gcc on Linux.
2018-08-29 13:40:39 +02:00
Shaun Jackman
9f8f8ffb89 superenv: Move Linux-specific bits to extend/os/ 2018-05-30 14:00:26 -07:00
Shaun Jackman
76bfd0cecb Add superenv for Linux 2018-05-18 16:58:21 -07:00
Shaun Jackman
e5847b652f extend/pathname: Add os/linux/elf.rb 2017-12-03 16:22:51 -08:00
Maxim Belkin
de0b93f912
pathname: improvements, cleanups, and new methods
- atomic_write: close file before renaming to prevent error:
  'Device or resource busy'
- ensure_writable: preserve executable bit
- new elf? and dynamic? methods
2017-11-07 14:18:25 -06:00
Bob W. Hogg
e2c707d8b1 Stdenv: Add ENV.libxml2 and ENV.x11 for Linux
Add ENV.libxml2 primarily for the use of test do blocks.
Add a dummy ENV.x11 function.

See Linuxbrew/brew#356 and Linuxbrew/brew#382
2017-05-30 10:37:26 -07:00