-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.hs
More file actions
29 lines (22 loc) · 747 Bytes
/
Setup.hs
File metadata and controls
29 lines (22 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
import System.Directory
import System.Exit
import System.FilePath
main = defaultMainWithHooks simpleUserHooks
{ postInst = installEco
}
installEco :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
installEco _ _ _ _ = do
home <- getHomeDirectory
mapM_ (createDirectoryIfMissing True . (ecosystem home </>))
["bin", "lib"]
copyFile eco (toEco home)
from <- getPermissions (toEco home)
setPermissions (toEco home) (from { executable = True })
where
ecosystem h = h </> ".eco"
eco = "bin" </> "eco"
toEco h = ecosystem h </> eco