Subject: EVAL_PREFIX doesn't always work
To: None <tech-pkg@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-pkg
Date: 03/22/2001 17:07:10
I've found that EVAL_PREFIX fails sometimes, appearently
if a sub-make is invoked due to unresolved dependencies.
Its implementation in bsd.pkg.mk doesn't look as I could
understand it, so I'll give an example here where it
fails for me:

The package I want to build is devel/hdf.
It depends on f2c. The path to the f2c binary is resolved
through EVAL_PREFIX - in the Makefile it looks like:

DEPENDS+=       f2c-[0-9]*:../../lang/f2c
[...]
USE_FORTRAN=    #defined
[...]
EVAL_PREFIX+=   JPEGBASE=jpeg F2CBASE=f2c

The binary is invoked by an absolute path then:

pre-build:
        (cd ${WRKSRC}/hdf/src; for i in *.f; do                 \
                ${F2CBASE}/bin/f2c $$i;                         \
        done)

If f2c is installed, it works well:

$ make
===> Validating dependencies for hdf-4.1r4
=> Checksum OK for HDF4.1r4.tar.gz.
===> Extracting for hdf-4.1r4
===> Required executable f2c-f77: /usr/pkg/bin/f2c-f77 found
===> Required installed package f2c-[0-9]*: f2c-20001205 found
[...]
===> Building for hdf-4.1r4
(cd /usr/pkgsrc/devel/hdf/work/HDF4.1r4/hdf/src; for i in *.f; do
         /usr/pkg/bin/f2c $i;                            done)
df24ff.f:
   d2gdims:
[...]

But if f2c is not there, a wrong f2c prefix is used:

bash-2.04$ make
===> Validating dependencies for hdf-4.1r4
=> Checksum OK for HDF4.1r4.tar.gz.
===> Extracting for hdf-4.1r4
===> Required executable f2c-f77: not found
===> Verifying reinstall for f2c-f77 in ../../lang/f2c
===> Installing for f2c-20001205
===> Becoming root@zelz48 to install f2c-20001205.
/usr/bin/su Password:
install -c -s -o root -g wheel -m 555 ./src/f2c /usr/pkg/bin
[...]
===> Registering installation for f2c-20001205
===> Returning to build of hdf-4.1r4
===> Required installed package f2c-[0-9]*: f2c-20001205 found
[...]
===> Building for hdf-4.1r4
(cd /usr/pkgsrc/devel/hdf/work/HDF4.1r4/hdf/src; for i in *.f; do
         /usr/X11R6/bin/f2c $i;                          done)
/usr/X11R6/bin/f2c: not found
*** Error code 127


It seems that EVAL_PREFIX falls back to /usr/X11R6 as prefix because
f2c is not yet there at the time it is evaluated.
But this is a guess only, perhaps someone who understands the
pkg Makefile magic can resolve this.

best regards
Matthias