On Tue, Sep 15, 2009 at 04:00:00PM +0200, Aurelien Jarno wrote:
> On Mon, Sep 14, 2009 at 10:23:32AM -0700, Vagrant Cascadian wrote:
> > attached is an updated patch which builds a static version of all variants, 
> > at
> > least on linux.
> 
> I have looked quickly at the patch, I am not sure we need to copy the
> sources. AFAIK, qemu support out of tree building, so we can do:
> 
>       mkdir build-static
>       cd build-static && ../configure --options
>       $(MAKE) -C debian/static-build
> 
> The same can be done for the main build, which also simplify the clean target.
> 
> Also given static binaries are huge, I do wonder if we shouldn't put the
> static version in a separate package. This is maybe the time to rework a
> bit the packaging. Maybe something like the following:
> - qemu-user: all dynamically linked qemu-user binaries
> - qemu-user-static: all statically linked qemu-user binaries
> - qemu-system: all qemu-system binaries
> - qemu: meta package depending on qemu-system, qemu-user and maybe
>   qemu-user-static (Recommends:? Suggests: ?).

attached is a patch against qemu from experimental for an updated debian/rules
to build qemu-user, qemu-user-static and qemu-system, using out of tree builds.

it's still got some rough edges.

to get the pc-bios working, it still required a ordinary ./configure run; i
couldn't figure out how to get it to work with the out-of-tree builds.

it also manually installs the qemu-user binaries, instead of using "make
install", which installed keymap and other files also present in the
qemu-system package. i'm thinking those are only needed for the qemu-system
package anyways.

i'm not sure which of the packages should install the libqemu.a file(s), or
other .a files. some have the same filenames.

seems to work, though. :)

live well,
  vagrant
diff --git a/debian/rules b/debian/rules
index b755a27..d8f71bd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -42,19 +42,55 @@ qemu_docs = \
 config-host.mak: configure
 	dh_testdir
 	
+	# pc-bios targets
 	CFLAGS="$(CFLAGS)" ./configure \
 		--prefix=/usr \
 		--disable-blobs \
 		--disable-strip \
 		$(conf_arch)
 
+	# qemu-system
+	mkdir -p debian/system-build
+	
+	cd debian/system-build ; CFLAGS="$(CFLAGS)" ../../configure \
+		--prefix=/usr \
+		--disable-blobs \
+		--disable-strip \
+		--disable-linux-user \
+		--disable-bsd-user \
+		--disable-darwin-user \
+		$(conf_arch)
+
+	# qemu-user
+	mkdir -p debian/user-build
+
+	cd debian/user-build ; CFLAGS="$(CFLAGS)" ../../configure \
+		--prefix=/usr \
+		--disable-blobs \
+		--disable-strip \
+		--disable-system \
+		$(conf_arch)
+
+	mkdir -p debian/user-static-build
+
+	# qemu-user-static
+	cd debian/user-static-build ; CFLAGS="$(CFLAGS)" ../../configure \
+		--prefix=/usr \
+		--disable-blobs \
+		--disable-strip \
+		--disable-system \
+		--static \
+		$(conf_arch)
+
 setup-source: patch
 	$(MAKE) -f debian/rules config-host.mak
 
 build: setup-source
 	dh_testdir
 	
-	$(MAKE) $(NJOBS)
+	$(MAKE) -C debian/system-build $(NJOBS)
+	$(MAKE) -C debian/user-build $(NJOBS)
+	$(MAKE) -C debian/user-static-build $(NJOBS)
 	$(MAKE) -C pc-bios bamboo.dtb
 	$(MAKE) -C pc-bios mpc8544ds.dtb
 
@@ -66,6 +102,7 @@ clean: unpatch
 	
 	rm -f $(qemu_docs)
 	rm -f pc-bios/*.dtb
+	rm -rf debian/*-build
 	
 	dh_clean
 
@@ -75,18 +112,30 @@ install: build
 	dh_clean -k
 	dh_installdirs -a
 	
-	$(MAKE) DESTDIR=$(CURDIR)/debian/qemu install
+	$(MAKE) -C debian/system-build DESTDIR=$(CURDIR)/debian/qemu-system install
+
+	zcat /usr/share/etherboot/e1000-82540em.zrom.gz > $(CURDIR)/debian/qemu-system/usr/share/qemu/pxe-e1000.bin
+	zcat /usr/share/etherboot/rtl8029.zrom.gz       > $(CURDIR)/debian/qemu-system/usr/share/qemu/pxe-ne2k_pci.bin
+	zcat /usr/share/etherboot/pcnet32.zrom.gz       > $(CURDIR)/debian/qemu-system/usr/share/qemu/pxe-pcnet.bin
+	zcat /usr/share/etherboot/rtl8139.zrom.gz       > $(CURDIR)/debian/qemu-system/usr/share/qemu/pxe-rtl8139.bin
 
-	zcat /usr/share/etherboot/e1000-82540em.zrom.gz > $(CURDIR)/debian/qemu/usr/share/qemu/pxe-e1000.bin
-	zcat /usr/share/etherboot/rtl8029.zrom.gz       > $(CURDIR)/debian/qemu/usr/share/qemu/pxe-ne2k_pci.bin
-	zcat /usr/share/etherboot/pcnet32.zrom.gz       > $(CURDIR)/debian/qemu/usr/share/qemu/pxe-pcnet.bin
-	zcat /usr/share/etherboot/rtl8139.zrom.gz       > $(CURDIR)/debian/qemu/usr/share/qemu/pxe-rtl8139.bin
+	cp $(CURDIR)/pc-bios/*.dtb $(CURDIR)/debian/qemu-system/usr/share/qemu/
 
-	cp $(CURDIR)/pc-bios/bamboo.dtb $(CURDIR)/pc-bios/mpc8544ds.dtb $(CURDIR)/debian/qemu/usr/share/qemu/
+	for target in debian/system-build/*softmmu ; do \
+	  cp $(CURDIR)/$$target/libqemu.a $(CURDIR)/debian/libqemu-dev/usr/lib/qemu/`basename $$target`/ ; \
+	  cp $(CURDIR)/$$target/*.h $(CURDIR)/debian/libqemu-dev/usr/include/qemu/`basename $$target`/ ; \
+	done
+
+	# install qemu-user binaries
+	mkdir -p $(CURDIR)/debian/qemu-user/usr/bin/
+	for target in debian/user-build/*-*-user/qemu-* ; do \
+		cp $(CURDIR)/$$target $(CURDIR)/debian/qemu-user/usr/bin/ ; \
+	done
 
-	for target in *softmmu ; do \
-	  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/ ; \
+	# install statically built qemu-user binaries
+	mkdir -p $(CURDIR)/debian/qemu-user-static/usr/bin/
+	for target in debian/user-static-build/*-*-user/qemu-* ; do \
+		cp $(CURDIR)/$$target $(CURDIR)/debian/qemu-user-static/usr/bin/`basename $$target`-static ; \
 	done
 	
 binary-indep:
@@ -107,7 +156,7 @@ binary-arch: install
 	dh_strip -a
 	dh_compress -a
 	dh_fixperms -a
-	chmod a+x $(CURDIR)/debian/qemu/etc/qemu-ifup
+	chmod a+x $(CURDIR)/debian/qemu-system/etc/qemu-ifup
 	dh_installdeb -a
 	dh_shlibdeps -a
 	dh_gencontrol -a

Reply via email to