Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 2015 22:03:14 -0500
From:      Jason Unovitch <junovitch@FreeBSD.org>
To:        Jan Beich <jbeich@vfemail.net>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: ${PYTHON_CMD}/${PERL} in _CONFIGURE_WITH not working
Message-ID:  <20151121030314.GA65559@Silverstone.nc-us.unovitch.com>
In-Reply-To: <vb8x-ntzi-wny@vfemail.net>
References:  <20151120030756.GA28016@Silverstone.nc-us.unovitch.com> <vb8x-ntzi-wny@vfemail.net>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Fri, Nov 20, 2015 at 06:02:41AM +0100, Jan Beich wrote:
> Jason Unovitch <junovitch@FreeBSD.org> writes:
> > PERL_USES=                      perl5
> > PERL_CONFIGURE_ENABLE=          perl
> > PERL_CONFIGURE_WITH=            perl=${PERL} perl-bindings
> > PYTHON_USES=                    python:2
> > PYTHON_CONFIGURE_ENABLE=        python
> > PYTHON_CONFIGURE_WITH=          python=${PYTHON_CMD}
> [...]
> > % make -VCONFIGURE_ARGS
> > "--enable-python --with-python= "
> > "--enable-perl --with-perl= --with-perl-bindings"
> 
> It appears bsd.option.mk expands _WITH and _ENABLE twice unlike _ON/_OFF:
> once in .for loop and once (lazily) when CONFIGURE_ARGS is referenced.
> Try using $${PERL} and $${PYTHON_CMD} or the following patch:

Yes, this $$ variant fixes CONFIGURE_ARGS and allows a successful build.

% make -VPERL_CONFIGURE_WITH
perl=${PERL} perl-bindings
% make -VPYTHON_CONFIGURE_WITH
python=${PYTHON_CMD}
% make -VCONFIGURE_ARGS
- --with-perl=/usr/local/bin/perl --with-perl-bindings 
- --with-python=/usr/local/bin/python2.7

> # XXX incomplete as there're more cases with premature expansion
> Index: Mk/bsd.options.mk
> ===================================================================
> --- Mk/bsd.options.mk	(revision 401846)
> +++ Mk/bsd.options.mk	(working copy)
> @@ -491,16 +491,8 @@ ${_u:tu}=		${${opt}_VARS:M${var}=*:C/[^=]*=//:C/^"
>  .        endif
>  .      endfor
>  .    endif
> -.    if defined(${opt}_CONFIGURE_ENABLE)
> -.      for iopt in ${${opt}_CONFIGURE_ENABLE}
> -CONFIGURE_ARGS+=	--enable-${iopt}
> -.      endfor
> -.    endif
> -.    if defined(${opt}_CONFIGURE_WITH)
> -.      for iopt in ${${opt}_CONFIGURE_WITH}
> -CONFIGURE_ARGS+=	--with-${iopt}
> -.      endfor
> -.    endif
> +CONFIGURE_ARGS+=	${${opt}_CONFIGURE_ENABLE:C/.+/--enable-&/}
> +CONFIGURE_ARGS+=	${${opt}_CONFIGURE_WITH:C/.+/--with-&/}
>  .    for configure in CONFIGURE CMAKE QMAKE
>  .      if defined(${opt}_${configure}_ON)
>  ${configure}_ARGS+=	${${opt}_${configure}_ON}
> @@ -539,16 +531,8 @@ ${_u:tu}=		${${opt}_VARS_OFF:M${var}=*:C/[^=]*=//:
>  .        endif
>  .      endfor
>  .    endif
> -.    if defined(${opt}_CONFIGURE_ENABLE)
> -.      for iopt in ${${opt}_CONFIGURE_ENABLE}
> -CONFIGURE_ARGS+=	--disable-${iopt:C/=.*//}
> -.      endfor
> -.    endif
> -.    if defined(${opt}_CONFIGURE_WITH)
> -.      for iopt in ${${opt}_CONFIGURE_WITH}
> -CONFIGURE_ARGS+=	--without-${iopt:C/=.*//}
> -.      endfor
> -.    endif
> +CONFIGURE_ARGS+=	${${opt}_CONFIGURE_ENABLE:C/=.*//:C/.+/--disable-&/}
> +CONFIGURE_ARGS+=	${${opt}_CONFIGURE_WITH:C/=.*//:C/.+/--without-&/}
>  .    for configure in CONFIGURE CMAKE QMAKE
>  .      if defined(${opt}_${configure}_OFF)
>  ${configure}_ARGS+=	${${opt}_${configure}_OFF}

This patch does indeed fix the issues.  I haven't checked for further
regressions past this however.

% make -VPERL_CONFIGURE_WITH
perl=/usr/local/bin/perl perl-bindings
% make -VPYTHON_CONFIGURE_WITH
python=/usr/local/bin/python2.7
% make -VCONFIGURE_ARGS
- --with-perl=/usr/local/bin/perl --with-perl-bindings
- --with-python=/usr/local/bin/python2.7 

Thanks for the assist, Jan!  Any recommendations on the best way ahead?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQF8BAEBCgBmBQJWT97qXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0NURGNTQ1OTkzQkJFMzc3OTNDQUNERUU2
RkQ0OUMzMDE2MUNBQTZFAAoJEG/UnDAWHKpuBYsH/0nnh4dBBUKa1nQv0+lzMVhd
C/2dFymXlMIyZcka3s0s1V7CIjsE5ZEipqYeZv7Cf6zxc2Vg56cJOjmkUGKZvqM1
0jJ7uEz/lF/YNtAiFq6u3KcHDvRiA/ciGcn9o9CMiSadZc+/+fgGE2V9ZflZr+yx
s6auJE78hjYDn00iKd5MyXJg+rSQ/JQiYUQH7bL9q4BOH9rLIqXf6Pi24m+Eck5s
hNSjr09rExDiciY6Gp4kDoqwWS9kTwP1lJkGupQvEreLmBd9Vjhb9m0iK9/0MSr2
rZSstm1/JfX8LxwJRBe5+7WlfnqYNhmFGY6l1Ejy4PRcm/Mecu46Z8deuRlI8z0=
=tG1V
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151121030314.GA65559>