Revert ENV changes

This commit is contained in:
Douglas Eichelberger 2024-10-05 12:35:28 -07:00
parent f4a6dce64a
commit 0855d7c9e0
6 changed files with 351 additions and 377 deletions

View File

@ -68,6 +68,7 @@ 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,6 +119,7 @@ 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,13 +1,7 @@
# 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),
@ -18,9 +12,10 @@ module OS
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)
super
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:)
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
@ -34,12 +29,8 @@ module OS
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,13 +1,7 @@
# 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"
@ -28,9 +22,10 @@ module OS
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)
super
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:)
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
@ -76,7 +71,3 @@ module OS
path
end
end
end
end
Superenv.prepend(OS::Linux::Superenv)

View File

@ -1,12 +1,8 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# frozen_string_literal: true
module OS
module Mac
module Stdenv
extend T::Helpers
requires_ancestor { ::Stdenv }
undef homebrew_extra_pkg_config_paths
sig { returns(T::Array[Pathname]) }
def homebrew_extra_pkg_config_paths
@ -16,7 +12,7 @@ module OS
sig {
params(
formula: T.nilable(::Formula),
formula: T.nilable(Formula),
cc: T.nilable(String),
build_bottle: T.nilable(T::Boolean),
bottle_arch: T.nilable(String),
@ -24,9 +20,10 @@ module OS
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)
super
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:)
append "LDFLAGS", "-Wl,-headerpad_max_install_names"
@ -118,7 +115,3 @@ module OS
append "LDFLAGS", "-Wl,-no_fixup_chains" if no_fixup_chains_support?
end
end
end
end
Stdenv.prepend(OS::Mac::Stdenv)

View File

@ -1,26 +1,29 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# frozen_string_literal: true
module OS
module Mac
module Superenv
extend T::Helpers
requires_ancestor { ::Superenv }
module ClassMethods
class << self
# The location of Homebrew's shims on macOS.
def shims_path
HOMEBREW_SHIMS_PATH/"mac/super"
end
undef bin
def bin
return unless ::DevelopmentTools.installed?
return unless DevelopmentTools.installed?
shims_path.realpath
end
end
undef homebrew_extra_pkg_config_paths,
homebrew_extra_isystem_paths, homebrew_extra_library_paths,
homebrew_extra_cmake_include_paths,
homebrew_extra_cmake_library_paths,
homebrew_extra_cmake_frameworks_paths,
determine_cccfg
sig { returns(T::Array[Pathname]) }
def homebrew_extra_pkg_config_paths
[Pathname("/usr/lib/pkgconfig"), Pathname("#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}")]
@ -48,7 +51,7 @@ module OS
paths = []
if compiler == :llvm_clang
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/lib"
paths << ::Formula["llvm"].opt_lib.to_s
paths << Formula["llvm"].opt_lib.to_s
end
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
paths
@ -63,9 +66,7 @@ module OS
end
def homebrew_extra_cmake_library_paths
[Pathname(
"#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries",
)]
[Pathname("#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries")]
end
def homebrew_extra_cmake_frameworks_paths
@ -82,8 +83,8 @@ module OS
end
# @private
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
testing_formula: false, debug_symbols: false)
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
debug_symbols: false)
sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk
is_xcode_sdk = sdk&.source == :xcode
@ -104,11 +105,12 @@ module OS
if deps.none? { |d| d.name == "m4" } &&
MacOS.active_developer_dir == MacOS::CLT::PKG_PATH &&
!File.exist?("#{MacOS::CLT::PKG_PATH}/usr/bin/m4") &&
(gm4 = ::DevelopmentTools.locate("gm4").to_s).present?
(gm4 = DevelopmentTools.locate("gm4").to_s).present?
self["M4"] = gm4
end
super
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
testing_formula:, debug_symbols:)
# Filter out symbols known not to be defined since GNU Autotools can't
# reliably figure this out with Xcode 8 and above.
@ -167,8 +169,3 @@ module OS
append_to_cccfg "f" if no_fixup_chains_support?
end
end
end
end
Superenv.singleton_class.prepend(OS::Mac::Superenv::ClassMethods)
Superenv.prepend(OS::Mac::Superenv)