]> wimlib.net Git - wimlib/blob - tools/repack-windows-release.sh
libFuzzer: add encoding fuzzer
[wimlib] / tools / repack-windows-release.sh
1 #!/bin/bash
2 #
3 # This script takes in the path to a windows-CLANGARM64-bin artifact downloaded
4 # from GitHub Actions, which lacks the PDF documentation and has the wrong file
5 # layout, and packs it up into a releasable zip file.  Assumes that an x86_64
6 # zip built from the same commit already exists locally.
7
8 set -e -u
9
10 usage()
11 {
12         echo 1>&2 "Usage: $0 windows-CLANGARM64-bin.zip"
13         exit 1
14 }
15
16 [ $# -eq 1 ] || usage
17
18 tmpdir=$(mktemp -d)
19 trap 'rm -rf "$tmpdir"' EXIT
20
21 ZIP_FROM_GITHUB=$1
22 unzip -q -d "$tmpdir" "$ZIP_FROM_GITHUB"
23 DESTDIR=$(basename "$(echo "$tmpdir"/*)")
24 rm -rf "$DESTDIR" "$DESTDIR.zip"
25 cp -a "$tmpdir/$DESTDIR" "$DESTDIR"
26 prefix=$(echo "$DESTDIR" | grep -o 'wimlib.*windows')
27 cp -a "${prefix}-x86_64-bin/doc" "$DESTDIR/doc"
28 chmod +x "$DESTDIR"/*.{dll,exe,cmd}
29 cd "$DESTDIR"
30 7z -mx9 a ../"$DESTDIR.zip" . > /dev/null
31 cd ..
32 echo "Success!  Output is in $DESTDIR.zip"