Subject: don't allow X, invalid X11_TYPE, empty X11BASE, and BUILDLINK_X11_DIR
To: None <tech-pkg@NetBSD.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 03/04/2006 19:58:56
I set X11_TYPE to an impossible value (actually "impossible").

And the buildlinking failed with a /bin/sh error:

   Syntax error: word unexpected (expecting ")")

I tracked this down to mk/buildlink3/bsd.buildlink3.mk:

        case ${BUILDLINK_PREFIX.${_pkg_}} in                            \ 
        ${X11BASE})     buildlink_dir="${BUILDLINK_X11_DIR}" ;;         \
        *)              buildlink_dir="${BUILDLINK_DIR}" ;;             \

The X11BASE was empty.

Another problems, I saw was:

 bmake: "/usr/pkgsrc/pkgtools/xpkgwedge/Makefile" line 25: Malformed 
 conditional (${LOCALBASE} == ${X11BASE})

Should X11BASE be checked before use?

My plan is to use something invalid in X11_TYPE so that any package using 
X11 will fail. I have:

 .    if ${X11_TYPE} == "native"
 PKG_FAIL_REASON+= "${PKGNAME} uses X11, but ${X11BASE} not found"
 .    else
+.      if empty(X11BASE)
+PKG_FAIL_REASON+= "X11BASE is empty. Make sure X11_TYPE is set correctly."
+.      else
        ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${X11BASE}
        ${_PKG_SILENT}${_PKG_DEBUG}${CHOWN} ${ROOT_USER}:${ROOT_GROUP} 
${X11BASE
}
        ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} ${PKGDIRMODE} ${X11BASE}
 .    endif
 .  endif
+.  endif


But that doesn't help non-X packages.

Is the separate X11 buildlink directory even needed? (I may try removing 
all the BUILDLINK_X11_DIR code and see if that makes any difference. Or do 
you already know?)

 Jeremy C. Reed

 	  	 	 Media Relations and Publishing Services
	  	 	 http://www.reedmedia.net/