DragonFly BSD
DragonFly bugs List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Okay, so what do we do with the new errno?

From: YONETANI Tomokazu <qhwt+dfly@xxxxxxxxxx>
Date: Mon, 9 May 2005 12:27:08 +0900

On Wed, May 04, 2005 at 09:21:43AM -0700, Matthew Dillon wrote:
>     The only thing we can do for programs which declare errno regardless
>     of anything else is to rip out such declarations and throw an
>     #include <errno.h> in instead.  Those programs are plain and simply
>     broken and the authors need to fix their code.

But there's a bunch of them and totally kills automatic nature of
port builds. So I decided to write an aggressive make rule
to automatically replace these annoying declarations.

# for make -jN safety
. ORDER: extern-errno-smasher pre-configure
configure: extern-errno-smasher
	@${ECHO} "===> Activating errno-smasher" 1>&2
	@if ${GREP} -rq "${RE_EXTERN_ERRNO}" ${WRKSRC}; then \
		${ECHO} " ==> found errno declaration, smashing it" 1>&2; \
		${FIND} ${WRKSRC} -type f -print0 | ${XARGS} -0 \
		sed -i.bak -e "s/${RE_EXTERN_ERRNO}/#include <errno.h>/"; \
	# I'm using sed instead of ${REINPLACE_CMD} here, because
	# it's not activated unless you have USE_REINPLACE defined.
. endif

This sometimes works, but not if you're in a port directory which has
a dfport override, because WRKSRC evaluates to empty, so I'm only
using it from the command line.  Anyone has an idea to make it actually

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]