Subject: Proposal: buildlink for X11
To: None <tech-pkg@netbsd.org>
From: Johnny Lam <jlam@c35.jgrind.org>
List: tech-pkg
Date: 08/20/2001 12:20:38
I'm going to define these two terms for this discussion:

"weakly-buildlinked": a package looks for headers and libraries in
	${BUILDLINK_DIR}, and possibly also in ${LOCALBASE} and ${X11BASE}.

"strongly-buildlinked": a package looks for headers and libraries _only_ in
	${BUILDLINK_DIR}, and not in ${LOCALBASE} nor in ${X11BASE}.

Thus a package that satisfies the "strongly-buildlinked" property is also
"weakly-buildlinked", but not vice versa.  A package that is strongly-
buildlinked is desirable because it will not pick up "hidden dependencies",
where the configure process for a package finds some headers and libraries
in the environment and proceeds to assume that they will always be present
when the package is installed.

It is a known deficiency of the current buildlink infrastructure that only
when xpkgwedge is installed prior to the installation of any X11 packages
that all packages may be strongly buildlinked.  If xpkgwedge is _not_
installed, then when a package sets either USE_X11 or USE_X11BASE, then
it will look in ${X11BASE} for headers and libraries, it will not find just
the X11R6 files, but also any X11 packages' headers and libraries.

A possible solution for this is to create a shadow directory of symbolic
links under ${LOCALBASE} of the true X11R6 headers and libraries in
${X11BASE}.  Call this shadow directory "${BUILDLINK_X11_DIR}".  Then
if a package may be made to look for X11R6 files under ${BUILDLINK_X11_DIR},
then it avoids the problem noted above, and thus may be strongly-
buildlinked.

I've tried implementing this solution, and it seems to work quite well.
I've created a new package pkgtools/x11-links that installs the shadow
tree under ${LOCALBASE}/share/x11-links (suggestions for a better place are
very welcome), and modified bsd.pkg.mk, bsd.buildlink.mk, and
pkgtools/buildlink-x11 to look for X11R6 files in ${BUILDLINK_X11_DIR} if
USE_BUILDLINK_X11 is defined.  Test compiling graphics/xli, wm/pwm, and
x11/gtk were successful with minor modifications to those packages.  I've
placed my changes at:

	http://jgrind.org/~jlam/buildlink-for-x11.tgz

	Comments?

	-- Johnny Lam <jlam@jgrind.org>