On Wed, Sep 16, 2009 at 02:11:21AM -0700, Vagrant Cascadian wrote:
> 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.

and another update to debian/rules... dare i say, this patch might be ready.

it does use some debhelper 7 features to keep some targets brief, although i
don't think it changes the rules much. if desired, i can revert those changes
if needed and do it the old fashioned way.

> 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.

figured out a way to do this, by copying a few files around. i think this is
due to using configure's --disable-blobs (since most are not distributable in
debian).
 
> 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.

switched to using "make install" and just removing the keymaps before the
package is built.
 
> i'm not sure which of the packages should install the libqemu.a file(s), or
> other .a files. some have the same filenames.

still clueless on this.

live well,
  vagrant
diff --git a/debian/rules b/debian/rules
index b755a27..484f566 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,7 +18,6 @@ DEB_HOST_ARCH_CPU = $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
 
 ifeq ($(DEB_HOST_ARCH_OS),linux)
        conf_arch += --audio-drv-list=oss,alsa,sdl,esd,pa
-       target_linux_list += $(TARGET_LINUX_TCG)
 endif
 ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
        conf_arch += --audio-drv-list=oss,sdl,esd,pa
@@ -33,19 +32,48 @@ endif
 
 include /usr/share/quilt/quilt.make
 
-qemu_docs = \
-	qemu-doc.html \
-	qemu-tech.html \
-	qemu.1 \
-	qemu-img.1
-
 config-host.mak: configure
 	dh_testdir
 	
-	CFLAGS="$(CFLAGS)" ./configure \
+	# 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)
+
+	# since we don't use the blobs feature, remove the '*.dtb' file (a broken
+	# symlink) and manually copy in Makefile and *.dts, needed to build the few
+	# parts of pc-bios used. 
+	rm debian/system-build/pc-bios/*.dtb         
+	cp pc-bios/Makefile pc-bios/*.dts debian/system-build/pc-bios/
+
+	# qemu-user
+	mkdir -p debian/user-build
+
+	cd debian/user-build ; CFLAGS="$(CFLAGS)" ../../configure \
+		--prefix=/usr \
+		--disable-blobs \
+		--disable-strip \
+		--disable-system \
+		--disable-docs \
+		$(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 \
+		--disable-docs \
+		--static \
 		$(conf_arch)
 
 setup-source: patch
@@ -54,65 +82,72 @@ setup-source: patch
 build: setup-source
 	dh_testdir
 	
-	$(MAKE) $(NJOBS)
-	$(MAKE) -C pc-bios bamboo.dtb
-	$(MAKE) -C pc-bios mpc8544ds.dtb
+	$(MAKE) -C debian/system-build $(NJOBS)
+	$(MAKE) -C debian/user-build $(NJOBS)
+	$(MAKE) -C debian/user-static-build $(NJOBS)
+	$(MAKE) -C debian/system-build/pc-bios bamboo.dtb
+	$(MAKE) -C debian/system-build/pc-bios mpc8544ds.dtb
 
 clean: unpatch
 	dh_testdir
 	dh_testroot
 	
-	[ ! -f config-host.mak ] || $(MAKE) distclean
-	
-	rm -f $(qemu_docs)
-	rm -f pc-bios/*.dtb
+	rm -rf debian/*-build
 	
 	dh_clean
 
 install: build
 	dh_testdir
 	dh_testroot
-	dh_clean -k
+	dh_prep -a
 	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
+
+	cp $(CURDIR)/debian/system-build/pc-bios/*.dtb $(CURDIR)/debian/qemu-system/usr/share/qemu/
 
-	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
+	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
+	$(MAKE) -C debian/user-build DESTDIR=$(CURDIR)/debian/qemu-user install
 
-	cp $(CURDIR)/pc-bios/bamboo.dtb $(CURDIR)/pc-bios/mpc8544ds.dtb $(CURDIR)/debian/qemu/usr/share/qemu/
+	# install statically built qemu-user binaries
+	$(MAKE) -C debian/user-static-build DESTDIR=$(CURDIR)/debian/qemu-user-static install
 
-	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/ ; \
+	# rename the qemu-user-static binaries
+	for target in debian/qemu-user-static/usr/bin/qemu-*  ; do \
+		mv $(CURDIR)/$$target $(CURDIR)/$$target-static ; \
 	done
+
+	mkdir -p $(CURDIR)/debian/qemu-user-static/usr/share/man/man1/
+	cp debian/qemu-user.1 $(CURDIR)/debian/qemu-user-static/usr/share/man/man1/qemu-user-static.1
 	
+	# remove files that are not needed for qemu-user or qemu-user-static binary
+	# packages
+	rm -rf $(CURDIR)/debian/qemu-user*/usr/share/qemu/keymaps/
+	 
 binary-indep:
-# Nothing to do.
+	dh_testdir -i                                
+	dh_testroot -i                               
+	dh_prep -i
+	dh_installdirs -i
+	dh binary-indep --after dh_auto_install
 
 binary-arch: install
-	dh_testdir
-	dh_testroot
-	dh_install -a
-	dh_installdebconf -a
-	dh_installdocs -a
-	dh_installexamples -a
-	dh_installlogrotate -a
-	dh_installman -a
-	dh_installinfo -a
-	dh_installchangelogs -a Changelog
-	dh_link -a
-	dh_strip -a
-	dh_compress -a
-	dh_fixperms -a
-	chmod a+x $(CURDIR)/debian/qemu/etc/qemu-ifup
-	dh_installdeb -a
-	dh_shlibdeps -a
-	dh_gencontrol -a
-	dh_md5sums -a
-	dh_builddeb -a
+	dh_testdir -a
+	dh_testroot -a
+	dh_installdirs -a
+	dh binary-arch --after dh_auto_install --until dh_fixperms
+	chmod a+x $(CURDIR)/debian/qemu-system/etc/qemu-ifup
+	dh binary-arch --after dh_fixperms
 
 binary: binary-indep binary-arch
 

Reply via email to