pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proper usage of BUILTIN_FIND_PKGCONFIG_FILES_VAR?



Am 14.06.2022 um 18:03 schrieb Yosuke Kawasaki:
I got a puzzling result.

When I ran the modified code below,
(Makefile code)

I guess that's rather your copy-base-pkgconfig.mk, not the actual
package Makefile.

.PHONY: copy-base-pkgconfig
copy-base-pkgconfig:
.info ${LIBSELINUX}
.info ${BUILTIN_FIND_PKGCONFIG_FILES_VAR}
.info ${USE_TOOLS:Uundefined}

The output of bmake says lines 7, 8, 10, and there is no empty line
between these .info lines, meaning that you didn't post the exact code
you ran.

.if !empty(USE_TOOLS:Mpkg-config)
.  for var in ${BUILTIN_FIND_PKGCONFIG_FILES_VAR}
.    if empty(${var}:M__nonexistent__)
         ${RUN} ${CP} ${${_var_}} ${WRKDIR}/.buildlink/lib/pkgconfig/
.    endif
.  endfor
.endif

The copy command still contains ${_var_} instead of the simpler ${var}.

Instead of the 'if empty', you can write the following, which I find
simpler to read, and it is more consistent with the expression in the
line below:

.    if ${${var}} != "__nonexistent__"

Did I already mention that the '.info' lines are evaluated when they are
parsed? For clarity, it would be better to move them above the .PHONY
line, to avoid the misinterpretation that they would be run together
with the ${RUN} lines. Moving the '.info' lines wouldn't change the
behavior though.

The interesting thing is the overall structure of the code:

* At which point do you include find-pkgconfig-files.mk?
* At which point do you evaluate the variables?

I guess that the definition of the copy-base-pkgconfig target is too
early, and that find-pkgconfig-files.mk comes later.

Can you perhaps attach (or send me) the full definition of the package,
to speed up the analysis phase?

On the other hand,
sudo bmake show-var VARNAME=LIBSELINUX gave me the following.

/usr/lib/x86_64-linux-gnu/pkgconfig/libselinux.pc

The show-var target evaluates the variable after all the files have been
parsed. This confirms my hypothesis that you are running the steps in
the wrong order. It has to be:

1. include find-pkgconfig-files.mk
2. define the copy-base-pkgconfig target based on the findings

Roland


Home | Main Index | Thread Index | Old Index