Subject: pkg/24689: bsd.buildlink3.mk broken
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mlelstv@serpens.de>
List: netbsd-bugs
Date: 03/06/2004 16:05:33
>Number:         24689
>Category:       pkg
>Synopsis:       bsd.buildlink3.mk broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 06 15:06:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Michael van Elst
>Release:        NetBSD 1.6.2
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."
>Environment:
	
	
System: NetBSD pepew 1.6.2 NetBSD 1.6.2 (PEPEW) #1: Mon Feb 23 23:34:11 MET 2004 src@pepew:/amd/fud/d/0/src/sys/arch/i386/compile/PEPEW i386
Architecture: i386
Machine: i386
>Description:
bsd.buildlink3.mk 1.102 introduced further checks for built-in packages
which test USE_BUILTIN.<pkg> variables wether these are defined for
a certain package or not.

The empty() function in make as of NetBSD-1.6.2 fails for undefined
variables. E.g.:

| make: "/d/0/pkgsrc/graphics/gd/../../mk/buildlink3/bsd.buildlink3.mk" line 1: Malformed conditional (empty(_BLNK_DEPENDS:Mx11-links) && !empty(USE_BUILTIN.x11-links:M[nN][oO]))
| make: "/d/0/pkgsrc/graphics/gd/../../mk/bsd.pkg.mk" line 1369: if-less endif
| make: "/d/0/pkgsrc/graphics/gd/../../mk/bsd.pkg.mk" line 1369: Need an operator
| make: Fatal errors encountered -- cannot continue

Newer version of make as found in -current can handle undefined variables.

>How-To-Repeat:
Update to current pkgsrc and try to build something that depends on
buildlink3.

>Fix:
diff -u -r1.102 bsd.buildlink3.mk
--- bsd.buildlink3.mk   2004/03/05 19:25:37     1.102
+++ bsd.buildlink3.mk   2004/03/06 15:05:01
@@ -123,7 +123,7 @@
 #
 _BLNK_DEPENDS= # empty
 .for _pkg_ in ${BUILDLINK_DEPENDS}   
-.  if empty(_BLNK_DEPENDS:M${_pkg_}) && !empty(USE_BUILTIN.${_pkg_}:M[nN][oO])
+.  if empty(_BLNK_DEPENDS:M${_pkg_}) && defined(USE_BUILTIN.{$_pkg_}) && !empty(USE_BUILTIN.${_pkg_}:M[nN][oO])
 _BLNK_DEPENDS+=        ${_pkg_}
 .  endif
 .endfor

>Release-Note:
>Audit-Trail:
>Unformatted: