Source: yajl
Version: 2.0.4-2
Severity: wishlist
Tags: patch

Dear Maintainer,

I had need of an arm64 libyajl package to do a multiarch cross compile, which
meant that I needed to cross-build the yajl package. With Wookey's help I came
up with the attached patch which does two simple things:

- When cross compiling it uses the dpkg-cross supplied cmake toolchain file
  which DTRT when cross compiling.
- Adds support for DEB_BUILD_OPTIONS=nocheck which disables the build time
  test, which cannot run when crossing.

Thanks,
Ian.

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From 02d4bdd11f5bf9daee970c3a010b22e352fdba24 Mon Sep 17 00:00:00 2001
From: Ian Campbell <i...@hellion.org.uk>
Date: Tue, 5 Mar 2013 16:06:42 +0000
Subject: [PATCH] Support for cross compiling

---
 debian/changelog |    8 ++++++++
 debian/rules     |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 86e5ca3..8416590 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+yajl (2.0.4-3) UNRELEASED; urgency=low
+
+  * Support for cross-compilation (Closes: #xxxxxx)
+    - Use CMakeCross toolchain file when cross compiling
+    - Support nocheck build option to disable tests
+
+ -- Ian Campbell <i...@hellion.org.uk>  Tue, 05 Mar 2013 15:49:53 +0000
+
 yajl (2.0.4-2) unstable; urgency=low
 
   * Upload to unstable.
diff --git a/debian/rules b/debian/rules
index c17818f..585ae71 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,6 +16,10 @@ export DH_OPTIONS
 DPKG_EXPORT_BUILDFLAGS := 1
 include /usr/share/dpkg/buildflags.mk
 
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+CROSS_CONFIG := -DCMAKE_TOOLCHAIN_FILE="/etc/dpkg-cross/cmake/CMakeCross.txt"
+endif
+
 configure: config-stamp
 config-stamp:
 	dh_testdir
@@ -24,7 +28,7 @@ config-stamp:
 		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
 		-DCMAKE_SKIP_RPATH=ON \
 		-DMULTIARCH_TUPLE=`dpkg-architecture -qDEB_HOST_MULTIARCH` \
-		-DCMAKE_VERBOSE_MAKEFILE=ON
+		-DCMAKE_VERBOSE_MAKEFILE=ON $(CROSS_CONFIG)
 	touch $@
 
 #Architecture
@@ -35,7 +39,9 @@ build-arch-stamp:  configure
 
 	# Add here commands to compile the arch part of the package.
 	$(MAKE) -C build
+ifeq (,$(filter $(DEB_BUILD_OPTIONS), nocheck))
 	cd test && ./run_tests.sh
+endif
 	touch $@
 
 build-indep: build-indep-stamp
-- 
1.7.10.4

Reply via email to