Copyright | (c) Duncan Coutts 2008 |
---|---|
License | BSD-like |
Maintainer | cabal-devel@haskell.org |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Managing installing binaries with symlinks.
Synopsis
- symlinkBinaries :: Platform -> Compiler -> OverwritePolicy -> ConfigFlags -> InstallFlags -> InstallPlan -> BuildOutcomes -> IO [(PackageIdentifier, UnqualComponentName, FilePath)]
- symlinkBinary :: OverwritePolicy -> FilePath -> FilePath -> FilePath -> String -> IO Bool
- trySymlink :: Verbosity -> IO Bool
- promptRun :: String -> IO Bool -> IO Bool
Documentation
symlinkBinaries :: Platform -> Compiler -> OverwritePolicy -> ConfigFlags -> InstallFlags -> InstallPlan -> BuildOutcomes -> IO [(PackageIdentifier, UnqualComponentName, FilePath)] Source #
We would like by default to install binaries into some location that is on
the user's PATH. For per-user installations on Unix systems that basically
means the ~bin
directory. On the majority of platforms the ~bin
directory will be on the user's PATH. However some people are a bit nervous
about letting a package manager install programs into ~bin
.
A compromise solution is that instead of installing binaries directly into
~bin
, we could install them in a private location under ~.cabalbin
and then create symlinks in ~bin
. We can be careful when setting up the
symlinks that we do not overwrite any binary that the user installed. We can
check if it was a symlink we made because it would point to the private dir
where we install our binaries. This means we can install normally without
worrying and in a later phase set up symlinks, and if that fails then we
report it to the user, but even in this case the package is still in an OK
installed state.
This is an optional feature that users can choose to use or not. It is controlled from the config file. Of course it only works on POSIX systems with symlinks so is not available to Windows users.
:: OverwritePolicy | Whether to force overwrite an existing file |
-> FilePath | The canonical path of the public bin dir eg
|
-> FilePath | The canonical path of the private bin dir eg
|
-> FilePath | The name of the executable to go in the public bin
dir, eg |
-> String | The name of the executable to in the private bin
dir, eg |
-> IO Bool | If creating the symlink was successful. |
Symlink binary.
The paths are take in pieces, so we can make relative link when possible.