From db86f0de82cf92f888eb048b1b92e67dead335b4 Mon Sep 17 00:00:00 2001
From: Jan-Pascal van Best <janpascal@vanbest.org>
Date: Wed, 27 Mar 2013 13:22:16 +0100
Subject: [PATCH] Fix for building for a kernel that is not currently running

---
 debian/rules      | 8 +++++---
 debian/rules.defs | 1 -
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/rules b/debian/rules
index a7c7324..1323f4c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,10 +38,12 @@ build_sasc_%:
 	VERSION="$*"; \
 	FLAVOR=$${VERSION#*_}; \
 	KERNEL=$${VERSION/_$$FLAVOR/}; \
-	sed -e "s|#DVB_DIR#|$(CURDIR)/debian/tmp/include/$$KERNEL/|" < debian/config.mak-$$FLAVOR > contrib/sasc-ng/config.mak; \
-	echo "Building $$VERSION - $$FLAVOR"; \
+	BUILD_DIR=/lib/modules/$${KERNEL}/build; \
+	sed -e "s|#DVB_DIR#|$(CURDIR)/debian/tmp/include/$$KERNEL/|" \
+            < debian/config.mak-$$FLAVOR > contrib/sasc-ng/config.mak; \
+	echo "Building sasc-ng $$VERSION - $$FLAVOR"; \
 	cd contrib/sasc-ng; \
-	make module CC=gcc-4.6 CXX=g++-4.6; \
+	make module CC=gcc-4.6 CXX=g++-4.6 BUILD_DIR=$${BUILD_DIR}; \
 	make CC=gcc-4.6 CXX=g++-4.6; \
 	mkdir -p $(CURDIR)/debian/tmp/$$KERNEL-$$FLAVOR/bin; \
 	mkdir -p $(CURDIR)/debian/tmp/$$KERNEL-$$FLAVOR/modules; \
diff --git a/debian/rules.defs b/debian/rules.defs
index 222581a..f54e15f 100644
--- a/debian/rules.defs
+++ b/debian/rules.defs
@@ -1,6 +1,5 @@
 KERNELS = 3.8-trunk-amd64
 KERNEL_VERSION_3.8-trunk-amd64 = 3.8.3-1~experimental.1
-
 FFDECSA_FLAVORS = core2 athlon64 atom corei5
 
 # For the moment we just support amd64
-- 
2.39.5