thirdparty.zstd: add a runnable update.vsh script

This commit is contained in:
Delyan Angelov 2025-05-31 09:06:41 +03:00
parent b19fa76c6e
commit 4fd405cfb1
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 27 additions and 7 deletions

View File

@ -1,9 +1,7 @@
1. Get `zstd` from https://github.com/facebook/zstd/releases The changes here are produced by modifying `thirdparty/zstd/zstd_v.patch`,
2. Download and extract `zstd`, and goto `zstd-1.5.7/build/single_file_libs/`, run `create_single_file_library.sh` and then running `v thirdparty/zstd/update.vsh` .
3. Copy generated `zstd.c` to v's `thirdparty/zstd/zstd-1.5.7.c`
4. In `thirdparty/zstd/`, apply patch by `patch -p0 -i zstd_v.patch -o zstd.c`
5. Remove `zstd-1.5.7.c`
You can generate a new patch by `diff -u zstd-1.5.7.c zstd_modified.c > zstd_custom.patch` You can generate a new patch by:
`diff -u zstd-1.5.7/build/single_file_libs/zstd.c thirdparty/zstd/zstd.c > zstd_custom.patch`
BTW, patch is between `/* >> v_patch start */` and `/* << v_patch end */` mostly. BTW, patch is between `/* >> v_patch start */` and `/* << v_patch end */` mostly.

22
thirdparty/zstd/update.vsh vendored Executable file
View File

@ -0,0 +1,22 @@
// Use this script to update thirdparty/zstd to a future version of mbedtls.
import os
fn do(cmd string) {
println(cmd)
res := os.system(cmd)
if res != 0 {
panic('failed at: `${cmd}`')
}
}
os.chdir(os.dir(@VEXE))!
version := '1.5.7'
do('rm -rf zstd-${version}*')
do('wget https://github.com/facebook/zstd/releases/download/v${version}/zstd-${version}.tar.gz')
do('tar -xf zstd-${version}.tar.gz')
do('pushd .; cd zstd-${version}/build/single_file_libs/; ./create_single_file_library.sh; popd')
do('cp zstd-${version}/build/single_file_libs/zstd.c thirdparty/zstd/zstd.c')
do('pushd .; cd thirdparty/zstd/; patch --verbose --unified -p0 --input zstd_v.patch; popd')
do('rm -rf zstd-${version}*')
println('DONE')

View File

@ -1,4 +1,4 @@
--- zstd-1.5.7.c 2025-05-30 16:39:46.374765970 +0800 --- zstd.c 2025-05-30 16:39:46.374765970 +0800
+++ zstd.c 2025-05-30 21:02:30.710831777 +0800 +++ zstd.c 2025-05-30 21:02:30.710831777 +0800
@@ -50,6 +50,27 @@ @@ -50,6 +50,27 @@
/* TODO: Can't amalgamate ASM function */ /* TODO: Can't amalgamate ASM function */