mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
- Landlock needs no separate executable, installation or `sysctl` configuration, so use it as the only Linux sandbox implementation rather than an opt-in behind `$HOMEBREW_SANDBOX_LINUX_LANDLOCK`. - Delete `Sandbox::Bubblewrap`, the `brew setup-sandbox` command and the implicit `bubblewrap` dependency, none of which Landlock needs. - Remove the Bubblewrap-era `Sandbox` API (`ensure_sandbox_installed!`, `configure!`, `configuration_commands`, `sandbox_install_command`) and its call sites now that no backend needs installing or configuring. - Simplify `brew doctor`'s `check_linux_sandbox` to report the Landlock failure reason with the `$HOMEBREW_NO_SANDBOX_LINUX` workaround.
63 lines
1.8 KiB
Ruby
63 lines
1.8 KiB
Ruby
# typed: strict
|
|
# frozen_string_literal: true
|
|
|
|
module OS
|
|
module Linux
|
|
module Formula
|
|
extend T::Helpers
|
|
|
|
requires_ancestor { ::Formula }
|
|
|
|
sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) }
|
|
def shared_library(name, version = nil)
|
|
suffix = if version == "*" || (name == "*" && version.blank?)
|
|
"{,.*}"
|
|
elsif version.present?
|
|
".#{version}"
|
|
end
|
|
"#{name}.so#{suffix}"
|
|
end
|
|
|
|
sig { returns(String) }
|
|
def loader_path
|
|
"$ORIGIN"
|
|
end
|
|
|
|
sig { params(targets: T.nilable(T.any(::Pathname, String))).void }
|
|
def deuniversalize_machos(*targets); end
|
|
|
|
sig { params(spec: SoftwareSpec).void }
|
|
def add_global_deps_to_spec(spec)
|
|
@global_deps ||= T.let(nil, T.nilable(T::Array[Dependency]))
|
|
@global_deps ||= begin
|
|
dependency_collector = spec.dependency_collector
|
|
related_formula_names = Set[name]
|
|
if ::DevelopmentTools.needs_build_formulae? || ::DevelopmentTools.needs_libc_formula?
|
|
related_formula_names.merge(aliases)
|
|
related_formula_names.merge(versioned_formulae_names)
|
|
end
|
|
[
|
|
dependency_collector.gcc_dep_if_needed(related_formula_names),
|
|
dependency_collector.glibc_dep_if_needed(related_formula_names),
|
|
].compact.freeze
|
|
end
|
|
@global_deps.each { |dep| spec.dependency_collector.add(dep) }
|
|
end
|
|
|
|
sig { returns(T::Boolean) }
|
|
def valid_platform?
|
|
supports_linux?
|
|
end
|
|
|
|
sig { params(installdir: T.any(String, ::Pathname, FalseClass)).returns(T::Array[String]) }
|
|
def std_cabal_v2_args(installdir: bin)
|
|
args = super
|
|
args << "--ghc-option=-pie" if ::Hardware::CPU.arm?
|
|
args
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
Formula.prepend(OS::Linux::Formula)
|