This will work from clang 3.4.1 (currently in unstable).

clang 3.3 is not installed as clang-3.3 (and will be removed from Jessie).

0001-Manage-the-different-version-of-clang-X.Y.patch handles this case
without breaking the compatibility.


0002-Indent-correctly-the-code.patch improves the indentation of the
switch/case. Thanks

Sylvestre
>From aae7595cae00990a6308962a3c47d26db98f7c53 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <[email protected]>
Date: Thu, 15 May 2014 18:48:37 +0200
Subject: [PATCH 1/2] Manage the different version of clang-X.Y

---
 examples/D65various-compiler-support | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/examples/D65various-compiler-support b/examples/D65various-compiler-support
index e65d70f..bc86ccd 100644
--- a/examples/D65various-compiler-support
+++ b/examples/D65various-compiler-support
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # pbuilder hook script: choose optional compiler rather than default one
-#  
+#
 # Sometimes we want to choose other compiler than default, because of improving
 # code to conform to standard, check compiler quality or so. This script will
 # ease it. Try enable hook script and set "CHOOSE_COMPILER" variables as clang,
@@ -18,8 +18,14 @@ set -e
 # check whether we are asked to change the compiler.
 case "${CHOOSE_COMPILER}" in
     clang)
-	newcc=/usr/bin/"${CHOOSE_COMPILER}"
-	newcxx=/usr/bin/"${CHOOSE_COMPILER}"++
+        newcc=/usr/bin/"${CHOOSE_COMPILER}"
+        newcxx=/usr/bin/"${CHOOSE_COMPILER}"++
+        ;;
+    clang-*)
+        use_clang_version=$(echo ${CHOOSE_COMPILER} | sed -e s/clang-//)
+	    clang_package=clang-"${use_clang_version}"
+	    newcc=/usr/bin/clang-"${use_clang_version}"
+	    newcxx=/usr/bin/clang++-"${use_clang_version}"
   	;;
     gcc-*)
         use_gcc_version=$(echo ${CHOOSE_COMPILER} | sed -e s/gcc-//)
@@ -42,7 +48,7 @@ case "${CHOOSE_COMPILER}" in
 	;;
 esac
 
-apt-get -y install "${CHOOSE_COMPILER}" ${gxx_package}
+apt-get -y install "${CHOOSE_COMPILER}" ${gxx_package} ${clang_package}
 
 if [ ! -x /usr/bin/"${CHOOSE_COMPILER}" ]; then
     echo >&2 "E: Package ${CHOOSE_COMPILER} does not contain compiler driver?"
-- 
2.0.0.rc0

>From 641c093666e15bffe67afc8d2814ba9a0e60b725 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <[email protected]>
Date: Thu, 15 May 2014 18:48:55 +0200
Subject: [PATCH 2/2] Indent correctly the code

---
 examples/D65various-compiler-support | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/examples/D65various-compiler-support b/examples/D65various-compiler-support
index bc86ccd..13eaac0 100644
--- a/examples/D65various-compiler-support
+++ b/examples/D65various-compiler-support
@@ -26,26 +26,26 @@ case "${CHOOSE_COMPILER}" in
 	    clang_package=clang-"${use_clang_version}"
 	    newcc=/usr/bin/clang-"${use_clang_version}"
 	    newcxx=/usr/bin/clang++-"${use_clang_version}"
-  	;;
+  	    ;;
     gcc-*)
         use_gcc_version=$(echo ${CHOOSE_COMPILER} | sed -e s/gcc-//)
-	gxx_package=g++-"${use_gcc_version}"
-	newcc=/usr/bin/"${CHOOSE_COMPILER}"
-	newcxx=/usr/bin/g++-"${use_gcc_version}"
-	;;
+	    gxx_package=g++-"${use_gcc_version}"
+	    newcc=/usr/bin/"${CHOOSE_COMPILER}"
+	    newcxx=/usr/bin/g++-"${use_gcc_version}"
+	    ;;
     tcc)
-	newcc=/usr/bin/"${CHOOSE_COMPILER}"
-	newcxx=/bin/false
-	not_gcc_compat=1
-	;;
+	    newcc=/usr/bin/"${CHOOSE_COMPILER}"
+	    newcxx=/bin/false
+	    not_gcc_compat=1
+	    ;;
     pcc)
-	newcc=/usr/bin/"${CHOOSE_COMPILER}"
-	newcxx=/bin/false
-	not_gcc_compat=1
-	;;
+	    newcc=/usr/bin/"${CHOOSE_COMPILER}"
+	    newcxx=/bin/false
+	    not_gcc_compat=1
+	    ;;
     *)
-	exit 0
-	;;
+	    exit 0
+	    ;;
 esac
 
 apt-get -y install "${CHOOSE_COMPILER}" ${gxx_package} ${clang_package}
-- 
2.0.0.rc0

Reply via email to