feat(cross-compile): add cross-compilation support with --target flag, friendly target aliases, and automatic rustup target installation
This commit is contained in:
36
readme.md
36
readme.md
@@ -83,6 +83,42 @@ Run `cargo clean` before building to force a full rebuild:
|
||||
tsrust --clean
|
||||
```
|
||||
|
||||
### Cross-Compilation
|
||||
|
||||
Cross-compile for different OS/architecture combinations using the `--target` flag:
|
||||
|
||||
```bash
|
||||
# Cross-compile for a single target
|
||||
tsrust --target linux_arm64
|
||||
|
||||
# Cross-compile for multiple targets
|
||||
tsrust --target linux_arm64 --target linux_amd64
|
||||
|
||||
# Full Rust triples are also accepted
|
||||
tsrust --target aarch64-unknown-linux-gnu
|
||||
```
|
||||
|
||||
Supported friendly target names:
|
||||
|
||||
| Friendly name | Rust target triple |
|
||||
|---|---|
|
||||
| `linux_amd64` | `x86_64-unknown-linux-gnu` |
|
||||
| `linux_arm64` | `aarch64-unknown-linux-gnu` |
|
||||
| `linux_amd64_musl` | `x86_64-unknown-linux-musl` |
|
||||
| `linux_arm64_musl` | `aarch64-unknown-linux-musl` |
|
||||
| `macos_amd64` | `x86_64-apple-darwin` |
|
||||
| `macos_arm64` | `aarch64-apple-darwin` |
|
||||
|
||||
When using `--target`, output binaries are named `<binname>_<os>_<arch>`:
|
||||
|
||||
```
|
||||
dist_rust/
|
||||
├── rustproxy_linux_arm64
|
||||
└── rustproxy_linux_amd64
|
||||
```
|
||||
|
||||
`tsrust` automatically installs missing rustup targets via `rustup target add` when needed.
|
||||
|
||||
### 🗑️ Clean Only
|
||||
|
||||
Remove all build artifacts without rebuilding:
|
||||
|
||||
Reference in New Issue
Block a user