This commit is contained in:
Douglas Eichelberger 2024-09-22 11:16:23 -07:00
parent 0d5b56aa6a
commit f4a6dce64a
7 changed files with 112 additions and 97 deletions

View File

@ -68,7 +68,6 @@ module Stdenv
gcc_formula = gcc_version_formula(cc)
append_path "PATH", gcc_formula.opt_bin.to_s
end
alias generic_setup_build_environment setup_build_environment
sig { returns(T.nilable(PATH)) }
def determine_pkg_config_libdir

View File

@ -119,7 +119,6 @@ module Superenv
# These flags will also be present:
# a - apply fix for apr-1-config path
end
alias generic_setup_build_environment setup_build_environment
private

View File

@ -1,7 +1,13 @@
# typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
module OS
module Linux
module Stdenv
extend T::Helpers
requires_ancestor { ::Stdenv }
sig {
params(
formula: T.nilable(Formula),
@ -12,10 +18,9 @@ module Stdenv
debug_symbols: T.nilable(T::Boolean),
).void
}
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
debug_symbols: false)
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
testing_formula:, debug_symbols:)
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
testing_formula: false, debug_symbols: false)
super
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
@ -29,8 +34,12 @@ module Stdenv
end
def libxml2
append "CPPFLAGS", "-I#{Formula["libxml2"].include/"libxml2"}"
append "CPPFLAGS", "-I#{::Formula["libxml2"].include/"libxml2"}"
rescue FormulaUnavailableError
nil
end
end
end
end
Stdenv.prepend(OS::Linux::Stdenv)

View File

@ -1,7 +1,13 @@
# typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
module OS
module Linux
module Superenv
extend T::Helpers
requires_ancestor { ::Superenv }
sig { returns(Pathname) }
def self.shims_path
HOMEBREW_SHIMS_PATH/"linux/super"
@ -22,10 +28,9 @@ module Superenv
debug_symbols: T.nilable(T::Boolean),
).void
}
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
debug_symbols: false)
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
testing_formula:, debug_symbols:)
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
testing_formula: false, debug_symbols: false)
super
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
@ -71,3 +76,7 @@ module Superenv
path
end
end
end
end
Superenv.prepend(OS::Linux::Superenv)

View File

@ -26,8 +26,7 @@ module OS
}
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
testing_formula: false, debug_symbols: false)
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
testing_formula:, debug_symbols:)
super
append "LDFLAGS", "-Wl,-headerpad_max_install_names"

View File

@ -108,8 +108,7 @@ module OS
self["M4"] = gm4
end
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
testing_formula:, debug_symbols:)
super
# Filter out symbols known not to be defined since GNU Autotools can't
# reliably figure this out with Xcode 8 and above.

View File

@ -6,6 +6,7 @@ require "system_command"
class Keg
include SystemCommand::Mixin
# TODO: re-implement these as functions, so that we aren't modifying constants:
GENERIC_KEG_LINK_DIRECTORIES = (remove_const :KEG_LINK_DIRECTORIES).freeze
KEG_LINK_DIRECTORIES = (GENERIC_KEG_LINK_DIRECTORIES + ["Frameworks"]).freeze
GENERIC_MUST_EXIST_SUBDIRECTORIES = (remove_const :MUST_EXIST_SUBDIRECTORIES).freeze