-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Provides the SHA1 hash of the program executable -- -- See README.md @package executable-hash @version 0.1.1.1 -- | Internals related to reading and writing an injected executable hash. module System.Executable.Hash.Internal -- | Yields a Just value of a hash which has been injected into the -- executable via injectExecutableHash. injectedExecutableHash :: Maybe ByteString -- | Given the path to an executable, computes its hash and injects it into -- the binary, such that when that program demands the value of -- injectedExecutableHash, it yields a Just value. -- -- See the documentation in System.Executable.Hash for an example -- of how to use this with a cabal postBuild hook injectExecutableHash :: FilePath -> IO () -- | Injects an executable hash into the specified binary. If it doesn't -- exist, then this prints a message to stdout indicating that it failed -- to inject the hash. maybeInjectExecutableHash :: FilePath -> IO () -- | This module provides functions for accessing or computing a SHA1 hash -- of the program's executable. Most users are expected to use the -- executableHash function. -- -- To inject the hash into the executable, you can use the -- inject-executable-hash program installed along with this -- package. Alternatively, to do this automatically with cabal, place -- this in your Setup.hs: -- --
-- import Distribution.Simple
-- import System.Executable.Hash.Internal (maybeInjectExecutableHash)
--
-- main :: IO ()
-- main = defaultMainWithHooks $ simpleUserHooks
-- { postBuild = _ _ _ _ ->
-- maybeInjectExecutableHash "dist/build/path-to/your-executable"
-- }
--
--
-- (Note: you'll need to change the executable path)
module System.Executable.Hash
-- | If a SHA1 hash of the executable has been injected into it, then it's
-- directly yielded by this function. Otherwise, a hash is computed with
-- computeExecutableHash.
--
-- Note that you shouldn't rely on the result being the actual SHA1 hash
-- of the executable, because injecting the hash modifies the binary, and
-- so changes the result of computeExecutableHash. Instead, this
-- should only be used as a way to uniquely identify the contents of the
-- executable.
--
-- This yields Nothing when run with runhaskell or
-- ghci.
executableHash :: IO (Maybe ByteString)
-- | Computes the SHA1 hash of the program executable.
--
-- This yields Nothing when run with runhaskell or
-- ghci.
computeExecutableHash :: IO (Maybe ByteString)