Module: Superenv

Includes:
SharedEnvExtension
Defined in:
Library/Homebrew/extend/ENV/super.rb,
Library/Homebrew/extend/os/mac/extend/ENV/super.rb,
Library/Homebrew/extend/os/linux/extend/ENV/super.rb

Overview

typed: false frozen_string_literal: true

Instance Method Summary collapse

Methods included from SharedEnvExtension

#append, #append_path, #append_to_cccfg, #append_to_cflags, #cc, #cflags, #compiler, #cppflags, #cxx, #cxxflags, #fc, #fcflags, #fflags, #fortran, #ldflags, #ncurses_define, #no_weak_imports_support?, #permit_weak_imports, #prepend, #prepend_create_path, #prepend_path, #remove, #remove_cc_etc, #remove_from_cflags

Instance Method Details

#cxx11Object


272
273
274
275
# File 'Library/Homebrew/extend/ENV/super.rb', line 272

def cxx11
  append_to_cccfg "x"
  append_to_cccfg "g" if homebrew_cc == "clang"
end

#deparallelizeObject

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.


236
237
238
239
240
241
242
243
244
245
246
247
# File 'Library/Homebrew/extend/ENV/super.rb', line 236

def deparallelize
  old = delete("MAKEFLAGS")
  if block_given?
    begin
      yield
    ensure
      self["MAKEFLAGS"] = old
    end
  end

  old
end

#determine_cccfgObject


227
228
229
# File 'Library/Homebrew/extend/ENV/super.rb', line 227

def determine_cccfg
  ""
end

#determine_dynamic_linker_pathObject


37
38
39
40
41
42
# File 'Library/Homebrew/extend/os/linux/extend/ENV/super.rb', line 37

def determine_dynamic_linker_path
  path = "#{HOMEBREW_PREFIX}/lib/ld.so"
  return unless File.readable? path

  path
end

#determine_rpath_paths(formula) ⇒ Object


29
30
31
32
33
34
35
# File 'Library/Homebrew/extend/os/linux/extend/ENV/super.rb', line 29

def determine_rpath_paths(formula)
  PATH.new(
    *formula&.lib,
    "#{HOMEBREW_PREFIX}/lib",
    PATH.new(run_time_deps.map { |dep| dep.opt_lib.to_s }).existing,
  )
end

#homebrew_extra_aclocal_pathsObject


141
142
143
# File 'Library/Homebrew/extend/ENV/super.rb', line 141

def homebrew_extra_aclocal_paths
  []
end

#homebrew_extra_cmake_frameworks_pathsObject


208
209
210
# File 'Library/Homebrew/extend/ENV/super.rb', line 208

def homebrew_extra_cmake_frameworks_paths
  []
end

#homebrew_extra_cmake_include_pathsObject


192
193
194
# File 'Library/Homebrew/extend/ENV/super.rb', line 192

def homebrew_extra_cmake_include_paths
  []
end

#homebrew_extra_cmake_library_pathsObject


200
201
202
# File 'Library/Homebrew/extend/ENV/super.rb', line 200

def homebrew_extra_cmake_library_paths
  []
end

#homebrew_extra_isystem_pathsObject


153
154
155
# File 'Library/Homebrew/extend/ENV/super.rb', line 153

def homebrew_extra_isystem_paths
  []
end

#homebrew_extra_library_pathsObject


168
169
170
# File 'Library/Homebrew/extend/ENV/super.rb', line 168

def homebrew_extra_library_paths
  []
end

#homebrew_extra_pathsObject


102
103
104
# File 'Library/Homebrew/extend/ENV/super.rb', line 102

def homebrew_extra_paths
  []
end

#libcxxObject


277
278
279
# File 'Library/Homebrew/extend/ENV/super.rb', line 277

def libcxx
  append_to_cccfg "g" if compiler == :clang
end

#libstdcxxObject


281
282
283
# File 'Library/Homebrew/extend/ENV/super.rb', line 281

def libstdcxx
  append_to_cccfg "h" if compiler == :clang
end

#m32Object


264
265
266
# File 'Library/Homebrew/extend/ENV/super.rb', line 264

def m32
  append "HOMEBREW_ARCHFLAGS", "-m32"
end

#m64Object


268
269
270
# File 'Library/Homebrew/extend/ENV/super.rb', line 268

def m64
  append "HOMEBREW_ARCHFLAGS", "-m64"
end

#make_jobsObject


249
250
251
252
# File 'Library/Homebrew/extend/ENV/super.rb', line 249

def make_jobs
  self["MAKEFLAGS"] =~ /-\w*j(\d+)/
  [Regexp.last_match(1).to_i, 1].max
end

#no_weak_importsObject


151
152
153
# File 'Library/Homebrew/extend/os/mac/extend/ENV/super.rb', line 151

def no_weak_imports
  append_to_cccfg "w" if no_weak_imports_support?
end

#permit_arch_flagsObject


260
261
262
# File 'Library/Homebrew/extend/ENV/super.rb', line 260

def permit_arch_flags
  append_to_cccfg "K"
end

#resetObject


32
33
34
35
36
37
# File 'Library/Homebrew/extend/ENV/super.rb', line 32

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

#set_cpu_flags(_arg0, _arg1 = "", _arg2 = {}) ⇒ Object


298
# File 'Library/Homebrew/extend/ENV/super.rb', line 298

def set_cpu_flags(_arg0, _arg1 = "", _arg2 = {}); end

#set_x11_env_if_installedObject


296
# File 'Library/Homebrew/extend/ENV/super.rb', line 296

def set_x11_env_if_installed; end

#universal_binaryObject


254
255
256
257
258
# File 'Library/Homebrew/extend/ENV/super.rb', line 254

def universal_binary
  check_for_compiler_universal_support

  self["HOMEBREW_ARCHFLAGS"] = Hardware::CPU.universal_archs.as_arch_flags
end