homebrew - Is there a way I can find what HOMEBREW_CC/XX was set to when I installed a package -
some of i'm doing compiler dependent. possible check if, example, boost
formula installed gcc-4.9 or clang compiler?
what i'm looking might this:
$ echo homebrew_cc $ brew install boost $ <comand> built clang $ brew uninstall --force boost $ export homebrew_cc = gcc-4.9 ; export homebrew_cxx = g++-4.9 $ brew install boost $ <command> built gcc-4.9
the compiler listed in receipt
$ 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"}}~
..although hacked solution
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'] + cc_compiler = env['homebrew_cc'] + else + cc_compiler = "clang" + end + if env['homebrew_cxx'] + 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)
Comments
Post a Comment