23 Commits

Author SHA1 Message Date
Bo Anderson
66fa1f7e6a
Use GCC 12 for runtime libraries 2022-09-19 00:51:17 +01:00
Mike McQuaid
1f709d360d
extend/os/linux: improve glibc, gcc dependency handling.
- Add more early return checks
- Move to a recursive approach for more readability and avoiding a
  counter that we need to bump
- Perform more caching
- Keep class variable usage isolated into specific methods
2022-08-30 12:54:34 +00:00
Michka Popoff
d271614872
install glibc/gcc automatically if too old.
Right now this is done through the gcc@5 formula.
See 9692318ca6/Formula/gcc%405.rb (L33)

This is fragile because when we will migrate to gcc@11
we have to think about migrating the installation from one gcc formula to another..
Also, not having the right glibc version results in a non-functional brew
installation on an older Linux: the glibc installation needs
to be done by brew, and not by a workaround in a specific formula

Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Co-Authored-By: Bo Anderson <mail@boanderson.me>
Co-Authored-By: Shaun Jackman <sjackman@gmail.com>
2022-08-25 11:04:37 +01:00
Carlo Cabrera
c7030eaba0
formula: add optional source and target args to #rpath
There are about 10 formulae which need a bit more flexibility from
`#rpath`. Most of them use `Pathname#relative_path_from`, so we can
replace those instances with a call to `#rpath` instead once `#rpath`
knows how to handle this.
2022-08-19 17:32:43 +08:00
Rylan Polster
34a1bc6618
Use SimulateSystem for ignore_missing_libraries 2022-07-23 03:09:29 +02:00
Carlo Cabrera
5e0b786da2
formula: add deuniversalize_machos method
This method takes an optional array of `Pathnames`s or `Strings`s and
extracts the native slice from the specified universal binary. If no
parameter is supplied, this is done on all compatible universal binaries
in a formula's keg.

`deuniversalize_machos` is a no-op on Linux.

I still need to look into a) error handling, and b) whether using this
method requires codesigning on ARM.

I've also added signatures to the methods in `extend/os/linux/formula`.
2021-07-22 01:24:56 +08:00
Carlo Cabrera
309504a32c
formula: add rpath helper method
About 40 formulae set `CMAKE_INSTALL_RPATH` to `lib` or `opt_lib`, but
this breaks bottle relocatability.

The correct solution is to use `@loader_path/../lib`, but this is macOS
specific, so it requires some OS-specific logic. Rather than replicating
this logic over many formulae, we may as well define a helper method for
it.

See https://github.com/Homebrew/homebrew-core/issues/75458.
2021-04-19 09:23:33 +01:00
Seeker
0aa4259654 formula: include versioned *.so.* libs for shared_library("*") 2020-12-24 08:51:01 -08:00
Seeker
a2af19360b extend: add on_os (for on_macos/on_linux) 2020-12-07 10:36:51 -08:00
Markus Reiter
0184e271d8 Fix RuboCop offenses. 2020-11-17 11:09:55 +01:00
Michka Popoff
8b85ef2e88 formula: add on_linux and on_macos blocks
for install and others
2020-11-03 22:54:07 +01:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Maxim Belkin
152dd1ca24 Move allowed_missing_libraries: extend/os/linux/formula.rb ~> formula.rb 2020-07-24 11:06:38 +00:00
Maxim Belkin
85cca2e852 formula.rb [Linux]: undefine allowed_missing_libraries first 2020-07-24 10:54:44 +00:00
Maxim Belkin
1b8c32c716 Move allowed_missing_libs? to linkage_checker.rb.
Optimize 'unexpected_broken_dylibs'
2020-07-22 14:30:52 +00:00
Maxim Belkin
73495c4959 formula.rb [extend/Linux]: add missing comma 2020-07-21 15:48:55 +00:00
Maxim Belkin
2ffb9fd0fc
extend/os/linux/formula.rb: ignore_missing_libraries: change unless to if
Change
```rb
      unless libraries.all? { |x| x.is_a?(String) || x.is_a?(Regexp) }
```
to
```rb
if libraries.any? { |x| !x.is_a?(String) && !x.is_a?(Regexp) }
```

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-07-21 10:43:28 -05:00
Maxim Belkin
68ebf8866a extend/os/linux/formula.rb: allowed_missing_lib: check input class 2020-07-21 15:40:27 +00:00
Maxim Belkin
7080ad5ebc formula.rb: update missing libs feature
1. Raise an exception on macOS.
2. Verify that the missing libraries are specified either as Strings or
   Regular Expressions.

Signed-off-by: Maxim Belkin <maxim.belkin@gmail.com>
2020-07-21 13:16:56 +00:00
Maxim Belkin
f2ddcda85b Fix style (Convert if-elsif to case-when) 2020-07-16 13:53:32 +00:00
Maxim Belkin
c61aba4ec3 Formula: ignore_missing_libraries DSL 2020-07-16 13:51:16 +00:00
Michka Popoff
955bca6574 formule: add generic shared-lib methods
We have strings containing hardcoded ".dylib" extensions in homebrew-core.
To be able to bring linuxbrew-core and homebrew-core closer together,
I am introducing a new generic attribute that can be used in formulae.
2020-06-20 23:14:18 +02:00
Michka Popoff
c7927f5af5 formula: add linux and macos only function blocks 2020-04-12 23:51:41 +02:00