pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Dealing with Linux-only functions in a package
On Fri, 20 Oct 2006 21:15:53 +0200, Christian Biere
<christianbiere%gmx.de@localhost> wrote:
> Steven M. Bellovin wrote:
> > 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.
>
> Have you asked the original developers? I think the fix is obvious:
> Add a compile-time check for the header file and the functions. If
> they are not available use GCC's inline assembler. Those functions
> should be one-liners and map directly to x86 assembler instructions.
How is that best done in the pkgsrc framework? Right now, I have a
patch-ab file, which is applied unconditionally. There's no autoconfig
framework to do that. I could, I suppose, patch the offending file to use
some local #include file, and write a post-patch target that checked
for /usr/include/sys/io.h and used either that or the inline copy.
>
> > 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.
>
> I'd say there's nothing which guarantees that anything from sys/io.h
> or any other header file works without the OS being loaded. So in my
> opinion, always including the code is the cleaner solution.
>
Well, yes, but I didn't write the original code that made that
assumption...
Anyway, that's certainly the easiest way to proceed as well; if people
don't think there's a problem with it, I'll leave it alone. It avoids the
crazy scripts I talked about above.
--Steven M. Bellovin, http://www.cs.columbia.edu/~smb
Home |
Main Index |
Thread Index |
Old Index