build: use with_env helper
This commit is contained in:
parent
610af15f0e
commit
8e645dfbec
@ -102,53 +102,52 @@ class Build
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
old_tmpdir = ENV["TMPDIR"]
|
new_env = {
|
||||||
old_temp = ENV["TEMP"]
|
"TMPDIR" => HOMEBREW_TEMP,
|
||||||
old_tmp = ENV["TMP"]
|
"TEMP" => HOMEBREW_TEMP,
|
||||||
ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP
|
"TMP" => HOMEBREW_TEMP,
|
||||||
|
}
|
||||||
|
|
||||||
formula.extend(Debrew::Formula) if ARGV.debug?
|
with_env(new_env) do
|
||||||
|
formula.extend(Debrew::Formula) if ARGV.debug?
|
||||||
|
|
||||||
formula.brew do |_formula, staging|
|
formula.brew do |_formula, staging|
|
||||||
staging.retain! if ARGV.keep_tmp?
|
staging.retain! if ARGV.keep_tmp?
|
||||||
formula.patch
|
formula.patch
|
||||||
|
|
||||||
if ARGV.git?
|
|
||||||
system "git", "init"
|
|
||||||
system "git", "add", "-A"
|
|
||||||
end
|
|
||||||
if ARGV.interactive?
|
|
||||||
ohai "Entering interactive mode"
|
|
||||||
puts "Type `exit' to return and finalize the installation"
|
|
||||||
puts "Install to this prefix: #{formula.prefix}"
|
|
||||||
|
|
||||||
if ARGV.git?
|
if ARGV.git?
|
||||||
puts "This directory is now a git repo. Make your changes and then use:"
|
system "git", "init"
|
||||||
puts " git diff | pbcopy"
|
system "git", "add", "-A"
|
||||||
puts "to copy the diff to the clipboard."
|
|
||||||
end
|
end
|
||||||
|
if ARGV.interactive?
|
||||||
|
ohai "Entering interactive mode"
|
||||||
|
puts "Type `exit' to return and finalize the installation"
|
||||||
|
puts "Install to this prefix: #{formula.prefix}"
|
||||||
|
|
||||||
interactive_shell(formula)
|
if ARGV.git?
|
||||||
else
|
puts "This directory is now a git repo. Make your changes and then use:"
|
||||||
formula.prefix.mkpath
|
puts " git diff | pbcopy"
|
||||||
|
puts "to copy the diff to the clipboard."
|
||||||
|
end
|
||||||
|
|
||||||
(formula.logs/"00.options.out").write \
|
interactive_shell(formula)
|
||||||
"#{formula.full_name} #{formula.build.used_options.sort.join(" ")}".strip
|
else
|
||||||
formula.install
|
formula.prefix.mkpath
|
||||||
|
|
||||||
stdlibs = detect_stdlibs(ENV.compiler)
|
(formula.logs/"00.options.out").write \
|
||||||
tab = Tab.create(formula, ENV.compiler, stdlibs.first)
|
"#{formula.full_name} #{formula.build.used_options.sort.join(" ")}".strip
|
||||||
tab.write
|
formula.install
|
||||||
|
|
||||||
# Find and link metafiles
|
stdlibs = detect_stdlibs(ENV.compiler)
|
||||||
formula.prefix.install_metafiles formula.buildpath
|
tab = Tab.create(formula, ENV.compiler, stdlibs.first)
|
||||||
formula.prefix.install_metafiles formula.libexec if formula.libexec.exist?
|
tab.write
|
||||||
|
|
||||||
|
# Find and link metafiles
|
||||||
|
formula.prefix.install_metafiles formula.buildpath
|
||||||
|
formula.prefix.install_metafiles formula.libexec if formula.libexec.exist?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ensure
|
|
||||||
ENV["TMPDIR"] = old_tmpdir
|
|
||||||
ENV["TEMP"] = old_temp
|
|
||||||
ENV["TMP"] = old_tmp
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def detect_stdlibs(compiler)
|
def detect_stdlibs(compiler)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user