[PATCH cygport] Add 'vars' command to output arbitrary .cygport variables

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Fri May 28 16:06:20 GMT 2021


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
-bash: inherit: command not found
declare -- BUILD_REQUIRES="mingw64-x86_64-c-ares mingw64-x86_64-libevent mingw64-x86_64-win-iconv mingw64-x86_64-libxml2 
mingw64-x86_64-openssl mingw64-x86_64-zlib libev-devel mingw64-x86_64-binutils mingw64-x86_64-CUnit 
mingw64-x86_64-gcc-core mingw64-x86_64-gcc-g++ autoconf automake libtool pkg-config python3-sphinx"
+ declare -- 'BUILD_REQUIRES=mingw64-x86_64-c-ares mingw64-x86_64-libevent mingw64-x86_64-win-iconv 
mingw64-x86_64-libxml2 mingw64-x86_64-openssl mingw64-x86_64-zlib libev-devel mingw64-x86_64-binutils 
mingw64-x86_64-CUnit mingw64-x86_64-gcc-core mingw64-x86_64-gcc-g++ autoconf automake libtool pkg-config python3-sphinx'
declare -- DESCRIPTION="HTTP/2 and its header compression algorithm HPACK implementation.
The framing layer of HTTP/2 is implemented as a reusable library.
Also included are an HTTP/2 client, server, proxy, load test and
benchmarking tool, and Python modules.
Package provides Mingw MS VC RT-linked binaries, NOT Cygwin binaries,
for use with the mingw64-x86_64-gcc cross compiler, installed in
/usr/x86_64-w64-mingw32/sys-root/mingw/{bin,lib,include}/."
+ declare -- 'DESCRIPTION=HTTP/2 and its header compression algorithm HPACK implementation.
The framing layer of HTTP/2 is implemented as a reusable library.
Also included are an HTTP/2 client, server, proxy, load test and
benchmarking tool, and Python modules.
Package provides Mingw MS VC RT-linked binaries, NOT Cygwin binaries,
for use with the mingw64-x86_64-gcc cross compiler, installed in
/usr/x86_64-w64-mingw32/sys-root/mingw/{bin,lib,include}/.'
echo $BUILD_REQUIRES $DESCRIPTION
+ echo mingw64-x86_64-c-ares mingw64-x86_64-libevent mingw64-x86_64-win-iconv mingw64-x86_64-libxml2 
mingw64-x86_64-openssl mingw64-x86_64-zlib libev-devel mingw64-x86_64-binutils mingw64-x86_64-CUnit 
mingw64-x86_64-gcc-core mingw64-x86_64-gcc-g++ autoconf automake libtool pkg-config python3-sphinx HTTP/2 and its header 
compression algorithm HPACK implementation. The framing layer of HTTP/2 is implemented as a reusable library. Also 
included are an HTTP/2 client, server, proxy, load test and benchmarking tool, and Python modules. Package provides 
Mingw MS VC RT-linked binaries, NOT Cygwin binaries, for use with the mingw64-x86_64-gcc cross compiler, installed in 
'/usr/x86_64-w64-mingw32/sys-root/mingw/{bin,lib,include}/.'
mingw64-x86_64-c-ares mingw64-x86_64-libevent mingw64-x86_64-win-iconv mingw64-x86_64-libxml2 mingw64-x86_64-openssl 
mingw64-x86_64-zlib libev-devel mingw64-x86_64-binutils mingw64-x86_64-CUnit mingw64-x86_64-gcc-core 
mingw64-x86_64-gcc-g++ autoconf automake libtool pkg-config python3-sphinx HTTP/2 and its header compression algorithm 
HPACK implementation. The framing layer of HTTP/2 is implemented as a reusable library. Also included are an HTTP/2 
client, server, proxy, load test and benchmarking tool, and Python modules. Package provides Mingw MS VC RT-linked 
binaries, NOT Cygwin binaries, for use with the mingw64-x86_64-gcc cross compiler, installed in 
/usr/x86_64-w64-mingw32/sys-root/mingw/{bin,lib,include}/.

but eval dislikes the "declare --"!

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]


More information about the Cygwin-apps mailing list