pkgsrc-Users archive

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


Am 13.06.2022 um 04:27 schrieb Yosuke Kawasaki:
Hello all,

I am trying to make a makefile fragment like below to manage the copying of
system-provided pkg-config.pc files into  {WRKDIR}/.buildlink/lib/pkgconfig


.include "../../mk/buildlink3/"

.PHONY: copy-base-pkgconfig

If you want to save a line of code, you can write:

copy-base-pkgconfig: .PHONY

During development, you can test whether USE_TOOLS already contains the
word pkg-config:

.info ${USE_TOOLS:Uundefined}
.if !empty(USE_TOOLS:Mpkg-config)

The point is that the '.if' condition is evaluated when the makefile
fragment is parsed, which may be earlier than the line

.if !empty(USE_TOOLS:Mpkg-config)
#       ${RUN} ${ECHO}


Having underscores in the variable name is the traditional form.  Since
2009 they are no longer required.  You can simply use 'var' instead.

         ${RUN} ${ECHO} "Copying base pkgconfig ${_var_}. ${${_var_}}"

.    if empty (${${_var_}}:M__nonexistent__)

The function 'empty' is a little tricky. It requires the _name_ of a
variable, plus optional modifiers.  Instead, you are passing the _value_
here, testing whether the variable named
'/usr/lib/pkg-config/library.pc' contains the word '__nonexistent__'.
You need to remove one pair of braces, and you can remove the space
after 'empty':

.    if empty(${var}:M__nonexistent)

${RUN} ${CP} ${${_var_}} ${WRKDIR}/.buildlink/lib/pkgconfig/

The above line should be indented with a tab.  I guess this is just a
copy-and-paste mistake since otherwise bmake would have complained.

.    endif
.  endfor

(end of code)

When I ran bmake copy-base-pkgconfig, the for loop does not run at all (no

Running a helper target directly often does not work, as the pkgsrc
infrastructure has some tricky parts that rely on running nested 'bmake'

To get realistic results, you should make your test package as small and
fast as possible, so that you can test 'pre-configure:
copy-base-pkgconfig' in the environment where it will later be used.

echo results), even though I confirmed BUILTIN_FIND_PKGCONFIG_FILES_VAR
contains LIBSELINUX, by running bmake show-var

During debugging, you can edit and insert the
following directives:

.MAKEFLAGS: -dc -dp -dv	# debug conditions, parsing, variables
.MAKEFLAGS: -dFstderr	# actually show debug output
.for _var_ in ...
# ...
.MAKEFLAGS: -dF/dev/null # suppress further debug output


Home | Main Index | Thread Index | Old Index