On 28/05/2021 17:06, Brian Inglis wrote:
On 2021-05-26 13:06, Jon Turney wrote:
Since variables in a .cygport file can be computed from arbitrary shell
expressions, perhaps containing variables that cygport itself defines,
other programs can't determine their value just by parsing the .cygport
file.
Add 'vars' command to output arbitrary variables defined by the .cygport
file.
The idea is that the output from this should be eval-able in a shell to
be further used, but it probably needs some additional escaping (of
newlines?) to be completely right in all cases.
e.g
$ cygport libX11.cygport vars PVR BUILD_REQUIRES
PVR='1.7.1-1'
BUILD_REQUIRES='xtrans xorgproto libxcb-devel xmlto
xorg-sgml-doctools docbook-xml43'
eval $(cygport libX11.cygport vars BUILD_REQUIRES) ; for r in
${BUILD_REQUIRES} ; do echo $r; done
bash "declare -p NAME..." seems to do what you want and produce
.source-able output:
$ ( . mingw64-x86_64-nghttp2/mingw64-x86_64-nghttp2.cygport; declare -p
BUILD_REQUIRES DESCRIPTION; echo echo \$BUILD_REQUIRES \$DESCRIPTION) |
bash -svx
Yeah, I should probably use 'declare -p'.
But just sourcing the .cygport is not adequate, as this can't determine
variables which are generated by cygport itself (e.g. VR, 'inherit' for
some cygclasses sets ARCH=noarch, etc.)