packages feed

uacpid 0.0.3 → 0.0.4

raw patch · 3 files changed

+43/−17 lines, 3 filessetup-changed

Files

Setup.hs view
@@ -7,34 +7,55 @@ import Control.Monad import Distribution.Simple import Distribution.Simple.LocalBuildInfo+import Distribution.Simple.Setup import System.Cmd import System.Directory import System.Exit import System.FilePath  -copyManPage _ _ _ localBuildInfo = do-   -- Construct src and dest dirs for copying the man page-   let manFile = "uacpid.1"-   let srcPath = "resources" </> "man" </> manFile+copyManDestDir :: CopyFlags -> LocalBuildInfo -> FilePath+copyManDestDir copyFlags localBuildInfo = destDir+   where+      Flag (CopyTo copyPrefix) = copyDest copyFlags -   {- 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+      instPrefix = fromPathTemplate $ prefix          $ installDirTemplates localBuildInfo-   let destDir =-         prefixDir </> "share" </> "man" </> "man1" +      {- Can't use </> here because instPrefix is often absolute+         and </> returns the second path if ALONE if it's absolute.+         Safer to just have the extra / if that's how it goes.+      -}+      destDir = copyPrefix ++ "/" ++ instPrefix+         </> "share" </> "man" </> "man1"+++instManDestDir :: LocalBuildInfo -> FilePath+instManDestDir localBuildInfo = destDir+   where+      {- 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.+      -}+      instPrefix = fromPathTemplate $ prefix+         $ installDirTemplates localBuildInfo++      destDir = instPrefix </> "share" </> "man" </> "man1"+++copyManPage :: FilePath -> IO ()+copyManPage destDir = do+   -- Construct src dir for copying the man page+   let manFile = "uacpid.1"+   let srcPath = "resources" </> "man" </> manFile+    createDirectoryIfMissing True destDir     putStrLn $ "Installing man page in " ++ destDir     let destPath = destDir </> manFile -   -- Copy it to the appropriate man directory, based on the-   -- prefix+   -- Copy it to the appropriate man directory    copyFile srcPath destPath     -- gzip the man page@@ -47,6 +68,11 @@   main = defaultMainWithHooks (simpleUserHooks -   { postCopy = copyManPage-   , postInst = copyManPage+   { postCopy = customPostCopy+   , postInst = customPostInst    } )+   where+      customPostCopy _ copyFlags _ localBuildInfo =+         copyManPage (copyManDestDir copyFlags localBuildInfo)+      customPostInst _ _ _ localBuildInfo =+         copyManPage (instManDestDir localBuildInfo)
src/main.hs view
@@ -167,7 +167,7 @@       , ""       , "Please see man uacpid for detailed info"       , ""-      , "Version 0.0.3  2009-Jul-15  Dino Morelli <dino@ui3.info>"+      , "Version 0.0.4  2009-Jul-19  Dino Morelli <dino@ui3.info>"       ]     exitWith ExitSuccess
uacpid.cabal view
@@ -1,5 +1,5 @@ name:                uacpid-version:             0.0.3+version:             0.0.4 cabal-version:       >= 1.2 build-type:          Simple license:             BSD3