Subject: xmlcatmgr as build dependency breaks packages
To: None <tech-pkg@netbsd.org>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-pkg
Date: 04/26/2004 17:16:30
Hi all,

just try to run make under devel/buildtool-doc (no need to download nor
install any dependencies) and you'll get:

[dawn buildtool-doc] $ make
make: "../../mk/buildlink3/../../mk/buildlink3/bsd.buildlink3.mk" line 243: Malformed conditional (empty(${_BLNK_RECMETHOD.xmlcatmgr}:M${_depend_}\:*))
make: "../../mk/buildlink3/../../mk/buildlink3/bsd.buildlink3.mk" line 243: Missing dependency operator
make: "../../mk/../../mk/bsd.pkg.mk" line 1391: if-less endif
make: "../../mk/../../mk/bsd.pkg.mk" line 1391: Need an operator
make: Fatal errors encountered -- cannot continue

make: stopped in /home/jmmv/NetBSD/pkgsrc/devel/buildtool-doc

This is caused because this package sets xmlcatmgr as a build dependency only
by doing: BUILDLINK_DEPMETHOD.xmlcatmgr=build.

The problem is that bsd.buildlink3.mk contains the following chunk of code:

.  if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
_BLNK_DEPMETHOD.${_pkg_}=       _BLNK_ADD_TO.DEPENDS
_BLNK_RECMETHOD.${_pkg_}=       _BLNK_ADD_TO.RECOMMENDED
.  elif !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild)
_BLNK_DEPMETHOD.${_pkg_}=       _BLNK_ADD_TO.BUILD_DEPENDS
.  endif

As you can see, _BLNK_RECMETHOD.${_pkg_} is not defined in the second part of
the conditional, so the conditional in line 243 fails later.  (I tried to
define the variable to the empty string, but no luck).

I'm not sure about the following patch... it adds another check, and avoids
doing that check in case we are using a full dependency; is it ok?
Maybe I should just check if the variable is defined in line 243 before
checking its value?

Thanks.

Index: bsd.buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink3/bsd.buildlink3.mk,v
retrieving revision 1.141
diff -u -r1.141 bsd.buildlink3.mk
--- bsd.buildlink3.mk	24 Apr 2004 15:49:42 -0000	1.141
+++ bsd.buildlink3.mk	26 Apr 2004 15:12:29 -0000
@@ -238,7 +238,8 @@
 .    endfor
 .  endif
 .  if defined(BUILDLINK_RECOMMENDED.${_pkg_}) && \
-      defined(BUILDLINK_PKGSRCDIR.${_pkg_})
+      defined(BUILDLINK_PKGSRCDIR.${_pkg_}) && \
+      !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
 .    for _rec_ in ${BUILDLINK_RECOMMENDED.${_pkg_}}
 .      if empty(${_BLNK_RECMETHOD.${_pkg_}}:M${_depend_}\:*)
 ${_BLNK_RECMETHOD.${_pkg_}}+=	${_rec_}:${BUILDLINK_PKGSRCDIR.${_pkg_}}

-- 
Julio M. Merino Vidal <jmmv@menta.net>
The NetBSD Project - http://www.NetBSD.org/