Subject: Re: Dealing with Linux-only functions in a package
To: None <pkgsrc-users@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: pkgsrc-users
Date: 10/20/2006 22:42:44
Steven M. Bellovin wrote:
> On Fri, 20 Oct 2006 21:15:53 +0200, Christian Biere
> <christianbiere@gmx.de> wrote:
> > 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 meant to let the original developers do the work and then pick up their
changes from CVS/SVN or whatever.

> 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.

I'd just grab those functions, rename them so that they can't clash with the
Linux definitions and drop the sys/io.h inclusion so that it's more portable
and doesn't require a compile-time check. That's also better because the same
code will be used for each platform.

-- 
Christian