[MPlayer-dev-eng] [PATCH] DragonFly support

Joerg Sonnenberger joerg at britannica.bec.de
Tue May 24 20:05:12 CEST 2005


Hi all,
attached patch contains the rest of the changes necessary for DragonFly.
With the lrintf detection fix and the already commited change, it should
now build out-of-the-box.

Joerg
-------------- next part --------------
--- loader/win32.c.orig	2005-04-15 22:17:12.000000000 +0200
+++ loader/win32.c	2005-05-20 20:17:23.000000000 +0200
@@ -993,7 +995,7 @@
 
 /* disable cpuid based detection (mplayer's cpudetect.c does this - see above) */
 #ifndef MPLAYER
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__) || defined(__DragonFly__)
     do_cpuid(1, regs);
     switch ((regs[0] >> 8) & 0xf) {			// cpu family
     case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
--- cpudetect.c.orig	2005-01-12 22:56:25.000000000 +0100
+++ cpudetect.c	2005-05-20 20:00:44.000000000 +0200
@@ -20,7 +20,7 @@
 #include <machine/cpu.h>
 #endif
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #endif
@@ -169,7 +169,7 @@
 #endif
 
 		/* FIXME: Does SSE2 need more OS support, too? */
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__) || defined(__DragonFly__)
 		if (caps->hasSSE)
 			check_os_katmai_support();
 		if (!caps->hasSSE)
@@ -324,7 +324,7 @@
 #ifdef ARCH_X86_64
    gCpuCaps.hasSSE=1;
    gCpuCaps.hasSSE2=1;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
    int has_sse=0, ret;
    size_t len=sizeof(has_sse);
 
--- libdha/pci.c.orig	2005-05-20 20:00:58.000000000 +0200
+++ libdha/pci.c	2005-05-20 20:01:07.000000000 +0200
@@ -62,7 +62,7 @@
 /* OS depended stuff */
 #if defined (linux)
 #include "sysdep/pci_linux.c"
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD__) || defined(__DragonFly__)
 #include "sysdep/pci_freebsd.c"
 #elif defined (__386BSD__)
 #include "sysdep/pci_386bsd.c"
--- libmpcodecs/ad_realaud.c.orig	2005-05-20 20:01:46.000000000 +0200
+++ libmpcodecs/ad_realaud.c	2005-05-20 20:01:52.000000000 +0200
@@ -35,7 +35,7 @@
 	free(ize);
 }
 
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 void *__ctype_b=NULL;
 #endif
 
--- libmpcodecs/vd_realvid.c.orig	2005-05-20 20:04:14.000000000 +0200
+++ libmpcodecs/vd_realvid.c	2005-05-20 20:04:24.000000000 +0200
@@ -79,7 +79,7 @@
 //	exit(1);
 }
 
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 void ___brk_addr(void) {exit(0);}
 char **__environ={NULL};
 #undef stderr
--- libmpdemux/cddb.c.orig	2005-05-20 20:04:55.000000000 +0200
+++ libmpdemux/cddb.c	2005-05-20 20:05:16.000000000 +0200
@@ -30,7 +30,7 @@
 
 #if defined(__linux__)
 	#include <linux/cdrom.h>
-#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 	#include <sys/cdio.h>
 #endif
 
@@ -82,7 +82,7 @@
 	return tochdr.cdth_trk1;
 }
 
-#elif defined(__FreeBSD__) || defined(__bsdi__)
+#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__DragonFly__)
 int 
 read_toc(const char *dev) {
 	int drive;
--- libmpdemux/stream_vcd.c.orig	2005-05-20 20:10:45.000000000 +0200
+++ libmpdemux/stream_vcd.c	2005-05-20 20:10:59.000000000 +0200
@@ -14,7 +14,7 @@
 #include <sys/ioctl.h>
 #include <errno.h>
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/cdrio.h>
 #include "vcd_read_fbsd.h" 
 #elif defined(__NetBSD__) || defined (__OpenBSD__)
--- libmpdemux/tvi_bsdbt848.c.orig	2005-05-20 20:11:15.000000000 +0200
+++ libmpdemux/tvi_bsdbt848.c	2005-05-20 20:11:56.000000000 +0200
@@ -43,6 +43,9 @@
 #ifdef __NetBSD__
 #include <dev/ic/bt8xx.h>
 #include <sys/audioio.h>
+#elif defined(__DragonFly__)
+#include <dev/video/meteor/ioctl_meteor.h>
+#include <dev/video/bktr/ioctl_bt848.h>
 #elif __FreeBSD_version >= 502100
 #include <dev/bktr/ioctl_meteor.h>
 #include <dev/bktr/ioctl_bt848.h>
--- libmpdvdkit2/bswap.h.orig	2005-05-20 20:12:12.000000000 +0200
+++ libmpdvdkit2/bswap.h	2005-05-20 20:13:32.000000000 +0200
@@ -88,12 +88,17 @@
 }
 #define B2N_64(x) x = bswap_64(x)
 
+#elif defined(__DragonFly__)
+#include <sys/endian.h>
+#define B2N_16(x) x = be16toh(x)
+#define B2N_32(x) x = be32toh(x)
+#define B2N_64(x) x = be64toh(x)
+
 /* This is a slow but portable implementation, it has multiple evaluation 
  * problems so beware.
  * FreeBSD and Solaris don't have <byteswap.h> or any other such 
  * functionality! 
  */
-
 #elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__)
 #define B2N_16(x) \
  x = ((((x) & 0xff00) >> 8) | \
--- libmpdvdkit2/dvd_reader.c.orig	2005-05-20 20:13:48.000000000 +0200
+++ libmpdvdkit2/dvd_reader.c	2005-05-20 20:13:55.000000000 +0200
@@ -35,7 +35,7 @@
 #include <limits.h>
 #include <dirent.h>
  
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) || defined(__DragonFly__)
 #define SYS_BSD 1
 #endif
 
--- loader/ldt_keeper.c.orig	2005-05-20 20:14:38.000000000 +0200
+++ loader/ldt_keeper.c	2005-05-20 20:16:22.000000000 +0200
@@ -50,7 +50,7 @@
 }
 #endif
 #else
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 #include <machine/segments.h>
 #include <machine/sysarch.h>
 #endif
@@ -165,7 +165,7 @@
 #endif
 #endif
 
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
 {
     *buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
@@ -227,7 +227,7 @@
     }
 #endif /*linux*/
 
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
     {
         unsigned long d[2];
 
@@ -246,7 +246,7 @@
             printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n");
         }
     }
-#endif  /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */
+#endif  /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ */
 
 #if defined(__svr4__)
     {
--- loader/pe_image.c.orig	2005-05-20 20:16:31.000000000 +0200
+++ loader/pe_image.c	2005-05-20 20:16:45.000000000 +0200
@@ -905,7 +905,7 @@
  */
 static void __attribute__((noinline)) extend_stack_for_dll_alloca(void)
 {
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
     volatile int* mem=alloca(0x20000);
     *mem=0x1234;
 #endif
--- osdep/getch2.c.orig	2005-05-20 20:17:34.000000000 +0200
+++ osdep/getch2.c	2005-05-20 20:17:57.000000000 +0200
@@ -220,7 +220,7 @@
 struct termios tio_new;
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
     tcgetattr(0,&tio_orig);
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCGETA,&tio_orig);
 #else
     ioctl(0,TCGETS,&tio_orig);
@@ -231,7 +231,7 @@
     tio_new.c_cc[VTIME] = 0;
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
     tcsetattr(0,TCSANOW,&tio_new);
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCSETA,&tio_new);
 #else
     ioctl(0,TCSETS,&tio_new);
@@ -245,7 +245,7 @@
 #ifdef HAVE_TERMIOS
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__)
     tcsetattr(0,TCSANOW,&tio_orig);
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__APPLE__) || defined(__DragonFly__)
     ioctl(0,TIOCSETA,&tio_orig);
 #else
     ioctl(0,TCSETS,&tio_orig);


More information about the MPlayer-dev-eng mailing list