Win64Depends.sh: verify package checksums

Now the script has nearly reached feature parity with Win32Depends.sh,
though it can't be easily run on Windows.
This commit is contained in:
Přemysl Eric Janouch 2021-10-21 21:35:12 +02:00
parent 8ac267c8db
commit 95f53863ec
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 15 additions and 10 deletions

View File

@ -1,20 +1,20 @@
#!/bin/sh -e
# Win64Depends.sh: download dependencies from MSYS2 for cross-compilation
# Dependencies: AWK, sed, cURL, bsdtar, wine64
# Dependencies: AWK, sed, sha256sum, cURL, bsdtar, wine64
repository=https://repo.msys2.org/mingw/mingw64/
status() {
echo "$(tput bold)-- $*$(tput sgr0)"
}
# TODO: Try to verify checksums, it will be relatively low-effort.
dbsync() {
status Fetching repository DB
[ -f db.tsv ] || curl -# "$repository/mingw64.db" | bsdtar -xOf- | awk '
function flush() { print f["%NAME%"] f["%FILENAME%"] f["%DEPENDS%"] }
NR > 1 && $0 == "%FILENAME%" { flush(); for (i in f) delete f[i] }
{ if (/^[^%]/) f[field] = f[field] $0 "\t"; else field = $0 }
END { flush() }
!/^[^%]/ { field = $0; next } { f[field] = f[field] $0 "\t" }
field == "%SHA256SUM%" { path = "*packages/" f["%FILENAME%"]
sub(/\t$/, "", path); print $0, path > "db.sums" } END { flush() }
' > db.tsv
}
@ -23,13 +23,10 @@ fetch() {
mkdir -p packages
awk -F'\t' 'function get(name, i, a) {
if (visited[name]++ || !(name in filenames)) return
print filenames[name]
split(deps[name], a)
for (i in a) get(a[i])
print filenames[name]; split(deps[name], a); for (i in a) get(a[i])
} BEGIN { while ((getline < "db.tsv") > 0) {
filenames[$1] = $2; deps[$1] = ""
for (i = 3; i <= NF; i++) { gsub(/[<=>].*/, "", $i)
deps[$1] = deps[$1] $i FS }
filenames[$1] = $2; deps[$1] = ""; for (i = 3; i <= NF; i++) {
gsub(/[<=>].*/, "", $i); deps[$1] = deps[$1] $i FS }
} for (i = 0; i < ARGC; i++) get(ARGV[i]) }' "$@" | while IFS= read -r name
do
status Fetching "$name"
@ -37,6 +34,11 @@ fetch() {
done
}
verify() {
status Verifying checksums
sha256sum --ignore-missing --quiet -c db.sums
}
extract() {
status Extracting packages
for subdir in *
@ -62,8 +64,11 @@ cd win32-depends
dbsync
fetch mingw-w64-x86_64-gtk3 mingw-w64-x86_64-lua \
mingw-w64-x86_64-libwinpthread-git # because we don't do "provides"?
verify
extract
configure
status Success
# XXX: Why is this override needed to run some GLib-based things under wine64?
export XDG_DATA_DIRS=$(pwd)/share