Package: gpsim
Version: 0.20.14-7.2
Severity: important
Tags: patch

Hi,

gpsim fails to build on GNU/kFreeBSD because the code to access to the
parallel port is Linux specific. Please find attached a patch to add
support for GNU/kFreeBSD. It should also work on plain FreeBSD, so the
upstream may be interested in it. 

Could you please apply this patch in the next upload?

Thanks in advance,
Aurelien

-- System Information:
Debian Release: testing/unstable
Architecture: kfreebsd-i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: GNU/kFreeBSD 5.4-1-686
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)

Versions of packages gpsim depends on:
ii  libc0.1                2.3-1+kbsd.15     GNU C Library: Shared libraries an
ii  libgcc1                1:4.0.2-5         GCC support library
ii  libglib1.2             1.2.10-10+libtool The GLib library of C routines
ii  libgtk1.2              1.2.10-18         The GIMP Toolkit set of widgets fo
ii  libgtkextra17          0.99.17-2.2       A useful set of widgets for GTK+
ii  libpopt0               1.7-5+libtool     lib for parsing cmdline parameters
ii  libreadline5           5.1-4             GNU readline and history libraries
ii  libstdc++6             4.0.2-5           The GNU Standard C++ Library v3
ii  libx11-6               6.8.2.dfsg.1-11   X Window System protocol client li
ii  libxext6               6.8.2.dfsg.1-11   X Window System miscellaneous exte
ii  libxi6                 6.8.2.dfsg.1-11   X Window System Input extension li
ii  xlibs                  6.8.2.dfsg.1-11   X Window System client libraries m

Versions of packages gpsim recommends:
ii  gputils                       0.13.3-1   GNU PIC utilities

-- no debconf information
Status: in BTS
Author: aurel32

diff -u gpsim-0.20.14/modules/paraface.cc gpsim-0.20.14/modules/paraface.cc
--- gpsim-0.20.14/modules/paraface.cc
+++ gpsim-0.20.14/modules/paraface.cc
@@ -41,9 +41,20 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#if defined(__linux__)
 #include <linux/parport.h>
 #include <linux/ppdev.h>
-
+#elif defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#include <dev/ppbus/ppi.h>
+#include <dev/ppbus/ppbconf.h>
+#define PPRSTATUS 		PPIGSTATUS
+#define PPWDATA			PPISDATA
+#define PARPORT_STATUS_ACK	nACK
+#define PARPORT_STATUS_BUSY	nBUSY
+#define PARPORT_STATUS_PAPEROUT	PERROR
+#define PARPORT_STATUS_SELECT	SELECT
+#define PARPORT_STATUS_ERROR	nFAULT
+#endif
 
 #include <errno.h>
 #include <stdlib.h>
@@ -345,14 +356,17 @@
 		perror ("open");
 		return -1;
     }
-
+
+#if defined(PPCLAIM)
     if (ioctl (fd, PPCLAIM)) {
 		perror ("PPCLAIM");
 		close (fd);
         fd=-1;
 		return -1;
     }
+#endif
 
+#if defined(PPNEGOT)
     /* Switch to compatibility mode.  (In fact we don't need
      * to do this, since we start off in compatibility mode
      * anyway, but this demonstrates PPNEGOT.)*/
@@ -364,6 +378,19 @@
 		return -1;
     }
 	return 0;		// SUCCESS
+#elif defined(PPISECR)
+    /* Switch to compatibility mode.  (In fact we don't need
+     * to do this, since we start off in compatibility mode
+     * anyway, but this demonstrates PPISECR.)*/
+    mode = PPB_COMPATIBLE;
+    if (ioctl (fd, PPISECR, &mode)) {
+    		perror ("PPISECR");
+		close (fd);
+        fd=-1;
+		return -1;
+    }
+	return 0;		// SUCCESS
+#endif
 }
 
 // Return low five bits containing:

Reply via email to