Thunk 主要帮你做了下面两件事:
注意:Thunk 并不能保证所编译的软件可以成功编译或者编译后正常运行。
下载 VC-LTL5、 YY-Thunks Binary 文件,解压,并添加环境变量:
| Binary | 环境变量 |
|---|---|
| VC-LTL-5.0.8-Beta2-Binary.7z | VC_LTL |
| YY-Thunks-1.0.8-Beta4-Binary.zip | YY_THUNKS |
cargo install thunk
cargo new build_for_xp
cd build_for_xp
thunk --os xp --arch x86 -- --release
cargo new build_for_xp
cd build_for_xp
thunk --os xp --arch x86 --lib -- --release
thunk.exe --help
| 参数 | 说明 | 可能值 |
|---|---|---|
| --os | 系统名称 | xp, vista, win7, win10, 20h1 |
| --arch | 系统架构 | x86, x64, arm64 |
| --lib | 是否为共享库,指定时 subsystem 将被忽略 | - |
| --subsystem | 设置 subsystem | console, windows |
| -- | -- 后面的参数会传到 cargo build 后面 | 自定义 |
注:为了区分 Thunk 编译出来的程序,程序生成在 ./target/*_build 文件夹。
步骤1:确保 curl 和 7z 工具放置在运行目录里(如果设置了 VC_LTL 和 YY_THUNKS 环境变量可省去此步)
步骤2:添加 thunk-rs 依赖:
cargo add thunk-rs --build
步骤3:添加生成脚本 build.rs:
fn main() {
thunk::thunk();
}
不出意外,编程出来程序可以在 XP 上运行,查看 thunk-rs.
- Windows XP x86
- Windows XP x64
- Windows Vista x86
- Windows Vista x64
- Only VC-LTL
- Scoop bucket