From 304e4fc2f7ea0896798567e5c9429022a4fb914f Mon Sep 17 00:00:00 2001 From: nibbles 2bits Date: Thu, 12 Apr 2012 19:26:29 -0700 Subject: jscoverage: fix configure errors with clang jscoverage-0.5.1 has a file with hardcoded gcc and g++, named configure.gnu. inreplace those with ENV.cc and ENV.cxx. It also has three places in js/configure where the conftest uses int main { but also has two return commands. The first return command, return; does not return a value. The second one does `return 0;`. This causes an error building with clang during configure because `int main` should return a value. inline patch those by removing the extra return command so that it does a `return 0;` All four of these issues have been bug reported to their tracker, and the formula comments include a link to the bug report. The issues exist in HEAD. This now builds with all the compilers in Lion and Snow Leopard, though no runtime tests were done as this is unfamiliar software. Fixes #11600. Closes #11611. Signed-off-by: Jack Nagel --- Library/Formula/jscoverage.rb | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'Library/Formula') diff --git a/Library/Formula/jscoverage.rb b/Library/Formula/jscoverage.rb index c1933737e..d810fe679 100644 --- a/Library/Formula/jscoverage.rb +++ b/Library/Formula/jscoverage.rb @@ -5,7 +5,22 @@ class Jscoverage < Formula homepage 'http://siliconforks.com/jscoverage/' md5 'a70d79a6759367fbcc0bcc18d6866ff3' + def patches + # Fixes compile errors with clang, int main should return a value + # Reported upstream: http://siliconforks.com/jscoverage/bugs/42 + DATA + end + def install + # Fix a hardcoded gcc and g++ configure error when clang. + # Reported upstream: http://siliconforks.com/jscoverage/bugs/42 + inreplace 'js/configure.gnu' do |f| + f.gsub! 'export CC=gcc', "export CC=#{ENV.cc}" + f.gsub! 'export CXX=g++', "export CXX=#{ENV.cxx}" + f.gsub! 'gcc -E', "#{ENV.cc} -E" + f.gsub! 'g++ -E', "#{ENV.cxx} -E" + end + system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make" @@ -13,3 +28,31 @@ class Jscoverage < Formula bin.install('jscoverage-server'); end end + +__END__ +--- a/js/configure 2010-09-23 05:00:00.000000000 -0700 ++++ b/js/configure 2012-04-12 16:54:46.000000000 -0700 +@@ -7820,7 +7820,6 @@ + int main() { + + int a[sizeof (void*) == $size ? 1 : -1]; +- return; + + ; return 0; } + EOF +@@ -7878,7 +7877,6 @@ + int main() { + + int a[offsetof(struct aligner, a) == $align ? 1 : -1]; +- return; + + ; return 0; } + EOF +@@ -7919,7 +7917,6 @@ + int main() { + + int a[sizeof (double) == $size ? 1 : -1]; +- return; + + ; return 0; } + EOF -- cgit v1.2.3