Subject: Order of Makefile inclusion matters
To: None <tech-pkg@NetBSD.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 05/12/2006 22:26:58
Hi,

currently pkgsrc is broken due to the change in the compiler.mk file, 
which provides a friendly wrapper when a package does not use 
USE_LANGUAGES=c++ but nevertheless calls the C++ compiler.

The problem is that in some packages, the variable TOOLS_DIR is not 
defined when compiler.mk is included. This is the case for all packages 
that include compiler.mk directly to change the build environment 
depending on the current compiler. One example package is 
converters/libiconv.

===> Patching for libiconv-1.10nb3
===> Applying distribution patches for libiconv-1.10nb3
===> Applying pkgsrc patches for libiconv-1.10nb3
===> Overriding tools for libiconv-1.10nb3
cannot create /bin/c++-fail-wrapper: permission denied
*** Error code 2

Since a few days I'm collecting ideas for detecting exactly this class 
of bugs using pkglint, since these bugs are tricky to find and not many 
developers know about them. But there is still much work to be done, 
especially since there are quite many contexts where make variables can 
be used. I first need to get a deep understanding of this variety and 
the many timing dependencies we have. When that is done, pkgsrc will be 
near to a formally specified system. :)

And this is the real cause of the problem: The file compiler.mk 
currently serves two purposes: First it provides some variables to the 
package author which can be used for configuring things. Second it 
creates the compiler wrappers. These two purposes can (and should) be 
split to separate files, so that the above side effect does not occur 
anymore.

Roland