tajmone / polygen-docs

PolyGen Documentation
GNU General Public License v2.0
1 stars 0 forks source link

Switch Downloader to Bash Script and Use Tar #23

Open tajmone opened 4 years ago

tajmone commented 4 years ago

Convert the dependencies downloader script from batch to Bash script, so we can leverage the curl and tar tools that ship with Git for Windows

With this solution end users won't have to install any dependencies to run the downloader script.

I quick glance into tar seems to confirm that it should support all the archive formats involved, but I need to actually test it against the archives of the dependencies.

Notes

Originally, I though we could keep using a batch script and switch from 7-Zip to Tar, since Windows 10 now ships with native versions of both cURL and Tar (bsdtar, using libarchive).

But as an afterthought, I think it's better to use Bash scripts instead, for various reasons:

References

tajmone commented 4 years ago

Notes on cURL and tar Usage

Some notes and consideration for the various options of using Win10's native cURL and tar for downloading dependencies, compared to use the versions that ship with Git for Windows' Bash.

The obvious advantage of using a bash script is that even non Win10 users would have access to cURL and tar, whereas if we use a batch script only Win10 users would have these tools pre-installed.

The choice here boils down to the assumption that Windows end users of this repository will have installed Git, so they'll have access to Bash for Windows and its tools, regardless of the Windows edition.

I think that switching the download script from a batch script to a shell script is a good idea, and that it's safe to assume that users willing to build the docs locally will be developers who have installed Git anyways.

Win cURL Notes

The cURL version that ships natively with Win 10:

> curl --version
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: 2017-11-14, security patched: 2019-11-05
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL

Bash for Win's cURL

Git for Windows includes its own cURL version, which is available in its Bash:

$ curl --version
curl 7.71.1 (x86_64-w64-mingw32) libcurl/7.71.1 OpenSSL/1.1.1g (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libssh2/1.9.0 nghttp2/1.41.0
Release-Date: 2020-07-01
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS brotli HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz Metalink MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP

It clearly supports more protocols and features than the MS version, and it's also a more recent version.

The binary is located in %PROGRAMFILES%\Git\mingw64\bin\curl.exe.

Win Tar Notes

The tar version that ships natively with Win 10:

> tar --version
bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp

Bash for Win's Tar

Git for Windows includes its own tar version, which is available in its Bash:

$ tar --version
tar (GNU tar) 1.32
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

The binary is located in %PROGRAMFILES%\Git\usr\bin\tar.exe.