[PATCH 3/4] Automatically determine GCC_VERSION and dep:devlibs based on g++ package version.

Jon Severinsson jon at severinsson.net
Sat Aug 31 07:30:55 UTC 2013


To build with a specific gcc version instead of the system default, set
GCC_VERSION := X.Y at the top of make/rules and add gcc-X.Y and g++-X.Y
to Build-Depends in debian/control.
---
 debian/changelog |    1 +
 debian/rules     |   27 +++++++++------------------
 2 filer ändrade, 10 tillägg(+), 18 borttagningar(-)

diff --git a/debian/changelog b/debian/changelog
index a8760f2e..517299c1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ llvm-toolchain-3.3 (1:3.3-9) UNRELEASED; urgency=low
   [ Jon Severinsson ]
   * Merge from llvm-toolchain-3.2 branch up to 3.2repack-11.
   * Drop auto-generated file debian/libllvm3.3.install.
+  * Automatically determine GCC_VERSION and dep:devlibs based on g++ package version.
 
  -- Sylvestre Ledru <sylvestre at debian.org>  Mon, 26 Aug 2013 14:48:42 +0200
 
diff --git a/debian/rules b/debian/rules
index 8726371d..8eb1a153 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 TARGET_BUILD	:= build-llvm
-GCC_VERSION     := 4.7
+GCC_VERSION     := $(shell dpkg-query -W -f '$${Version}' g++ | sed -rne 's,^([0-9]+:)?([0-9]+\.[0-9]+).*$$,\2,p')
 LLVM_VERSION	:= 3.3
 SONAME_EXT      := 1
 DEBIAN_REVISION := $(shell dpkg-parsechangelog | sed -rne 's,^Version: .*-(.*),\1,p')
@@ -24,6 +24,9 @@ ifeq ($(distrel),n/a)
   distrel := sid
 endif
 
+export CC=gcc-$(GCC_VERSION)
+export CXX=g++-$(GCC_VERSION)
+
 LDFLAGS_EXTRA=
 CXXFLAGS_EXTRA=
 
@@ -44,24 +47,12 @@ ifneq (,$(findstring $(DEB_HOST_ARCH),armel))
   opt_flags += -marm
 endif
 
-ifeq ($(distribution),Ubuntu)
-	ifeq ($(distrel),precise)
-		control_vars = '-Vdep:devlibs=libstdc++6-4.6-dev'
-	endif
-	ifeq ($(distrel),quantal)
-		control_vars = '-Vdep:devlibs=libstdc++6-4.7-dev'
-	endif
-	ifeq ($(distrel),raring)
-		control_vars = '-Vdep:devlibs=libstdc++6-4.7-dev, libgcc-4.7-dev, libobjc-4.7-dev'
-	endif
-
+ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' g++-$(GCC_VERSION)) ge 4.8-20121128-1~ ; echo $$?),0)
+	control_vars = '-Vdep:devlibs=libstdc++-$(GCC_VERSION)-dev, libgcc-$(GCC_VERSION)-dev, libobjc-$(GCC_VERSION)-dev'
+else ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' g++-$(GCC_VERSION)) ge 4.7.2-10~ ; echo $$?),0)
+	control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev, libgcc-$(GCC_VERSION)-dev, libobjc-$(GCC_VERSION)-dev'
 else
-    ifeq ($(distrel),wheezy)
-        control_vars = '-Vdep:devlibs=libstdc++6-4.7-dev'
-	else
-		# Debian experimental
-		control_vars = '-Vdep:devlibs=libstdc++6-4.7-dev, libgcc-4.7-dev, libobjc-4.7-dev'
-	endif
+	control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev'
 endif
 
 BINUTILS_GOLD_ARCHS := amd64 armhf i386 powerpc powerpcspe ppc64 sparc sparc64 x32
-- 
1.7.10.4




More information about the Pkg-llvm-team mailing list