有没有一种方法可以找到 HOMEBREW_CC/XX 在我安装软件包时设置的内容
Is there a way I can find what HOMEBREW_CC/XX was set to when I installed a package
我正在做的一些事情非常依赖于编译器。是否可以检查 boost
公式是否与 gcc-4.9 或 clang 编译器一起安装?
我要查找的内容可能如下所示:
$ echo HOMEBREW_CC
$ brew install boost
$ <comand>
built with clang
$ brew uninstall --force boost
$ export HOMEBREW_CC = gcc-4.9 ; export HOMEBREW_CXX = g++-4.9
$ brew install boost
$ <command>
built with gcc-4.9
收据中列出编译器
$ cat /usr/local/Cellar/boost/1.58.0/INSTALL_RECEIPT.json
{"used_options":["--c++11","--with-mpi","--without-single"],"unused_options":["--universal","--with-icu4c","--without-static"],"built_as_bottle":false,"poured_from_bottle":false,"time":1437512231,"HEAD":"1d7b6215cbe7d690e961f1a72f497a58c95f6de4","stdlib":"libstdcxx","compiler":"gcc-5","source":{"path":"/usr/local/Library/Formula/boost.rb","tap":"Homebrew/homebrew"}}~
..尽管我一起破解了另一个解决方案
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index bf11af0..1c1caf3 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -774,7 +774,9 @@ class Formula
"version" => keg.version.to_s,
"used_options" => tab.used_options.as_flags,
"built_as_bottle" => tab.built_bottle,
- "poured_from_bottle" => tab.poured_from_bottle
+ "poured_from_bottle" => tab.poured_from_bottle,
+ "cc_compiler" => tab.cc_compiler,
+ "cxx_compiler" => tab.cxx_compiler
}
end
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 37b0db2..de0fe11 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -182,6 +182,16 @@ class Tab < OpenStruct
end
def to_json
+ if ENV['HOMEBREW_CC'] then
+ cc_compiler = ENV['HOMEBREW_CC']
+ else
+ cc_compiler = "clang"
+ end
+ if ENV['HOMEBREW_CXX'] then
+ cxx_compiler = ENV['HOMEBREW_CXX']
+ else
+ cxx_compiler = "clang"
+ end
attributes = {
"used_options" => used_options.as_flags,
"unused_options" => unused_options.as_flags,
@@ -192,6 +202,8 @@ class Tab < OpenStruct
"stdlib" => (stdlib.to_s if stdlib),
"compiler" => (compiler.to_s if compiler),
"source" => source,
+ "cc_compiler" => cc_compiler,
+ "cxx_compiler" => cxx_compiler
}
Utils::JSON.dump(attributes)
我正在做的一些事情非常依赖于编译器。是否可以检查 boost
公式是否与 gcc-4.9 或 clang 编译器一起安装?
我要查找的内容可能如下所示:
$ echo HOMEBREW_CC
$ brew install boost
$ <comand>
built with clang
$ brew uninstall --force boost
$ export HOMEBREW_CC = gcc-4.9 ; export HOMEBREW_CXX = g++-4.9
$ brew install boost
$ <command>
built with gcc-4.9
收据中列出编译器
$ cat /usr/local/Cellar/boost/1.58.0/INSTALL_RECEIPT.json
{"used_options":["--c++11","--with-mpi","--without-single"],"unused_options":["--universal","--with-icu4c","--without-static"],"built_as_bottle":false,"poured_from_bottle":false,"time":1437512231,"HEAD":"1d7b6215cbe7d690e961f1a72f497a58c95f6de4","stdlib":"libstdcxx","compiler":"gcc-5","source":{"path":"/usr/local/Library/Formula/boost.rb","tap":"Homebrew/homebrew"}}~
..尽管我一起破解了另一个解决方案
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index bf11af0..1c1caf3 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -774,7 +774,9 @@ class Formula
"version" => keg.version.to_s,
"used_options" => tab.used_options.as_flags,
"built_as_bottle" => tab.built_bottle,
- "poured_from_bottle" => tab.poured_from_bottle
+ "poured_from_bottle" => tab.poured_from_bottle,
+ "cc_compiler" => tab.cc_compiler,
+ "cxx_compiler" => tab.cxx_compiler
}
end
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 37b0db2..de0fe11 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -182,6 +182,16 @@ class Tab < OpenStruct
end
def to_json
+ if ENV['HOMEBREW_CC'] then
+ cc_compiler = ENV['HOMEBREW_CC']
+ else
+ cc_compiler = "clang"
+ end
+ if ENV['HOMEBREW_CXX'] then
+ cxx_compiler = ENV['HOMEBREW_CXX']
+ else
+ cxx_compiler = "clang"
+ end
attributes = {
"used_options" => used_options.as_flags,
"unused_options" => unused_options.as_flags,
@@ -192,6 +202,8 @@ class Tab < OpenStruct
"stdlib" => (stdlib.to_s if stdlib),
"compiler" => (compiler.to_s if compiler),
"source" => source,
+ "cc_compiler" => cc_compiler,
+ "cxx_compiler" => cxx_compiler
}
Utils::JSON.dump(attributes)