Subject: proposal of how to deal with missing header files supplied by nbcompat
To: None <>
From: Georg Schwarz <>
List: tech-pkg
Date: 12/01/2005 00:02:59
There are a number of header files such as regex.h or fnmatch.h some of
which might notr exist on a given system. Since pkgsrc assumes their
existence libnbcompat does provide them.
The problem is that they are normally not "activated", i.e. accessible
to compiler through the standard pkgsrc include proceduce, which is
normally a good thing since the native version, if it exists, should be
I would like to discuss a mechanism that selectively allows to activate
the libnbcompat version on a given system, if needed there.

Let's take the example of libregex and regex.h
First, we need a respective global variable (say NEED_REGEX_H) or option
(say need_regex_h). I am not sure what there current policy is, but
that's not the primary concern here (though it would be nice if someone
could clarify this).

This option/variable could be set in the respective platform file which
an option to override it in the local mk.conf, say (for IRIX):

.if !empty(OS_VERSION:M5*)

which tells pkgsrc that IRIX 5 does not come with a native regex.h.


Now libnbcompat should have in some post-install (or is that too late?)

.if defined(NEED_REGEX_H) && !empty(NEED_REGEX_H:M[Yy][Ee][Ss])
${LN} -s nbcompat/regex.h ${PREFIX}/include/regex.h

(or should that be ${LOCALBASE} instead of ${PREFIX}?)

In Addition, PLIST would have an extra entry


libnbcompat's Makefile would finally need

.if defined(NEED_REGEX_H) && !empty(NEED_REGEX_H:M[Yy][Ee][Ss])
PLIST_SUBST+=   NEED_REGEX_H="@comment "

and just the same for other features/header files.

Of course the bootstrap script needs a comparable logic since it
initially installs libnbcompat.

A package requiring, say, regex.h and fnmatch.h would get some code like

.if (defined(NEED_REGEX_H) && !empty(NEED_REGEX_H:M[Yy][Ee][Ss])) \
 || (defined(NEED_FNMATCH_H) && !empty(NEED_FNMATCH_H:M[Yy][Ee][Ss]))
.include "../../pkgtools/libnbcompat/"

if it is not using GNU configure it might also have to deal with adding
${BUILDLINK_LDADD.libnbcompat} to LIBS and making sure LIBS is used
adequately to link the package.
IMHO that could consitute a transparent, extensible and easy to use

Feedback on that idea would be very welcome.

Georg Schwarz  +49 178 8545053