Subject: patches for emulators/qemu on DragonFly
To: None <pkgsrc-users@NetBSD.org>
From: Patrick Georgi <patrick@georgi-clan.de>
List: pkgsrc-users
Date: 08/19/2007 10:16:08
--Boundary-00=_Ix/xGZK7NSnQmrG
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

attached are three patches to make emulators/qemu build on DragonFly

patch-ba removes an unnecessary include (I assume it shouldn't be necessary 
anywhere, and inclusion fails with an error that it should not be used by 
userland applications)

patch-bb makes qemu build without librt on DragonFly

patch-bc disables the stack protector for op.c, as dyngen fails because of it 
when parsing op.o


Regards,
Patrick Georgi

--Boundary-00=_Ix/xGZK7NSnQmrG
Content-Type: text/x-diff;
  charset="utf-8";
  name="patch-ba"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="patch-ba"

--- block.c~	2007-08-19 09:27:54.000000000 +0200
+++ block.c	2007-08-19 09:28:00.000000000 +0200
@@ -29,7 +29,6 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/queue.h>
-#include <sys/disk.h>
 #endif
 
 #define SECTOR_BITS 9

--Boundary-00=_Ix/xGZK7NSnQmrG
Content-Type: text/x-diff;
  charset="utf-8";
  name="patch-bc"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="patch-bc"

--- Makefile.target	31 Jul 2007 23:44:21 -0000	1.191
+++ Makefile.target	16 Aug 2007 18:01:30 -0000
@@ -83,3 +83,7 @@
 # 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
+
--- configure	1 Aug 2007 00:09:31 -0000	1.152
+++ configure	16 Aug 2007 18:01:31 -0000
@@ -433,6 +433,16 @@
     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
 #
@@ -867,5 +877,9 @@
   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
 

--Boundary-00=_Ix/xGZK7NSnQmrG
Content-Type: text/x-diff;
  charset="utf-8";
  name="patch-bb"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="patch-bb"

--- Makefile~	2007-08-19 09:30:06.000000000 +0200
+++ Makefile	2007-08-19 09:30:15.000000000 +0200
@@ -27,10 +27,12 @@
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
 ifndef CONFIG_SOLARIS
+ifndef CONFIG_DRAGONFLY
 LIBS+=-lrt
 endif
 endif
 endif
+endif
 
 all: $(TOOLS) $(DOCS) recurse-all
 
--- Makefile.target~	2007-08-19 09:30:39.000000000 +0200
+++ Makefile.target	2007-08-19 09:30:55.000000000 +0200
@@ -440,7 +440,9 @@
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
 ifndef CONFIG_SOLARIS
+ifndef CONFIG_DRAGONFLY
 VL_LIBS=-lutil -lrt
+endif
 endif
 endif
 endif

--Boundary-00=_Ix/xGZK7NSnQmrG--