mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-03 16:30:29 +00:00
use runtime-built sha256sum
This commit is contained in:
parent
cacfecc92d
commit
617a408ae7
1 changed files with 7 additions and 23 deletions
|
@ -209,31 +209,15 @@ fetch() {
|
||||||
sha256sum() {
|
sha256sum() {
|
||||||
shasum -a 256 "$@"
|
shasum -a 256 "$@"
|
||||||
}
|
}
|
||||||
else
|
elif command -v "$PWD/o/build/sha256sum" >/dev/null 2>&1; then
|
||||||
if [ ! -f build/sha256sum.c ]; then
|
# should have been built by download-cosmocc.sh if a system
|
||||||
printf '%s\n' "$0: fatal error: you need to install sha256sum" >&2
|
# sha256sum/shasum does not exist
|
||||||
printf '%s\n' "please download https://cosmo.zip/pub/cosmos/bin/sha256sum and put it on the system path" >&2
|
|
||||||
abort
|
|
||||||
fi
|
|
||||||
if ! SHA256SUM=$(command -v "$PWD/o/build/sha256sum" 2>/dev/null); then
|
|
||||||
if ! CC=$(command -v "$CC" 2>/dev/null); then
|
|
||||||
if ! CC=$(command -v cc 2>/dev/null); then
|
|
||||||
if ! CC=$(command -v cosmocc 2>/dev/null); then
|
|
||||||
printf '%s\n' "$0: fatal error: you need to install either sha256sum, cc, or cosmocc" >&2
|
|
||||||
printf '%s\n' "please download https://cosmo.zip/pub/cosmos/bin/sha256sum and put it on the system path" >&2
|
|
||||||
abort
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
mkdir -p o/build || abort
|
|
||||||
SHA256SUM="$PWD/o/build/sha256sum"
|
|
||||||
printf '%s\n' "${CC} -w -O2 -o ${SHA256SUM} build/sha256sum.c" >&2
|
|
||||||
"${CC}" -w -O2 -o "${SHA256SUM}.$$" build/sha256sum.c || abort
|
|
||||||
mv -f "${SHA256SUM}.$$" "${SHA256SUM}" || abort
|
|
||||||
fi
|
|
||||||
sha256sum() {
|
sha256sum() {
|
||||||
"${SHA256SUM}" "$@"
|
"$PWD/o/build/sha256sum" "$@"
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
echo please install sha256sum >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
filename=$(basename $1)
|
filename=$(basename $1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue