Switch the sfx installer to zstandard
Using a 7zip fork with zstandard support: https://github.com/mcmilk/7-Zip-zstd Saves 20% CPU when extracting, also uses ~50MB less peak memory. Downside is a 5% larger installer.
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
_cache
|
||||
*.exe
|
||||
*.xz
|
||||
28
create-sfx.sh
Normal file
28
create-sfx.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# usage: ./create-sfx.sh /some/path/to/msys64 installer.exe
|
||||
|
||||
set -e
|
||||
|
||||
# Download and extract https://github.com/mcmilk/7-Zip-zstd
|
||||
NAME="7z21.03-zstd-x64"
|
||||
CHECKSUM="531b20dfb03d8f30f61ae56a181610bbb6f3cf7cc71dac1d8f95511289de76f3"
|
||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
mkdir -p "$DIR/_cache"
|
||||
BASE="$DIR/_cache/$NAME"
|
||||
if [ ! -f "$BASE.exe" ]; then
|
||||
curl --fail -L "https://github.com/mcmilk/7-Zip-zstd/releases/download/v21.03-v1.5.0-R2/$NAME.exe" -o "$BASE.exe"
|
||||
fi
|
||||
echo "$CHECKSUM $BASE.exe" | sha256sum --quiet --check
|
||||
if [ ! -d "$BASE" ]; then
|
||||
7z e -o"$BASE" "$DIR/_cache/$NAME.exe"
|
||||
fi
|
||||
|
||||
# Creat SFX installer
|
||||
INPUT="$1"
|
||||
OUTPUT="$2"
|
||||
TEMP="$OUTPUT.payload"
|
||||
|
||||
rm -f "$TEMP"
|
||||
"$BASE/7z" a "$TEMP" -ms1T -m0=zstd -mx22 "$INPUT"
|
||||
cat "$BASE/7zCon.sfx" "$TEMP" > "$OUTPUT"
|
||||
rm "$TEMP"
|
||||
10
fetch-sfx.sh
10
fetch-sfx.sh
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Fetch 7zCon.sfx from upstream 7-zip
|
||||
curl "https://www.7-zip.org/a/7z1900.exe" -o 7z1900.exe
|
||||
echo "759aa04d5b03ebeee13ba01df554e8c962ca339c74f56627c8bed6984bb7ef80 7z1900.exe" | sha256sum --check
|
||||
7z x -o7zout 7z1900.exe
|
||||
cp 7zout/7zCon.sfx .
|
||||
rm -Rf 7zout 7z1900.exe
|
||||
@@ -85,9 +85,7 @@ create_archives() {
|
||||
fi
|
||||
|
||||
# self extracting cli 7z archive
|
||||
7z a -mx=9 "${_thisdir}/_temp.7z" "msys${_bitness}"
|
||||
cat ${_thisdir}/7zCon.sfx "${_thisdir}/_temp.7z" > "${_thisdir}/${_filename3}"
|
||||
rm "${_thisdir}/_temp.7z"
|
||||
"${_thisdir}/create-sfx.sh" "msys${_bitness}" "${_thisdir}/${_filename3}"
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user