Module: Stdenv
- Includes:
- OS::Linux::Stdenv, OS::Mac::Stdenv, SharedEnvExtension
- Included in:
- Sorbet::Private::Static::ENVClass
- Defined in:
- extend/ENV/std.rb
Constant Summary
Constants included from CompilerConstants
CompilerConstants::COMPILERS, CompilerConstants::COMPILER_SYMBOL_MAP, CompilerConstants::GNU_GCC_REGEXP, CompilerConstants::GNU_GCC_VERSIONS
Instance Method Summary collapse
- #clang ⇒ void private
- #cxx11 ⇒ void private
-
#deparallelize(&block) ⇒ T.untyped
private
Removes the MAKEFLAGS environment variable, causing make to use a single job.
- #determine_pkg_config_libdir ⇒ PATH? private
- #libcxx ⇒ void private
- #libxml2 ⇒ void private
- #setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false, debug_symbols: false) ⇒ void private
Methods included from SharedEnvExtension
#append, #append_path, #append_to_cccfg, #append_to_cflags, #append_to_rustflags, #bottle_arch, #build_bottle?, #cc, #cflags, #compiler, #cppflags, #cxx, #cxxflags, #debug_symbols?, #effective_arch, #fc, #fcflags, #fflags, #fortran, #ldflags, #make_jobs, #permit_arch_flags, #prepend, #prepend_create_path, #prepend_path, #refurbish_args, #remove, #remove_cc_etc, #remove_from_cflags
Methods included from Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_once, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_incompatible, #pretty_install_status, #pretty_installed, #pretty_removed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning
Methods included from OS::Linux::SharedEnvExtension
Methods included from OS::Mac::Stdenv
#macosxsdk, #no_fixup_chains, #no_weak_imports, #remove_macosxsdk
Instance Method Details
#clang ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
141 142 143 144 145 146 147 |
# File 'extend/ENV/std.rb', line 141 def clang super CC_FLAG_VARS.each do |key| self[key] = fetch(key).sub(/-Xarch_#{Hardware::CPU.arch_32_bit} (-march=\S*)/, '\1') if key?(key) end set_cpu_cflags end |
#cxx11 ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
150 151 152 153 |
# File 'extend/ENV/std.rb', line 150 def cxx11 append "CXX", "-std=c++11" libcxx end |
#deparallelize(&block) ⇒ T.untyped
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Removes the MAKEFLAGS environment variable, causing make to use a single job. This is useful for makefiles with race conditions. When passed a block, MAKEFLAGS is removed only for the duration of the block and is restored after its completion.
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'extend/ENV/std.rb', line 92 def deparallelize(&block) old = self["MAKEFLAGS"] remove "MAKEFLAGS", /-j\d+/ if block begin yield ensure self["MAKEFLAGS"] = old end end old end |
#determine_pkg_config_libdir ⇒ PATH?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
79 80 81 82 83 84 85 86 |
# File 'extend/ENV/std.rb', line 79 def determine_pkg_config_libdir PATH.new( HOMEBREW_PREFIX/"lib/pkgconfig", HOMEBREW_PREFIX/"share/pkgconfig", homebrew_extra_pkg_config_paths, "/usr/lib/pkgconfig", ).existing end |
#libcxx ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
156 157 158 |
# File 'extend/ENV/std.rb', line 156 def libcxx append "CXX", "-stdlib=libc++" if compiler == :clang end |
#libxml2 ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
74 75 76 |
# File 'extend/ENV/std.rb', line 74 def libxml2 odeprecated "ENV.libxml2", "`pkg-config` or explicit include paths" end |
#setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false, debug_symbols: false) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'extend/ENV/std.rb', line 23 def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false, debug_symbols: false) super self["HOMEBREW_ENV"] = "std" ORIGINAL_PATHS.reverse_each { |p| prepend_path "PATH", p } prepend_path "PATH", HOMEBREW_SHIMS_PATH/"shared" # Set the default pkg-config search path, overriding the built-in paths # Anything in PKG_CONFIG_PATH is searched before paths in this variable self["PKG_CONFIG_LIBDIR"] = determine_pkg_config_libdir&.to_s self["MAKEFLAGS"] = "-j#{make_jobs}" self["RUSTC_WRAPPER"] = "#{HOMEBREW_SHIMS_PATH}/shared/rustc_wrapper" self["HOMEBREW_RUSTFLAGS"] = Hardware.rustflags_target_cpu(effective_arch) if HOMEBREW_PREFIX.to_s != "/usr/local" # /usr/local is already an -isystem and -L directory so we skip it self["CPPFLAGS"] = "-isystem#{HOMEBREW_PREFIX}/include" self["LDFLAGS"] = "-L#{HOMEBREW_PREFIX}/lib" # CMake ignores the variables above self["CMAKE_PREFIX_PATH"] = HOMEBREW_PREFIX.to_s end frameworks = HOMEBREW_PREFIX.join("Frameworks") if frameworks.directory? append "CPPFLAGS", "-F#{frameworks}" append "LDFLAGS", "-F#{frameworks}" self["CMAKE_FRAMEWORK_PATH"] = frameworks.to_s end # Os is the default Apple uses for all its stuff so let's trust them CC_FLAG_VARS.each { |key| self[key] = "-Os #{SAFE_CFLAGS_FLAGS}" } begin send(compiler) rescue CompilerSelectionError # We don't care if our compiler fails to build the formula during `brew test`. raise unless testing_formula send(DevelopmentTools.default_compiler) end return unless cc&.match?(GNU_GCC_REGEXP) gcc_formula = gcc_version_formula(cc) append_path "PATH", gcc_formula.opt_bin.to_s end |