Subject: Dealing with Linux-only functions in a package
To: None <pkgsrc-users@Netbsd.org>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: pkgsrc-users
Date: 10/20/2006 14:57:47
I'm trying to put together a package for memtest86+.  One routine uses the
inb_p, outb_p, and outb functions that it gets from <sys/io.h> on Linux.
The question is what to do when compiling on NetBSD.

One solution that appears to work -- at least, it compiles, though I
haven't tried running it yet -- is to replace the #include with the inline
definitions from a Linux box.  (That presumably introduces GPL DNA into
the package, but since memtest86+ itself is GPLed that isn't a problem;
I will, perhaps, have to figure out what text, if any, I need to note in
the package.)  OTOH, it seems unclean to do a source copy, since if the
package is compiled on a Linux box the original version works just fine.
(Portability isn't an issue; this is a memory tester, which is inherently
non-portable.)

Another choice is to delete the offending code entirely -- all it does is
sound a beep sometimes, which is non-critical.

Any other ideas?  I don't know any way to apply a patch file conditionally.

		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb