Package: qemu
Followup-For: Bug #384338

the attached patch should at least provide a proof of concept for how to build
static variants of the userspace emulators in the qemu package, if a bit crude.

essentially, it copies the source directory to a subdir of debian, runs
configure with different options, and then copies the binaries as appropriate
into the package dir.

i only built a static variant for qemu-arm as i know that version is likely to
work for cross-architecture chrooting, but the concept should work for other
variants as well.

live well,
  vagrant
diff --git a/debian/changelog b/debian/changelog
index 96c91ba..1cd7b13 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+qemu (0.10.50+git20090729-1.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * create static binary for qemu-arm-static to allow for static chroots.
+    requires setting up a second configure run, and building the binaries in
+    that directory. should at least partially address debian bug #384338, if
+    only as a proof of concept.
+
+ -- Vagrant Cascadian <vagr...@freegeek.org>  Sun, 13 Sep 2009 14:07:33 -0700
+
 qemu (0.10.50+git20090729-1) experimental; urgency=low
 
   [ Josh Triplett ]
diff --git a/debian/control b/debian/control
index d78ab74..ebc7110 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,8 @@ Build-Depends: debhelper (>= 5), quilt (>= 0.40), nasm, device-tree-compiler,
  libfreebsd-dev [kfreebsd-i386 kfreebsd-amd64],
  libasound2-dev [!kfreebsd-i386 !kfreebsd-amd64],
  libbluetooth-dev [!kfreebsd-i386 !kfreebsd-amd64],
- libgpmg1-dev [amd64 arm armel hppa i386 powerpc sparc ppc64]
+ libgpmg1-dev [amd64 arm armel hppa i386 powerpc sparc ppc64],
+ rsync
 Standards-Version: 3.8.1
 Homepage: http://www.qemu.org/
 Vcs-Browser: http://git.debian.org/?p=users/riku/qemu.git
diff --git a/debian/rules b/debian/rules
index b755a27..4abf454 100755
--- a/debian/rules
+++ b/debian/rules
@@ -48,6 +48,16 @@ config-host.mak: configure
 		--disable-strip \
 		$(conf_arch)
 
+	rsync --exclude=debian -aWR . debian/static-build
+
+	cd debian/static-build ; CFLAGS="$(CFLAGS)" ./configure \
+		--prefix=/usr \
+		--disable-blobs \
+		--disable-strip \
+		--static \
+		--target-list="arm-linux-user" \
+		$(conf_arch)
+
 setup-source: patch
 	$(MAKE) -f debian/rules config-host.mak
 
@@ -55,6 +65,7 @@ build: setup-source
 	dh_testdir
 	
 	$(MAKE) $(NJOBS)
+	$(MAKE) -C debian/static-build $(NJOBS)
 	$(MAKE) -C pc-bios bamboo.dtb
 	$(MAKE) -C pc-bios mpc8544ds.dtb
 
@@ -66,6 +77,7 @@ clean: unpatch
 	
 	rm -f $(qemu_docs)
 	rm -f pc-bios/*.dtb
+	rm -rf debian/static-build
 	
 	dh_clean
 
@@ -88,6 +100,9 @@ install: build
 	  cp $(CURDIR)/$$target/libqemu.a $(CURDIR)/debian/libqemu-dev/usr/lib/qemu/$$target/ ; \
 	  cp $(CURDIR)/$$target/*.h $(CURDIR)/debian/libqemu-dev/usr/include/qemu/$$target/ ; \
 	done
+
+	# static builds
+	cp $(CURDIR)/debian/static-build/arm-linux-user/qemu-arm $(CURDIR)/debian/qemu/usr/bin/qemu-arm-static
 	
 binary-indep:
 # Nothing to do.

Reply via email to