Package: qemu
Version: 0.8.0-2
Severity: normal
Tags: patch

New (and more robust IMHO) approach: it builds qemu in a subdir so the
source tree remains intact. This should protect from future problems
of this kind. And also it has a benefit: it makes building a static
package a lot easier (just run the rules with e.g.
build_dir=qemu-build-static and set the proper static flags to
configure).

Note that this patch supersedes the one sent previously and assumes
that #356284 is applied first, otherwise this patch does not apply
cleanly.

Changelog:

  * Add support for compiling outside the source tree.
    - debian/patches/64_build_outside_tree.patch: New file.
    - Modified debian/rules to compile in a sub-directory.

--
Anderson Lizardo
Embedded Linux Lab - 10LE
Nokia Institute of Technology - INdT
Manaus - Brazil
Changelog:

  * Add support for compiling outside the source tree.
    - debian/patches/64_build_outside_tree.patch: New file.
    - Modified debian/rules to compile in a sub-directory.

Index: qemu-0.8.0/debian/rules
===================================================================
--- qemu-0.8.0.orig/debian/rules	2006-03-11 22:01:12.000000000 -0400
+++ qemu-0.8.0/debian/rules	2006-03-11 22:13:16.000000000 -0400
@@ -23,26 +23,30 @@ qemu_bios_files = \
 	ppc_rom.bin \
 	proll.elf
 
+build_dir = qemu-build
+
 include debian/patch.mk
 
-config-host.mak: configure
+$(build_dir)/config-host.mak: configure
 	dh_testdir
 	
-	CFLAGS="$(CFLAGS)" ./configure \
+	mkdir -p $(build_dir) && \
+	cd $(build_dir) && \
+	CFLAGS="$(CFLAGS)" ../configure \
 	  --prefix=/usr \
 	  --cc=$(CC)
 
-build: patch config-host.mak
+build: patch $(build_dir)/config-host.mak
 	dh_testdir
 	
+	cd $(build_dir) && \
 	$(MAKE)
 
 clean: unpatch
 	dh_testdir
 	dh_testroot
 	
-	-$(MAKE) clean
-	rm -f qemu-doc.html qemu.1 qemu-img.1 qemu-tech.html
+	rm -rf $(build_dir)
 	
 	dh_clean
 
@@ -53,11 +57,14 @@ install: build
 	dh_installdirs -a
 	
 	# Make qemu's "make install" happy
+	mkdir -p $(build_dir)/pc-bios
 	for i in $(qemu_bios_files); do \
-	  touch pc-bios/$$i; \
+	  touch $(build_dir)/pc-bios/$$i; \
 	done
 	
-	-$(MAKE) install \
+	cp -a pc-bios/linux_boot.bin $(build_dir)/pc-bios
+	cd $(build_dir) && \
+	$(MAKE) install \
 	  bindir=$(D)/usr/bin \
 	  datadir=$(D)/usr/share/qemu \
 	  mandir=$(D)/usr/share/man \
@@ -65,7 +72,7 @@ install: build
 	
 	# Clean up the mess
 	for i in $(qemu_bios_files); do \
-	  rm -f pc-bios/$$i $(D)/usr/share/qemu/$$i; \
+	  rm -f $(build_dir)/pc-bios/$$i $(D)/usr/share/qemu/$$i; \
 	done
 
 binary-indep:
Index: qemu-0.8.0/debian/patches/64_build_outside_tree.patch
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.0/debian/patches/64_build_outside_tree.patch	2006-03-11 22:01:26.000000000 -0400
@@ -0,0 +1,98 @@
+#DPATCHLEVEL=0
+Index: Makefile
+===================================================================
+RCS file: /sources/qemu/qemu/Makefile,v
+retrieving revision 1.93
+diff -u -r1.93 Makefile
+--- Makefile	11 Mar 2006 14:51:13 -0000	1.93
++++ Makefile	12 Mar 2006 00:40:06 -0000
+@@ -1,6 +1,6 @@
+ -include config-host.mak
+ 
+-CFLAGS=-Wall -O2 -g -fno-strict-aliasing 
++CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
+ ifdef CONFIG_DARWIN
+ CFLAGS+= -mdynamic-no-pic
+ endif
+@@ -18,10 +18,10 @@
+ 	$(MAKE) -C $$d $@ || exit 1 ; \
+         done
+ 
+-qemu-img$(EXESUF): qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c
++qemu-img$(EXESUF): $(addprefix $(SRC_PATH)/,qemu-img.c block.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c)
+ 	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
+ 
+-dyngen$(EXESUF): dyngen.c
++dyngen$(EXESUF): $(SRC_PATH)/dyngen.c
+ 	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
+ 
+ clean:
+@@ -58,7 +58,7 @@
+ 	mkdir -p "$(mandir)/man1"
+ 	install qemu.1 qemu-img.1 "$(mandir)/man1"
+ 	mkdir -p "$(datadir)/keymaps"
+-	install -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(datadir)/keymaps"
++	install -m 644 $(addprefix $(SRC_PATH)/keymaps/,$(KEYMAPS)) "$(datadir)/keymaps"
+ endif
+ 	for d in $(TARGET_DIRS); do \
+ 	$(MAKE) -C $$d $@ || exit 1 ; \
+@@ -77,15 +77,15 @@
+ 	cscope -b
+ 
+ # documentation
+-%.html: %.texi
++%.html: $(SRC_PATH)/%.texi
+ 	texi2html -monolithic -number $<
+ 
+-qemu.1: qemu-doc.texi
+-	./texi2pod.pl $< qemu.pod
++qemu.1: $(SRC_PATH)/qemu-doc.texi
++	$(SRC_PATH)/texi2pod.pl $< qemu.pod
+ 	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
+ 
+-qemu-img.1: qemu-img.texi
+-	./texi2pod.pl $< qemu-img.pod
++qemu-img.1: $(SRC_PATH)/qemu-img.texi
++	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
+ 	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
+ 
+ FILE=qemu-$(shell cat VERSION)
+Index: Makefile.target
+===================================================================
+RCS file: /sources/qemu/qemu/Makefile.target,v
+retrieving revision 1.93
+diff -u -r1.93 Makefile.target
+--- Makefile.target	6 Feb 2006 04:11:15 -0000	1.93
++++ Makefile.target	12 Mar 2006 00:40:11 -0000
+@@ -17,7 +17,7 @@
+ VPATH+=:$(SRC_PATH)/linux-user
+ DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
+ endif
+-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
++CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I..
+ #CFLAGS+=-Werror
+ LDFLAGS=-g
+ LIBS=
+Index: configure
+===================================================================
+RCS file: /sources/qemu/qemu/configure,v
+retrieving revision 1.84
+diff -u -r1.84 configure
+--- configure	11 Mar 2006 14:51:13 -0000	1.84
++++ configure	12 Mar 2006 00:40:16 -0000
+@@ -136,13 +136,10 @@
+ fi
+ 
+ # find source path
+-# XXX: we assume an absolute path is given when launching configure,
+-# except in './configure' case.
+ source_path=${0%configure}
+-source_path=${source_path%/}
++source_path=`cd $source_path; pwd`
+ source_path_used="yes"
+-if test -z "$source_path" -o "$source_path" = "." ; then
+-    source_path=`pwd`
++if [ "$source_path" = "`pwd`" ] ; then
+     source_path_used="no"
+ fi
+ 

Reply via email to