|
| 1 | +# Releases and distributable binaries |
| 2 | + |
| 3 | +Starting with 0.3.0.0 haskell-language-server provides pre-built binaries on |
| 4 | +each [GitHub |
| 5 | +release](https://github.com/haskell/haskell-language-server/releases). These |
| 6 | +binaries are used by the [vscode-hie-server |
| 7 | +extension](https://github.com/alanz/vscode-hie-server) to provide automatic |
| 8 | +installation for users on VS Code, but they can also be installed manually |
| 9 | +when added to the path. |
| 10 | + |
| 11 | +## Making a new release of haskell-language-server |
| 12 | + |
| 13 | +Go to the [GitHub releases |
| 14 | +page](https://github.com/haskell/haskell-language-server/releases) for |
| 15 | +haskell-language-server and start to create a new release. Choose or create a |
| 16 | +tag, fill out the release notes etc., but before you create it |
| 17 | +**make sure to check the pre-release checkbox**. This will prevent VS Code |
| 18 | +*extension |
| 19 | +users from attempting to install this version before the binaries are |
| 20 | +created. |
| 21 | + |
| 22 | +Once the release is created the [GitHub Actions |
| 23 | +workflow](https://github.com/haskell/haskell-language-server/actions) will be |
| 24 | +kicked off and will start creating binaries. They will be gzipped and |
| 25 | +uploaded to the release. |
| 26 | + |
| 27 | +It creates a `haskell-language-server-OS-GHC` binary for each platform |
| 28 | +(Linux, macOS, Windows) and each GHC version that we currently support, as well |
| 29 | +as a `haskell-language-server-wrapper-OS` binary for each platform. Note that |
| 30 | +only one wrapper binary is created per platform, and it should be built with the |
| 31 | +most recent GHC version. |
| 32 | + |
| 33 | +Once all these binaries are present |
| 34 | + |
| 35 | +## Distributable binaries |
| 36 | +In order to compile a hls binary on one machine and have it run on another, you |
| 37 | +need to make sure there are **no hardcoded paths or data-files**. |
| 38 | + |
| 39 | +### ghc libdir |
| 40 | +One noteable thing which cannot be hardcoded is the **GHC libdir** – this is |
| 41 | +a path to `/usr/local/lib/ghc` or something like that, which was previously |
| 42 | +baked in at compile-time with ghc-paths. Note that with static binaries we |
| 43 | +can no longer use this because the GHC libdir of the GitHub Actions machine |
| 44 | +will most almost certainly not exist on the end user's machine. |
| 45 | +Therefore, hie-bios provides `getGhcRuntimeLibDir` to obtain this path on the fly |
| 46 | +by consulting the cradle. |
| 47 | + |
| 48 | +### Static binaries |
| 49 | +We use the word "distributable" here because technically only the Linux builds |
| 50 | +are static. They are built by passing `--enable-executable-static` to cabal. |
| 51 | +Static binaries don't really exist on macOS, and there are issues with |
| 52 | +proprietary code being linked in on Windows. However, the `.dylib`s linked on |
| 53 | +macOS are all already provided by the system: |
| 54 | + |
| 55 | +``` |
| 56 | +$ objdump -macho --dylibs-used haskell-language-server |
| 57 | +haskell-language-server: |
| 58 | + /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) |
| 59 | + /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) |
| 60 | + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1) |
| 61 | + /usr/lib/libcharset.1.dylib (compatibility version 2.0.0, current version 2.0.0) |
| 62 | +``` |
| 63 | + |
| 64 | +## The GitHub Actions workflow |
| 65 | +It just kicks off a matrix of jobs varying across GHC versions and OSs, building |
| 66 | +the binaries with Cabal and extracting them from the dist-newstyle directory. |
| 67 | +The binaries are built with -O2. |
| 68 | + |
| 69 | +One caveat is that we need to rename the binaries from |
| 70 | +haskell-language-server/haskell-language-server-wrapper to hls/hls-wrapper due to |
| 71 | +path length limitations on windows. But whenever we upload them to the release, |
| 72 | +we make sure to upload them as their full name variant. |
0 commit comments