Module: Stdenv
- Includes:
- OS::Linux::Stdenv, OS::Mac::Stdenv, SharedEnvExtension
- 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
- #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, #cc, #cflags, #compiler, #cppflags, #cxx, #cxxflags, #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 OS::Linux::SharedEnvExtension
Methods included from OS::Mac::SharedEnvExtension
#no_fixup_chains_support?, #no_weak_imports_support?
Methods included from OS::Linux::Stdenv
Methods included from OS::Mac::Stdenv
#libxml2, #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.
129 130 131 132 133 134 135 136 137 138 |
# File 'extend/ENV/std.rb', line 129 def clang super replace_in_cflags(/-Xarch_#{Hardware::CPU.arch_32_bit} (-march=\S*)/, '\1') map = Hardware::CPU.optimization_flags.dup if DevelopmentTools.clang_build_version < 700 # Clang mistakenly enables AES-NI on plain Nehalem map[:nehalem] = "-march=nehalem -Xclang -target-feature -Xclang -aes" end set_cpu_cflags(map) 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.
141 142 143 144 |
# File 'extend/ENV/std.rb', line 141 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.
86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'extend/ENV/std.rb', line 86 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.
73 74 75 76 77 78 79 80 |
# File 'extend/ENV/std.rb', line 73 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.
147 148 149 |
# File 'extend/ENV/std.rb', line 147 def libcxx append "CXX", "-stdlib=libc++" if compiler == :clang 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 |
# 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 self["MAKEFLAGS"] = "-j#{make_jobs}" self["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 define_cflags "-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 |