@@ -18,12 +18,12 @@ if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then
1818 exit 1
1919fi
2020
21- # Update this when updating to a new version after verifying that the changes
22- # the update brings in are good. The ref can be a commit hash or a release tag
23- # (e.g. "v3.6.0"); mimalloc v3.6 has not been released yet, so this is a commit
24- # on the dev3 branch .
25- expected_mimalloc_ref= " caaf3bc41494e6b58ab32ed9c851b3c8b61a8f82 "
26- expected_mimalloc_sha256=" d6bed4bad2fe8aea63f4ab25cabce5275aef6f2f9386266ff686ceb1eabe15bb "
21+ # Update these when updating to a new version after verifying that the changes
22+ # the update brings in are good. The tag must be a mimalloc release with a
23+ # mimalloc-<tag>-source.tar.gz asset; the SHA-256 is listed next to the asset
24+ # on the GitHub release page .
25+ expected_mimalloc_tag= " v3.6.0 "
26+ expected_mimalloc_sha256=" 05b45988f07a940831ad156f10b0aeb84805b1f030004488939efe08f718b4c7 "
2727
2828objects_dir=" $( realpath " $( dirname -- " ${BASH_SOURCE[0]} " ) " ) "
2929cpython_dir=" $( realpath " $objects_dir /../.." ) "
@@ -35,7 +35,7 @@ trap 'rm -rf "$tmp_dir"' EXIT
3535
3636# Step 1: download and verify the mimalloc sources
3737
38- url=" https://github.com/microsoft/mimalloc/archive/ ${expected_mimalloc_ref} .tar.gz"
38+ url=" https://github.com/microsoft/mimalloc/releases/download/ ${expected_mimalloc_tag} /mimalloc- ${expected_mimalloc_tag} -source .tar.gz"
3939curl --fail --location " $url " > " $tmp_dir /mimalloc.tar.gz"
4040actual_sha256=$( sha256sum " $tmp_dir /mimalloc.tar.gz" | cut -d' ' -f1)
4141if [[ " $actual_sha256 " != " $expected_mimalloc_sha256 " ]]; then
@@ -46,11 +46,15 @@ if [[ "$actual_sha256" != "$expected_mimalloc_sha256" ]]; then
4646 exit 1
4747fi
4848
49- # The top-level directory in the archive depends on the ref (mimalloc-<hash>
50- # for a commit, mimalloc-<version> for a tag), so strip it .
49+ # The sources may be at the root of the archive or under a single top-level
50+ # directory .
5151mimalloc_dir=" $tmp_dir /mimalloc"
5252mkdir " $mimalloc_dir "
53- tar xzf " $tmp_dir /mimalloc.tar.gz" -C " $mimalloc_dir " --strip-components 1
53+ tar xzf " $tmp_dir /mimalloc.tar.gz" -C " $mimalloc_dir "
54+ top_level=(" $mimalloc_dir " /* )
55+ if [[ ${# top_level[@]} -eq 1 && -d " ${top_level[0]} " ]]; then
56+ mimalloc_dir=" ${top_level[0]} "
57+ fi
5458if [[ ! -f " $mimalloc_dir /src/static.c" || ! -f " $mimalloc_dir /include/mimalloc.h" ]]; then
5559 echo " error: $url does not look like a mimalloc source archive" >&2
5660 exit 1
@@ -92,10 +96,10 @@ if [[ -n "$deep_files" ]]; then
9296 echo " $deep_files " | sed ' s/^/ /' >&2
9397fi
9498
95- echo " Updated mimalloc to ${expected_mimalloc_ref } ."
99+ echo " Updated mimalloc to ${expected_mimalloc_tag } ."
96100echo
97101git status --short -- Objects/mimalloc Include/internal/mimalloc
98102echo
99103echo " Re-apply any changes carried on top of the upstream sources, review the"
100104echo " changes, rebuild, and commit with a message such as:"
101- echo " Update vendored mimalloc to ${expected_mimalloc_ref } "
105+ echo " Update vendored mimalloc to ${expected_mimalloc_tag } "
0 commit comments