Add newlines between methods

This commit is contained in:
Jack Nagel 2014-04-21 00:17:22 -05:00
parent 815e7f29fc
commit 85109c95d8

View File

@ -35,6 +35,7 @@ class Cmd
@brewtmp = ENV['HOMEBREW_TEMP'] @brewtmp = ENV['HOMEBREW_TEMP']
@sdkroot = ENV['HOMEBREW_SDKROOT'] @sdkroot = ENV['HOMEBREW_SDKROOT']
end end
def mode def mode
if @arg0 == 'cpp' or @arg0 == 'ld' if @arg0 == 'cpp' or @arg0 == 'ld'
@arg0.to_sym @arg0.to_sym
@ -54,6 +55,7 @@ class Cmd
end end
end end
end end
def tool def tool
@tool ||= case @arg0 @tool ||= case @arg0
when 'ld' then 'ld' when 'ld' then 'ld'
@ -73,6 +75,7 @@ class Cmd
ENV['HOMEBREW_CC'] ENV['HOMEBREW_CC']
end end
end end
def args def args
if @args.length == 1 and @args[0] == '-v' if @args.length == 1 and @args[0] == '-v'
# Don't add linker arguments if -v passed as sole option. This stops gcc # Don't add linker arguments if -v passed as sole option. This stops gcc
@ -113,6 +116,7 @@ class Cmd
make_fuss(allflags) make_fuss(allflags)
allflags allflags
end end
def refurbished_args def refurbished_args
lset = Set.new(libpath + syslibpath) lset = Set.new(libpath + syslibpath)
iset = Set.new(cpath.flatten) iset = Set.new(cpath.flatten)
@ -189,6 +193,7 @@ class Cmd
args << "-std=#{@arg0}" if @arg0 =~ /c[89]9/ args << "-std=#{@arg0}" if @arg0 =~ /c[89]9/
args args
end end
def cxxflags def cxxflags
args = cflags args = cflags
args << '-std=c++11' if cccfg? 'x' args << '-std=c++11' if cccfg? 'x'
@ -196,17 +201,20 @@ class Cmd
args << '-stdlib=libstdc++' if cccfg? 'h' args << '-stdlib=libstdc++' if cccfg? 'h'
args args
end end
def optflags def optflags
args = [] args = []
args << "-#{ENV['HOMEBREW_OPTIMIZATION_LEVEL']}" args << "-#{ENV['HOMEBREW_OPTIMIZATION_LEVEL']}"
args.concat ENV['HOMEBREW_OPTFLAGS'].split(' ') if ENV['HOMEBREW_OPTFLAGS'] args.concat ENV['HOMEBREW_OPTFLAGS'].split(' ') if ENV['HOMEBREW_OPTFLAGS']
args args
end end
def archflags def archflags
args = [] args = []
args.concat ENV['HOMEBREW_ARCHFLAGS'].split(' ') if cccfg? 'u' args.concat ENV['HOMEBREW_ARCHFLAGS'].split(' ') if cccfg? 'u'
args args
end end
def syspath def syspath
if sdkroot if sdkroot
%W{#{sdkroot}/usr #{sdkroot}/usr/local} %W{#{sdkroot}/usr #{sdkroot}/usr/local}
@ -214,12 +222,14 @@ class Cmd
%W{/usr /usr/local} %W{/usr /usr/local}
end end
end end
def syslibpath def syslibpath
# We reject brew's lib as we explicitly add this as a -L flag, thus it # We reject brew's lib as we explicitly add this as a -L flag, thus it
# is given higher priority by cc, so it surpasses the system libpath. # is given higher priority by cc, so it surpasses the system libpath.
# NOTE this only counts if Homebrew is installed at /usr/local # NOTE this only counts if Homebrew is installed at /usr/local
syspath.reject { |d| d == brewfix }.map! { |d| File.join(d, "lib") } syspath.reject { |d| d == brewfix }.map! { |d| File.join(d, "lib") }
end end
def cpath def cpath
cpath = path_split("CMAKE_PREFIX_PATH").map! { |d| File.join(d, "include") } cpath = path_split("CMAKE_PREFIX_PATH").map! { |d| File.join(d, "include") }
cpath += path_split("CMAKE_INCLUDE_PATH") cpath += path_split("CMAKE_INCLUDE_PATH")
@ -227,12 +237,14 @@ class Cmd
sys = cpath - opt sys = cpath - opt
[sys, opt] [sys, opt]
end end
def libpath def libpath
libpath = path_split("CMAKE_PREFIX_PATH").map! { |d| File.join(d, "lib") } libpath = path_split("CMAKE_PREFIX_PATH").map! { |d| File.join(d, "lib") }
libpath += path_split("CMAKE_LIBRARY_PATH") libpath += path_split("CMAKE_LIBRARY_PATH")
libpath -= syslibpath libpath -= syslibpath
libpath libpath
end end
def ldflags def ldflags
args = path_flags("-L", libpath) args = path_flags("-L", libpath)
case mode case mode
@ -245,12 +257,14 @@ class Cmd
end end
args args
end end
def cppflags def cppflags
sys, opt = cpath sys, opt = cpath
# we want our keg-only includes to be found before system includes *and* # we want our keg-only includes to be found before system includes *and*
# before any other includes the build-system adds # before any other includes the build-system adds
path_flags("-isystem", sys) + path_flags("-I", opt) path_flags("-isystem", sys) + path_flags("-I", opt)
end end
def make_fuss args def make_fuss args
return unless make_fuss? return unless make_fuss?
@ -262,28 +276,35 @@ class Cmd
LOGGER.puts "superenv deduped: #{dups}" unless dups.empty? LOGGER.puts "superenv deduped: #{dups}" unless dups.empty?
LOGGER.puts "superenv added: #{adds*' '}" unless adds.empty? LOGGER.puts "superenv added: #{adds*' '}" unless adds.empty?
end end
def make_fuss? def make_fuss?
cccfg? 'O' and not configure? cccfg? 'O' and not configure?
end end
def configure? def configure?
# configure scripts generated with autoconf 2.61 or later export as_nl # configure scripts generated with autoconf 2.61 or later export as_nl
ENV.key? 'as_nl' ENV.key? 'as_nl'
end end
def cccfg? flags def cccfg? flags
flags.split('').all?{|c| ENV['HOMEBREW_CCCFG'].include? c } if ENV['HOMEBREW_CCCFG'] flags.split('').all?{|c| ENV['HOMEBREW_CCCFG'].include? c } if ENV['HOMEBREW_CCCFG']
end end
def canonical_path(path) def canonical_path(path)
path = Pathname.new(path) path = Pathname.new(path)
path = path.realpath if path.exist? path = path.realpath if path.exist?
path.to_s path.to_s
end end
def path_flags(prefix, paths) def path_flags(prefix, paths)
paths = paths.uniq.select { |path| File.directory?(path) } paths = paths.uniq.select { |path| File.directory?(path) }
paths.map! { |path| prefix + path } paths.map! { |path| prefix + path }
end end
def path_split(key) def path_split(key)
ENV.fetch(key) { "" }.split(File::PATH_SEPARATOR) ENV.fetch(key) { "" }.split(File::PATH_SEPARATOR)
end end
def chuzzle(val) def chuzzle(val)
return val if val.nil? return val if val.nil?
val = val.chomp val = val.chomp