Skip to content

Commit

Permalink
Build Windows binaries statically. (#417)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
SamirTalwar authored Apr 10, 2024
1 parent 8faf87e commit faba39d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ship.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
- runner: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe
extra-rust-flags: "-C target-feature=+crt-static"
runs-on: ${{ matrix.runner }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
Expand Down Expand Up @@ -188,6 +189,12 @@ jobs:
export "CARGO_TARGET_${TARGET_SCREAMING}_LINKER"
fi
if [[ -n '${{ matrix.extra-rust-flags }}' ]]; then
RUSTFLAGS="${RUSTFLAGS} ${{ matrix.extra-rust-flags }}"
export RUSTFLAGS
fi
echo "RUSTFLAGS = ${RUSTFLAGS}"
echo "Building for target: ${CARGO_BUILD_TARGET}"
cargo build --release --package=ndc-postgres-cli
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

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

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

Expand Down

0 comments on commit faba39d

Please sign in to comment.