cltw-1.1.4: Setup.hs
#! /usr/bin/env runhaskell
-- Copyright: 2010 Dino Morelli
-- License: BSD3 (see LICENSE)
-- Author: Dino Morelli <dino@ui3.info>
import Control.Monad ( unless )
import Distribution.Simple
import System.FilePath
import System.Posix.Files ( createSymbolicLink, fileExist )
symlinkBinary binary = do
let dest = "bin" </> binary
exists <- fileExist dest
unless exists $ do
let src = ".." </> "dist" </> "build" </> binary </> binary
createSymbolicLink src dest
main = defaultMainWithHooks (simpleUserHooks
{ postBuild = customPostBuild
} )
where
-- Create symlinks in bin to the binaries after build for
-- developer convenience
customPostBuild _ _ _ _ = mapM_ symlinkBinary
[ "cltw" ]