#! /usr/bin/env runhaskell -- Copyright: 2009 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli import Distribution.Simple import Distribution.Simple.LocalBuildInfo import System.Cmd import System.Directory import System.Exit import System.FilePath main = defaultMainWithHooks (simpleUserHooks { postInst = customPostInstall } ) where customPostInstall _ _ _ localBuildInfo = do -- Construct src and dest dirs for copying the man page let manFile = "uacpid.1" let srcPath = "resources" "man" manFile {- There's a "right way" to get the absolute mandir FilePath from the Cabal API, but I can't figure it out yet. Have to revisit someday. -} let prefixDir = fromPathTemplate $ prefix $ installDirTemplates localBuildInfo let destDir = prefixDir "share" "man" "man1" createDirectoryIfMissing True destDir let destPath = destDir manFile -- Copy it to the appropriate man directory, based on the -- prefix copyFile srcPath destPath -- gzip the man page gzipExitCode <- system $ "gzip -f " ++ destPath exitWith gzipExitCode