Subject: assignment problem in bsd.buildlink3.mk (was Re: executables from devel/binutils not used by buildink3)
To: None <tech-pkg@NetBSD.org>
From: Klaus Heinz <k.heinz.maer.vier@onlinehome.de>
List: tech-pkg
Date: 03/05/2004 23:06:24
I had the following problem:

> building multimedia/mplayer on NetBSD/i386 1.5.4_ALPHA I encountered the
> problem that binutils is required, but not found during the "configure"
> stage:
> 
>   ...
>   ===> Required installed package binutils>=2.14.0: binutils-2.14.0.0 found
>   ===> Required installed package gcc>=2.95.3: gcc-2.95.3 found
>   ...
>   ===> Configuring for mplayer-1.0rc3nb1
>   Detected operating system: NetBSD
>   Detected host architecture: i386
>   Checking for gcc version ... 2.95.3, ok
>   ...
>   Checking for assembler (as 2.9.1) ... failed
>   Upgrade binutils to 2.10.1 ...



>   $ bmake show-var VARNAME=AS
>   /bin/as
> 
> This should be /usr/pkg/i386--netbsdelf/bin/as, set in
> binutils/buildlink3.mk to ${BUILDLINK_PREFIX.binutils}/bin/as. But I
> cannot see where BUILDLINK_PREFIX.binutils is supposed to be set:
> 
>   $ bmake show-var VARNAME=BUILDLINK_PREFIX.binutils
> 
>   $

One mistake on my side: I did not provide a value for PKG_PHASE (eg,
make PKG_PHASE=buildlink show-var...) for the show-var target, thus I got
partially wrong output.


I think there is a problem in bsd.buildlink3.mk for the
"buildlink-wrappers" target:

  --- bsd.buildlink3.mk.orig	Tue Feb 24 22:34:54 2004
  +++ bsd.buildlink3.mk	Fri Mar  5 21:08:26 2004
  @@ -1202,15 +1202,15 @@
 
   buildlink-wrappers: ${_BLNK_LIBTOOL_FIX_LA}
 
   .for _wrappee_ in ${_BLNK_WRAPPEES}
   .  if defined(PKG_${_wrappee_})
   _BLNK_PKG_${_wrappee_}=	${PKG_${_wrappee_}}
   .  else
  -_BLNK_PKG_${_wrappee_}=	${${_wrappee_}}
  +_BLNK_PKG_${_wrappee_}:=	${${_wrappee_}}
   .  endif
 
   BUILDLINK_${_wrappee_}=	\
 	  ${BUILDLINK_DIR}/bin/${_BLNK_PKG_${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
   ${_wrappee_}:=	${BUILDLINK_${_wrappee_}:T}
 
   # Filter to scrunch shell scripts by removing comments and empty lines.

For the value "AS" of _wrappee_, _BLNK_PKG_AS got set to "${AS}" (which
got correctly set to /usr/pkg/bin/as in binutils/buildlink3.mk), then
BUILDLINK_AS was assigned a value and in turn AS got changed again,
effectively changing _BLNK_PKG_AS as well.
The proposed patch changes this behaviour so that $BUILDLINK_DIR/bin/as
contains /usr/pkg/bin/as as the command to execute and the mplayer
package recognizes as from binutils correctly.

Probably the "then"-clause of the test for PKG_${_wrappee_} should also
use assignment with expansion.


ciao
     Klaus