Module: Superenv Private
- Includes:
- SharedEnvExtension
- Defined in:
- extend/os/mac/extend/ENV/super.rb,
extend/os/linux/extend/ENV/super.rb,
extend/ENV/super.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Why superenv
?
- Only specify the environment we need (NO LDFLAGS for cmake)
- Only apply compiler-specific options when we are calling that compiler
- Force all incpaths and libpaths into the cc instantiation (fewer bugs)
- Cater toolchain usage to specific Xcode versions
- Remove flags that we don't want or that will break builds
- Simpler code
- Simpler formulae that just work
- Build-system agnostic configuration of the toolchain
Constant Summary
Constants included from CompilerConstants
CompilerConstants::COMPILERS, CompilerConstants::COMPILER_SYMBOL_MAP, CompilerConstants::GNU_GCC_REGEXP, CompilerConstants::GNU_GCC_VERSIONS
Instance Attribute Summary collapse
- #deps ⇒ Object private
- #keg_only_deps ⇒ Object private
- #run_time_deps ⇒ Object private
Class Method Summary collapse
- .bin ⇒ Pathname? private
- .extended(base) ⇒ void private
-
.shims_path ⇒ Pathname
The location of Homebrew's shims.
Instance Method Summary collapse
- #cxx11 ⇒ void private
-
#deparallelize(&block) ⇒ T.untyped
private
Removes the MAKEFLAGS environment variable, causing make to use a single job.
- #determine_cccfg ⇒ String private
- #determine_dynamic_linker_path ⇒ String? private
- #determine_rpath_paths(formula) ⇒ Object private
- #homebrew_extra_cmake_frameworks_paths ⇒ Array<Pathname> private
- #homebrew_extra_cmake_include_paths ⇒ Array<Pathname> private
- #homebrew_extra_cmake_library_paths ⇒ Array<Pathname> private
- #homebrew_extra_isystem_paths ⇒ Array<Pathname> private
- #homebrew_extra_library_paths ⇒ Array<Pathname> private
- #homebrew_extra_paths ⇒ Array<Pathname> (also: #generic_homebrew_extra_paths) private
- #libcxx ⇒ void private
- #make_jobs ⇒ Integer private
- #no_fixup_chains ⇒ Object private
- #no_weak_imports ⇒ Object private
- #O0(&block) ⇒ Object private
- #O1(&block) ⇒ void private
- #O3(&block) ⇒ void private
- #permit_arch_flags ⇒ void private
- #refurbish_args ⇒ void private
- #reset ⇒ void private
- #runtime_cpu_detection ⇒ void private
- #set_debug_symbols ⇒ 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, #no_fixup_chains_support?, #no_weak_imports_support?, #prepend, #prepend_create_path, #prepend_path, #remove, #remove_cc_etc, #remove_from_cflags
Instance Attribute Details
#deps ⇒ Object
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.
20 21 22 |
# File 'extend/ENV/super.rb', line 20 def deps @deps end |
#keg_only_deps ⇒ Object
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.
20 21 22 |
# File 'extend/ENV/super.rb', line 20 def keg_only_deps @keg_only_deps end |
#run_time_deps ⇒ Object
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.
20 21 22 |
# File 'extend/ENV/super.rb', line 20 def run_time_deps @run_time_deps end |
Class Method Details
.bin ⇒ Pathname?
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.
13 14 15 16 17 |
# File 'extend/os/mac/extend/ENV/super.rb', line 13 def bin return unless DevelopmentTools.installed? shims_path.realpath end |
.extended(base) ⇒ 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 |
# File 'extend/ENV/super.rb', line 23 def self.extended(base) base.keg_only_deps = [] base.deps = [] base.run_time_deps = [] end |
.shims_path ⇒ Pathname
The location of Homebrew's shims.
7 8 9 |
# File 'extend/os/mac/extend/ENV/super.rb', line 7 def shims_path HOMEBREW_SHIMS_PATH/"mac/super" end |
Instance Method Details
#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.
354 355 356 357 |
# File 'extend/ENV/super.rb', line 354 def cxx11 append_to_cccfg "x" append_to_cccfg "g" if homebrew_cc == "clang" 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.
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'extend/ENV/super.rb', line 321 def deparallelize(&block) old_makeflags = delete("MAKEFLAGS") old_make_jobs = delete("HOMEBREW_MAKE_JOBS") self["HOMEBREW_MAKE_JOBS"] = "1" if block begin yield ensure self["MAKEFLAGS"] = old_makeflags self["HOMEBREW_MAKE_JOBS"] = old_make_jobs end end old_makeflags end |
#determine_cccfg ⇒ String
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.
78 79 80 81 82 83 |
# File 'extend/os/mac/extend/ENV/super.rb', line 78 def determine_cccfg s = +"" # Fix issue with >= Mountain Lion apr-1-config having broken paths s << "a" s.freeze end |
#determine_dynamic_linker_path ⇒ String?
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.
67 68 69 70 71 72 |
# File 'extend/os/linux/extend/ENV/super.rb', line 67 def determine_dynamic_linker_path path = "#{HOMEBREW_PREFIX}/lib/ld.so" return unless File.readable? path path end |
#determine_rpath_paths(formula) ⇒ Object
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.
57 58 59 60 61 62 63 64 |
# File 'extend/os/linux/extend/ENV/super.rb', line 57 def determine_rpath_paths(formula) PATH.new( *formula&.lib, "#{HOMEBREW_PREFIX}/opt/gcc/lib/gcc/current", PATH.new(run_time_deps.map { |dep| dep.opt_lib.to_s }).existing, "#{HOMEBREW_PREFIX}/lib", ) end |
#homebrew_extra_cmake_frameworks_paths ⇒ Array<Pathname>
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.
72 73 74 75 76 |
# File 'extend/os/mac/extend/ENV/super.rb', line 72 def homebrew_extra_cmake_frameworks_paths paths = [] paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks" if MacOS::Xcode.without_clt? paths end |
#homebrew_extra_cmake_include_paths ⇒ Array<Pathname>
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.
60 61 62 63 64 65 66 |
# File 'extend/os/mac/extend/ENV/super.rb', line 60 def homebrew_extra_cmake_include_paths paths = [] paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed? paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt? paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers" paths end |
#homebrew_extra_cmake_library_paths ⇒ Array<Pathname>
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.
68 69 70 |
# File 'extend/os/mac/extend/ENV/super.rb', line 68 def homebrew_extra_cmake_library_paths [Pathname("#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries")] end |
#homebrew_extra_isystem_paths ⇒ Array<Pathname>
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.
42 43 44 45 46 47 48 |
# File 'extend/os/mac/extend/ENV/super.rb', line 42 def homebrew_extra_isystem_paths paths = [] paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/libxml2" if libxml2_include_needed? paths << "#{self["HOMEBREW_SDKROOT"]}/usr/include/apache2" if MacOS::Xcode.without_clt? paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers" paths end |
#homebrew_extra_library_paths ⇒ Array<Pathname>
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.
50 51 52 53 54 55 56 57 58 |
# File 'extend/os/mac/extend/ENV/super.rb', line 50 def homebrew_extra_library_paths paths = [] if compiler == :llvm_clang paths << "#{self["HOMEBREW_SDKROOT"]}/usr/lib" paths << Formula["llvm"].opt_lib.to_s end paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries" paths end |
#homebrew_extra_paths ⇒ Array<Pathname> Also known as: generic_homebrew_extra_paths
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.
35 36 37 38 39 40 41 42 43 44 |
# File 'extend/os/linux/extend/ENV/super.rb', line 35 def homebrew_extra_paths paths = generic_homebrew_extra_paths paths += %w[binutils make].filter_map do |f| bin = Formulary.factory(f).opt_bin bin if bin.directory? rescue FormulaUnavailableError nil end paths 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.
360 361 362 |
# File 'extend/ENV/super.rb', line 360 def libcxx append_to_cccfg "g" if compiler == :clang end |
#make_jobs ⇒ Integer
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.
338 339 340 341 |
# File 'extend/ENV/super.rb', line 338 def make_jobs self["MAKEFLAGS"] =~ /-\w*j(\d+)/ [Regexp.last_match(1).to_i, 1].max end |
#no_fixup_chains ⇒ Object
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.
168 169 170 |
# File 'extend/os/mac/extend/ENV/super.rb', line 168 def no_fixup_chains append_to_cccfg "f" if no_fixup_chains_support? end |
#no_weak_imports ⇒ Object
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.
164 165 166 |
# File 'extend/os/mac/extend/ENV/super.rb', line 164 def no_weak_imports append_to_cccfg "w" if no_weak_imports_support? end |
#O0(&block) ⇒ Object
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.
377 378 379 380 381 382 383 |
# File 'extend/ENV/super.rb', line 377 def O0(&block) if block with_env(HOMEBREW_OPTIMIZATION_LEVEL: "O0", &block) else self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O0" end end |
#O1(&block) ⇒ 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.
386 387 388 389 390 391 392 |
# File 'extend/ENV/super.rb', line 386 def O1(&block) if block with_env(HOMEBREW_OPTIMIZATION_LEVEL: "O1", &block) else self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O1" end end |
#O3(&block) ⇒ 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.
395 396 397 398 399 400 401 |
# File 'extend/ENV/super.rb', line 395 def O3(&block) if block with_env(HOMEBREW_OPTIMIZATION_LEVEL: "O3", &block) else self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O3" end end |
#permit_arch_flags ⇒ 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.
344 345 346 |
# File 'extend/ENV/super.rb', line 344 def permit_arch_flags append_to_cccfg "K" end |
#refurbish_args ⇒ 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.
370 371 372 |
# File 'extend/ENV/super.rb', line 370 def refurbish_args append_to_cccfg "O" end |
#reset ⇒ 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.
41 42 43 44 45 46 |
# File 'extend/ENV/super.rb', line 41 def reset super # Configure scripts generated by autoconf 2.61 or later export as_nl, which # we use as a heuristic for running under configure delete("as_nl") end |
#runtime_cpu_detection ⇒ 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.
349 350 351 |
# File 'extend/ENV/super.rb', line 349 def runtime_cpu_detection append_to_cccfg "d" end |
#set_debug_symbols ⇒ 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.
365 366 367 |
# File 'extend/ENV/super.rb', line 365 def set_debug_symbols append_to_cccfg "D" end |