Subject: [PATCH] emulators/qemu and DragonFly
To: None <pkgsrc-users@netbsd.org>
From: Rumko <rumcic@gmail.com>
List: pkgsrc-users
Date: 12/29/2007 22:50:33
--nextPart16653566.fV4OKZ0n06
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8Bit

0.9.0 (the version currently in pkgsrc) does not compile on DragonFly without
additional patches, which are attached with this message. The two new patch
files are separate files (attached as patch-ab and patch-ad) that should be
put into patches/.

This patchset is based on the patches published by Patrick Georgi (the original
patches are at: http://openbios.org/~oxygene/patch-20070816-1-qemu-on-dfly)
and I got his permission to take over the maintenance of the patch set.

--nextPart16653566.fV4OKZ0n06
Content-Type: text/x-diff; name="patch-ab"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-ab"

$NetBSD$

--- Makefile.target.orig	2007-02-05 23:01:54 +0000
+++ Makefile.target
@@ -72,6 +72,10 @@ endif
 # We require -O2 to avoid the stack setup prologue in EXIT_TB
 OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing
 
+ifdef STACK_PROTECTOR_PRESENT
+OP_CFLAGS += -fno-stack-protector
+endif
+
 ifeq ($(ARCH),i386)
 HELPER_CFLAGS+=-fomit-frame-pointer
 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
@@ -440,10 +444,12 @@ endif
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
 ifndef CONFIG_SOLARIS
+ifndef CONFIG_DRAGONFLY
 VL_LIBS=-lutil -lrt
 endif
 endif
 endif
+endif
 ifdef TARGET_GPROF
 vl.o: BASE_CFLAGS+=-p
 VL_LDFLAGS+=-p


--nextPart16653566.fV4OKZ0n06
Content-Type: text/x-diff; name="patch-ad"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="patch-ad"

$NetBSD$

--- block.c.orig	2007-02-05 23:01:54 +0000
+++ block.c
@@ -29,8 +29,10 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/queue.h>
+#ifndef __DragonFly__
 #include <sys/disk.h>
 #endif
+#endif
 
 #define SECTOR_BITS 9
 #define SECTOR_SIZE (1 << SECTOR_BITS)


--nextPart16653566.fV4OKZ0n06
Content-Type: text/x-diff; name="qemu.patch"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="qemu.patch"

? patches/patch-ab
? patches/patch-ad
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/Makefile,v
retrieving revision 1.50
diff -u -p -d -r1.50 Makefile
--- Makefile	24 Dec 2007 10:18:22 -0000	1.50
+++ Makefile	25 Dec 2007 21:12:41 -0000
@@ -50,11 +50,6 @@ REPLACE_PERL+=		texi2pod.pl
 # to build in the SSE code.
 BUILDLINK_TRANSFORM+=	rm-optarg:-march rm-optarg:-mcpu rm:-msse rm:-msse2
 
-# Does not build with the stack protector
-.if ${OPSYS} == "DragonFly"
-CFLAGS+=		-fno-stack-protector
-.endif
-
 .include "../../mk/compiler.mk"
 
 .if !empty(CC_VERSION:Mgcc-4*)
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/distinfo,v
retrieving revision 1.35
diff -u -p -d -r1.35 distinfo
--- distinfo	24 Dec 2007 10:18:22 -0000	1.35
+++ distinfo	25 Dec 2007 21:12:41 -0000
@@ -3,15 +3,17 @@ $NetBSD: distinfo,v 1.35 2007/12/24 10:1
 SHA1 (qemu-0.9.0.tar.gz) = 1e57e48a06eb8729913d92601000466eecef06cb
 RMD160 (qemu-0.9.0.tar.gz) = 4296542b6da18a6ac93d20787330d3c1c2ac0a19
 Size (qemu-0.9.0.tar.gz) = 1901741 bytes
-SHA1 (patch-aa) = 455575215bad8864da285e1979da9ff7d8476a24
-SHA1 (patch-ac) = f3f37f2e72de28077a6579b12ecb2ea6650eea85
-SHA1 (patch-ag) = 91f10c4556a45ca3ec19efe67dcaa6625902c120
-SHA1 (patch-ak) = 004f47719cd533354162c336da833c20a2b288af
-SHA1 (patch-am) = a22a3b23284c377afa8113768d68c8ef40c514f9
-SHA1 (patch-ao) = e92d56f991cf29f83e39464f9e695caa86fe5fe0
-SHA1 (patch-au) = 8dec416dcff966ecf23bd8cb7904ab5bed22d08a
-SHA1 (patch-av) = 715e9680d70c1aa1c83bda0270125144a26d6140
-SHA1 (patch-aw) = 3b1472a95a2312f9e49ea1a6aa517ad81328324c
-SHA1 (patch-ax) = 66b060005ecbf9fd0451f7960e81eccbabf959ca
-SHA1 (patch-ay) = 2d3051685878abe077abdbba9681bd04e04c7fb3
-SHA1 (patch-ba) = 7c5043a39405f52b512e479a46fc76108580b7bc
+SHA1 (patch-aa) = 08f5d49b90f1f86dc7817677eea3d09169493116
+SHA1 (patch-ab) = 29870b0bec5f9fa08267dfb9208d75d1d735714a
+SHA1 (patch-ac) = 1c0d98305bb97018dac56165d670929bae0288af
+SHA1 (patch-ad) = ac69a03e4945e8c8fd5aadca070b876d0970910d
+SHA1 (patch-ag) = 8480b6f840bcad845d76df996f913d2ad6750b8c
+SHA1 (patch-ak) = 11669ec0ac62c0c90b7d2bfecb1f6efe3cb82fd2
+SHA1 (patch-am) = 2843d4376c9d5c615c9b41095e80145080beb043
+SHA1 (patch-ao) = 4b63d59e5c44f8553d6a9097eef5fd04c4ecb66f
+SHA1 (patch-au) = 2a251ae46504f465e7b1956dd3a973473b515f79
+SHA1 (patch-av) = ea46b3afceb8168213b7b7cbe220193ce912aeb0
+SHA1 (patch-aw) = 22a029e68bb68e9724e926a979f0aabcd90104ad
+SHA1 (patch-ax) = 65075df364a8bcca0547b7ab05aa0b5ec85434a7
+SHA1 (patch-ay) = 02f24f223456ae3946ec0a63396dabbc5fd2bcd2
+SHA1 (patch-ba) = b93ee5b3790a4619ca7c6cbe8cd4782ed516c4ae
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-aa,v
retrieving revision 1.3
diff -u -p -d -r1.3 patch-aa
--- patches/patch-aa	14 Dec 2004 01:02:19 -0000	1.3
+++ patches/patch-aa	25 Dec 2007 21:12:41 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-aa,v 1.3 2004/12/14 01:02:19 dbj Exp $
 
---- bswap.h.orig	Sun Nov 14 15:51:33 2004
+--- bswap.h.orig	2007-02-05 23:01:54 +0000
 +++ bswap.h
 @@ -5,6 +5,12 @@
  
@@ -15,12 +15,12 @@ $NetBSD: patch-aa,v 1.3 2004/12/14 01:02
  #ifdef HAVE_BYTESWAP_H
  #include <byteswap.h>
  #else
-@@ -57,6 +63,8 @@ static inline uint64_t bswap64(uint64_t 
- {
+@@ -58,6 +64,8 @@ static inline uint64_t bswap64(uint64_t 
      return bswap_64(x);
  }
-+
-+#endif /* ! HAVE_MACHINE_BSWAP_H */
  
++#endif /* ! HAVE_MACHINE_BSWAP_H */
++
  static inline void bswap16s(uint16_t *s)
  {
+     *s = bswap16(*s);
Index: patches/patch-ac
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-ac,v
retrieving revision 1.9
diff -u -p -d -r1.9 patch-ac
--- patches/patch-ac	18 Dec 2007 00:16:56 -0000	1.9
+++ patches/patch-ac	25 Dec 2007 21:12:41 -0000
@@ -1,7 +1,7 @@
 $NetBSD: patch-ac,v 1.9 2007/12/18 00:16:56 joerg Exp $
 
---- vl.c.orig	2007-05-02 01:56:26.000000000 +0200
-+++ vl.c	2007-05-02 01:57:42.000000000 +0200
+--- vl.c.orig	2007-02-05 23:01:54 +0000
++++ vl.c
 @@ -44,7 +44,7 @@
  #include <netdb.h>
  #ifdef _BSD
@@ -11,7 +11,7 @@ $NetBSD: patch-ac,v 1.9 2007/12/18 00:16
  #include <libutil.h>
  #endif
  #else
-@@ -1801,6 +1801,9 @@
+@@ -1801,6 +1801,9 @@ static CharDriverState *qemu_chr_open_tt
  
  static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
  {
@@ -21,7 +21,7 @@ $NetBSD: patch-ac,v 1.9 2007/12/18 00:16
      int fd = (int)chr->opaque;
      uint8_t b;
  
-@@ -1838,6 +1841,9 @@
+@@ -1838,6 +1841,9 @@ static int pp_ioctl(CharDriverState *chr
  
  static CharDriverState *qemu_chr_open_pp(const char *filename)
  {
Index: patches/patch-ag
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-ag,v
retrieving revision 1.8
diff -u -p -d -r1.8 patch-ag
--- patches/patch-ag	6 Jan 2007 21:21:35 -0000	1.8
+++ patches/patch-ag	25 Dec 2007 21:12:41 -0000
@@ -1,8 +1,8 @@
 $NetBSD: patch-ag,v 1.8 2007/01/06 21:21:35 xtraeme Exp $
 
---- configure.orig	2006-12-07 16:59:57.000000000 +0100
-+++ configure	2006-12-07 17:02:12.000000000 +0100
-@@ -27,7 +27,7 @@
+--- configure.orig	2007-02-05 23:01:54 +0000
++++ configure
+@@ -29,7 +29,7 @@ ar="ar"
  make="make"
  install="install"
  strip="strip"
@@ -11,7 +11,7 @@ $NetBSD: patch-ag,v 1.8 2007/01/06 21:21
  target_list=""
  case "$cpu" in
    i386|i486|i586|i686|i86pc|BePC)
-@@ -42,7 +42,7 @@
+@@ -44,7 +44,7 @@ case "$cpu" in
    alpha)
      cpu="alpha"
    ;;
@@ -20,7 +20,7 @@ $NetBSD: patch-ag,v 1.8 2007/01/06 21:21
      cpu="powerpc"
    ;;
    mips)
-@@ -115,6 +115,12 @@
+@@ -116,6 +116,12 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64
      kqemu="yes"
  fi
  ;;
@@ -33,7 +33,24 @@ $NetBSD: patch-ag,v 1.8 2007/01/06 21:21
  NetBSD)
  bsd="yes"
  oss="yes"
-@@ -509,7 +515,7 @@
+@@ -371,6 +377,16 @@ EOF
+     fi
+ fi
+ 
++# Check for stack protector
++cat > $TMPC <<EOF
++extern int foo;
++EOF
++if "$cc" -o $TMPE $TMPC -fno-stack-protector 2> /dev/null ; then
++  stack_protector_present="no"
++else
++  stack_protector_present="yes"
++fi
++
+ #
+ # Solaris specific configure tool chain decisions
+ #
+@@ -573,7 +589,7 @@ else
  if test -z "$prefix" ; then
      prefix="/usr/local"
  fi
@@ -42,7 +59,7 @@ $NetBSD: patch-ag,v 1.8 2007/01/06 21:21
  datadir="$prefix/share/qemu"
  docdir="$prefix/share/doc/qemu"
  bindir="$prefix/bin"
-@@ -646,6 +652,11 @@
+@@ -711,6 +727,11 @@ if test "$mingw32" = "yes" ; then
    echo "#define CONFIG_WIN32 1" >> $config_h
  elif test -f "/usr/include/byteswap.h" ; then
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
@@ -54,3 +71,14 @@ $NetBSD: patch-ag,v 1.8 2007/01/06 21:21
  fi
  if test "$darwin" = "yes" ; then
    echo "CONFIG_DARWIN=yes" >> $config_mak
+@@ -785,6 +806,10 @@ if [ "$bsd" = "yes" ] ; then
+   echo "#define _BSD 1" >> $config_h
+ fi
+ 
++if [ "$stack_protector_present" = "yes" ] ; then
++  echo "STACK_PROTECTOR_PRESENT=yes" >> $config_mak
++fi
++
+ echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
+ 
+ for target in $target_list; do
Index: patches/patch-ak
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-ak,v
retrieving revision 1.11
diff -u -p -d -r1.11 patch-ak
--- patches/patch-ak	18 Dec 2007 00:16:56 -0000	1.11
+++ patches/patch-ak	25 Dec 2007 21:12:41 -0000
@@ -1,8 +1,21 @@
 $NetBSD: patch-ak,v 1.11 2007/12/18 00:16:56 joerg Exp $
 
---- Makefile.orig	2007-02-06 00:01:54.000000000 +0100
+--- Makefile.orig	2007-02-05 23:01:54 +0000
 +++ Makefile
-@@ -66,21 +66,21 @@ ar      de     en-us  fi  fr-be  hr     
+@@ -27,10 +27,12 @@ endif
+ ifndef CONFIG_DARWIN
+ ifndef CONFIG_WIN32
+ ifndef CONFIG_SOLARIS
++ifndef CONFIG_DRAGONFLY
+ LIBS+=-lrt
+ endif
+ endif
+ endif
++endif
+ 
+ all: $(TOOLS) $(DOCS) recurse-all
+ 
+@@ -66,21 +68,21 @@ ar      de     en-us  fi  fr-be  hr     
  common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
  
  install-doc: $(DOCS)
Index: patches/patch-am
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-am,v
retrieving revision 1.2
diff -u -p -d -r1.2 patch-am
--- patches/patch-am	1 Jan 2006 13:48:45 -0000	1.2
+++ patches/patch-am	25 Dec 2007 21:12:41 -0000
@@ -1,8 +1,8 @@
 $NetBSD: patch-am,v 1.2 2006/01/01 13:48:45 xtraeme Exp $
 
---- audio/ossaudio.c.orig	2005-12-19 17:51:53.000000000 -0500
+--- audio/ossaudio.c.orig	2007-02-05 23:01:54 +0000
 +++ audio/ossaudio.c
-@@ -229,7 +229,7 @@ static int oss_open (int in, struct oss_
+@@ -231,7 +231,7 @@ static int oss_open (int in, struct oss_
          goto err;
      }
  
Index: patches/patch-ao
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-ao,v
retrieving revision 1.2
diff -u -p -d -r1.2 patch-ao
--- patches/patch-ao	1 Jan 2006 13:48:45 -0000	1.2
+++ patches/patch-ao	25 Dec 2007 21:12:41 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-ao,v 1.2 2006/01/01 13:48:45 xtraeme Exp $
 
---- audio/mixeng.c.orig	2005-12-19 17:51:53.000000000 -0500
+--- audio/mixeng.c.orig	2007-02-05 23:01:54 +0000
 +++ audio/mixeng.c
 @@ -101,48 +101,56 @@
  #undef IN_T
Index: patches/patch-au
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-au,v
retrieving revision 1.4
diff -u -p -d -r1.4 patch-au
--- patches/patch-au	18 Dec 2007 00:16:56 -0000	1.4
+++ patches/patch-au	25 Dec 2007 21:12:41 -0000
@@ -1,7 +1,7 @@
 $NetBSD: patch-au,v 1.4 2007/12/18 00:16:56 joerg Exp $
 
---- fpu/softfloat-native.h.orig	2007-02-06 00:01:54.000000000 +0100
-+++ fpu/softfloat-native.h	2007-05-02 01:54:50.000000000 +0200
+--- fpu/softfloat-native.h.orig	2007-02-05 23:01:54 +0000
++++ fpu/softfloat-native.h
 @@ -33,6 +33,24 @@
  #define isunordered(x,y)        unordered(x, y)
  #endif
Index: patches/patch-av
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-av,v
retrieving revision 1.3
diff -u -p -d -r1.3 patch-av
--- patches/patch-av	7 Oct 2007 21:21:00 -0000	1.3
+++ patches/patch-av	25 Dec 2007 21:12:41 -0000
@@ -2,7 +2,7 @@ $NetBSD: patch-av,v 1.3 2007/10/07 21:21
 
   Provide trunc() implementation for NetBSD 3 and Dragonfly
 
---- fpu/softfloat-native.c.orig	2007-02-06 00:01:54.000000000 +0100
+--- fpu/softfloat-native.c.orig	2007-02-05 23:01:54 +0000
 +++ fpu/softfloat-native.c
 @@ -3,6 +3,20 @@
  #include "softfloat.h"
Index: patches/patch-aw
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-aw,v
retrieving revision 1.2
diff -u -p -d -r1.2 patch-aw
--- patches/patch-aw	6 Jan 2007 21:21:35 -0000	1.2
+++ patches/patch-aw	25 Dec 2007 21:12:41 -0000
@@ -7,9 +7,9 @@ Index: dyngen.c
 RCS file: /cvsroot/qemu/qemu/dyngen.c,v
 retrieving revision 1.40
 diff -u -r1.40 dyngen.c
---- dyngen.c.orig	2007-01-05 20:32:17.000000000 +0000
-+++ dyngen.c	2007-01-05 20:36:45.000000000 +0000
-@@ -1624,6 +1624,7 @@
+--- dyngen.c.orig	2007-02-05 23:01:54 +0000
++++ dyngen.c
+@@ -1703,6 +1703,7 @@ void gen_code(const char *name, host_ulo
                  if(!sym_name)
                      continue;
                  if (*sym_name && 
@@ -17,7 +17,7 @@ diff -u -r1.40 dyngen.c
                      !strstart(sym_name, "__op_param", NULL) &&
                      !strstart(sym_name, "__op_jmp", NULL) &&
                      !strstart(sym_name, "__op_gen_label", NULL)) {
-@@ -1647,6 +1648,9 @@
+@@ -1726,6 +1727,9 @@ void gen_code(const char *name, host_ulo
  				 */
  				fprintf(outfile, "    extern char %s;\n",
  					sym_name);
Index: patches/patch-ax
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-ax,v
retrieving revision 1.3
diff -u -p -d -r1.3 patch-ax
--- patches/patch-ax	6 Jan 2006 09:17:03 -0000	1.3
+++ patches/patch-ax	25 Dec 2007 21:12:41 -0000
@@ -1,8 +1,8 @@
 $NetBSD: patch-ax,v 1.3 2006/01/06 09:17:03 xtraeme Exp $
 
---- target-i386/op.c.orig	2006-01-06 05:10:30.000000000 +0100
+--- target-i386/op.c.orig	2007-02-05 23:01:54 +0000
 +++ target-i386/op.c
-@@ -2099,14 +2099,17 @@ void OPPROTO op_fdivr_STN_ST0(void)
+@@ -2162,14 +2162,17 @@ void OPPROTO op_fdivr_STN_ST0(void)
  }
  
  /* misc FPU operations */
Index: patches/patch-ay
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-ay,v
retrieving revision 1.7
diff -u -p -d -r1.7 patch-ay
--- patches/patch-ay	21 May 2007 20:24:48 -0000	1.7
+++ patches/patch-ay	25 Dec 2007 21:12:41 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-ay,v 1.7 2007/05/21 20:24:48 xtraeme Exp $
 
---- block-raw.c.orig	2007-02-06 00:01:54.000000000 +0100
+--- block-raw.c.orig	2007-02-05 23:01:54 +0000
 +++ block-raw.c
 @@ -25,7 +25,9 @@
  #include "block_int.h"
Index: patches/patch-ba
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/qemu/patches/patch-ba,v
retrieving revision 1.1
diff -u -p -d -r1.1 patch-ba
--- patches/patch-ba	24 Dec 2007 10:18:22 -0000	1.1
+++ patches/patch-ba	25 Dec 2007 21:12:41 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-ba,v 1.1 2007/12/24 10:18:22 apb Exp $
 
---- hw/pcspk.c.orig	2007-02-06 01:01:54.000000000 +0200
+--- hw/pcspk.c.orig	2007-02-05 23:01:54 +0000
 +++ hw/pcspk.c
 @@ -38,7 +38,6 @@ typedef struct {
      unsigned int samples;


--nextPart16653566.fV4OKZ0n06--