From d4f852c21776f407885b7ea21d287df7cdb03e44 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 22 Jun 2014 16:05:05 +0000 Subject: [PATCH] Fix --use-cc when no absolute path is provided (Closes: #748777) --- debian/changelog | 1 + debian/patches/scan-build-search-path.diff | 39 ++++++++++++++++++++++ debian/patches/series | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 debian/patches/scan-build-search-path.diff diff --git a/debian/changelog b/debian/changelog index c16b6d83..e56ce549 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ llvm-toolchain-3.4 (1:3.4.2-3) unstable; urgency=medium (Closes: #751943) * Fix FTBFS on powerpc and powerpcspe (Closes: #733890) * Broken library symlink fixed in lldb-3.4 (Closes: #715130) + * Fix --use-cc when no absolute path is provided (Closes: #748777) -- Sylvestre Ledru Thu, 19 Jun 2014 19:13:16 +0200 diff --git a/debian/patches/scan-build-search-path.diff b/debian/patches/scan-build-search-path.diff new file mode 100644 index 00000000..53b01ca4 --- /dev/null +++ b/debian/patches/scan-build-search-path.diff @@ -0,0 +1,39 @@ +Index: llvm-toolchain-3.4-3.4.2/clang/tools/scan-build/ccc-analyzer +=================================================================== +--- llvm-toolchain-3.4-3.4.2.orig/clang/tools/scan-build/ccc-analyzer 2014-06-22 08:51:25.452950214 -0700 ++++ llvm-toolchain-3.4-3.4.2/clang/tools/scan-build/ccc-analyzer 2014-06-22 08:52:17.602331808 -0700 +@@ -25,6 +25,17 @@ + # Compiler command setup. + ##===----------------------------------------------------------------------===## + ++# Search in the PATH if the compiler exists ++sub SearchInPath { ++ my $file = shift; ++ foreach my $dir (split (':', $ENV{PATH})) { ++ if (-x "$dir/$file") { ++ return 1; ++ } ++ } ++ return 0; ++} ++ + my $Compiler; + my $Clang; + my $DefaultCCompiler; +@@ -40,14 +51,14 @@ + + if ($FindBin::Script =~ /c\+\+-analyzer/) { + $Compiler = $ENV{'CCC_CXX'}; +- if (!defined $Compiler || ! -x $Compiler) { $Compiler = $DefaultCXXCompiler; } ++ if (!defined $Compiler || ! -x $Compiler || ! SearchInPath($Compiler)) { $Compiler = $DefaultCXXCompiler; } + + $Clang = $ENV{'CLANG_CXX'}; + if (!defined $Clang || ! -x $Clang) { $Clang = 'clang++'; } + } + else { + $Compiler = $ENV{'CCC_CC'}; +- if (!defined $Compiler || ! -x $Compiler) { $Compiler = $DefaultCCompiler; } ++ if (!defined $Compiler || ! -x $Compiler && ! SearchInPath($Compiler)) { $Compiler = $DefaultCCompiler; } + + $Clang = $ENV{'CLANG'}; + if (!defined $Clang || ! -x $Clang) { $Clang = 'clang'; } diff --git a/debian/patches/series b/debian/patches/series index 3c39437c..951df61f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -41,3 +41,5 @@ compiler-rt-path.diff lldb-soname.diff CVE-2014-2893.diff follow-parallel-var.diff +scan-build-search-path.diff +