Skip to content

Windows support for haskell_cabal_* and stack_snapshot - #1074

Merged
mergify[bot] merged 8 commits into
masterfrom
stack-windows
Sep 8, 2019
Merged

Windows support for haskell_cabal_* and stack_snapshot#1074
mergify[bot] merged 8 commits into
masterfrom
stack-windows

Conversation

@aherrmann

Copy link
Copy Markdown
Contributor
  • Fix CPU architecture discovery for stack bindist download
  • Give descriptive error message if OS or arch discovery fails
  • stack --> stack.exe on Windows
  • ctx.actions.run doesn't work with bash scripts on Windows, use run_shell instead
  • --enable-relocatable is not supported on Windows
  • The output of haskell_cabal_binary is a .exe file on Windows
  • Provide an alternative libz on Windows where nixpkgs is not available
  • Test haskell_cabal_library|binary and stack_snapshot on Windows CI

- The stack binary is called `stack.exe` on Windows.
- We cannot assume that `uname -m` is available on Windows to determine
    the CPU architecture. We use `reg QUERY` instead, to lookup the
    architecture in the registry.
- If the OS or architecture cannot be determined then fetching the stack
    bindist will fail. We add descriptive error messages for this case.
`ctx.actions.run` with `executable = cabal_wrapper` fails on Windows:

    java.io.IOException: ERROR: src/main/native/windows/process.cc(184):
      CreateProcessW("...\cabal_wrapper-XYZ.sh" ...):
        %1 is not a valid Win32 application

The problem is that the generated file is a bash script, not an `.exe`.

This change uses `run_shell` instead, which supports executing bash
scripts on Windows.
```
Setup.hs: Operating system: windows, does not support relocatable builds
```
So far zlib was only provisioned through nixpkgs, which is not available
on Windows. This adds a version built from source using Bazel.
@mboes mboes added the merge-queue merge on green CI label Sep 8, 2019
@mergify
mergify Bot merged commit 81e6b3a into master Sep 8, 2019
@mergify
mergify Bot deleted the stack-windows branch September 8, 2019 15:19
@mergify mergify Bot removed the merge-queue merge on green CI label Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants