-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
290 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
module OS | ||
module Linux | ||
module CLI | ||
module Parser | ||
extend T::Helpers | ||
|
||
requires_ancestor { Homebrew::CLI::Parser } | ||
|
||
sig { void } | ||
def set_default_options | ||
args["formula?"] = true if args.respond_to?(:formula?) | ||
end | ||
|
||
sig { void } | ||
def validate_options | ||
return unless args.respond_to?(:cask?) | ||
return unless args.cask? | ||
|
||
# NOTE: We don't raise an error here because we don't want | ||
# to print the help page or a stack trace. | ||
odie "Invalid `--cask` usage: Casks do not work on Linux" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Homebrew::CLI::Parser.prepend(Homebrew::OS::Linux::CLI::Parser) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,58 @@ | ||
# typed: true # rubocop:disable Sorbet/StrictSigil | ||
# frozen_string_literal: true | ||
|
||
module FormulaLinux | ||
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}" | ||
module Homebrew | ||
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) | ||
return unless DevelopmentTools.needs_build_formulae? | ||
|
||
@global_deps ||= begin | ||
dependency_collector = spec.dependency_collector | ||
related_formula_names = Set.new([ | ||
name, | ||
*aliases, | ||
*versioned_formulae_names, | ||
]) | ||
[ | ||
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? | ||
requirements.none?(MacOSRequirement) | ||
end | ||
end | ||
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) | ||
return unless DevelopmentTools.needs_build_formulae? | ||
|
||
@global_deps ||= begin | ||
dependency_collector = spec.dependency_collector | ||
related_formula_names = Set.new([ | ||
name, | ||
*aliases, | ||
*versioned_formulae_names, | ||
]) | ||
[ | ||
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? | ||
requirements.none?(MacOSRequirement) | ||
end | ||
end | ||
|
||
Formula.prepend(FormulaLinux) | ||
Formula.prepend(Homebrew::OS::Linux::Formula) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module CleanerMac | ||
private | ||
module Homebrew | ||
module OS | ||
module MacOS | ||
module Cleaner | ||
private | ||
|
||
sig { params(path: Pathname).returns(T::Boolean) } | ||
def executable_path?(path) | ||
path.mach_o_executable? || path.text_executable? | ||
sig { params(path: Pathname).returns(T::Boolean) } | ||
def executable_path?(path) | ||
path.mach_o_executable? || path.text_executable? | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Cleaner.prepend(CleanerMac) | ||
Cleaner.prepend(Homebrew::OS::MacOS::Cleaner) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.