A common task to use Cabal for is to install binary packages. In order not to pollute the global package space, this is often done in a sandbox. This small script automates this process for packages that support it.
More accurately, the script does the following:
- Create a temporary directory
- Initialize a Cabal sandbox
- Build the desired binaries. Link statically, build with minimal profiling overhead (no profiling, no shared libs, no Haddock).
- Install the binaries to
$HOME/.cabal/bin
- Delete temporary directory
cabal-install-bin (package)+
This process does obviously only work for relocatable binaries. The most common non-relocatable types of binaries are dynamically linked ones and those that need external data files. That said, many binaries I've installed for myself over the years were relocatable. Check whether the process worked after building!
Program | --version |
package name |
---|---|---|
C2Hsc | 0.6.4 | c2hsc-0.6.5 |
Cabal | 1.22.0.0 | cabal-install-1.22.0.0 |
GHC Core | n/a | ghc-core-0.5.6 |
HLint | 1.9.15 | hlint-1.9.15 |
HsColour | 1.20 | hscolour-1.20.3 |
Pandoc | 1.13.2 | pandoc-1.13.2 |
These programs were unsuccessfully built in the past, but due to multiple patches in the meantime they might work as intended now. I'll gladly take user reports on success or failure.
Program | package name | Problem |
---|---|---|
Alex | alex-3.1.4 | (may work, needs testing) |
Happy | happy-1.19.5 | (Reported to work on OSX with GHC 7.8.3) |