Skip to content

Commit faba39d

Browse files
authored
Build Windows binaries statically. (#417)
### What We don't want users to have to install the Visual C++ Redistributable to use the ndc-postgres CLI plugin. ### How We can instruct `rustc` to link statically with the C runtime with the `-C target-feature=+crt-static` flag. See [RFC 1721](https://github.com/rust-lang/rfcs/blob/master/text/1721-crt-static.md) for details.
1 parent 8faf87e commit faba39d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/ship.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ jobs:
131131
- runner: windows-latest
132132
target: x86_64-pc-windows-msvc
133133
extension: .exe
134+
extra-rust-flags: "-C target-feature=+crt-static"
134135
runs-on: ${{ matrix.runner }}
135136
env:
136137
CARGO_BUILD_TARGET: ${{ matrix.target }}
@@ -188,6 +189,12 @@ jobs:
188189
export "CARGO_TARGET_${TARGET_SCREAMING}_LINKER"
189190
fi
190191
192+
if [[ -n '${{ matrix.extra-rust-flags }}' ]]; then
193+
RUSTFLAGS="${RUSTFLAGS} ${{ matrix.extra-rust-flags }}"
194+
export RUSTFLAGS
195+
fi
196+
echo "RUSTFLAGS = ${RUSTFLAGS}"
197+
191198
echo "Building for target: ${CARGO_BUILD_TARGET}"
192199
cargo build --release --package=ndc-postgres-cli
193200

changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
- Fix schema conflict result_type for native query mutations.
2323
([#405](https://github.com/hasura/ndc-postgres/pull/405))
24+
- The CLI plugin no longer requires the Visual C++ Redistributable on Windows.
25+
([#417](https://github.com/hasura/ndc-postgres/pull/417))
2426

2527
## [v0.5.2] - 2024-03-29
2628

0 commit comments

Comments
 (0)