-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup.hs
29 lines (23 loc) · 1.09 KB
/
Setup.hs
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
-- Workaround around http://hackage.haskell.org/trac/hackage/ticket/48
-- 2. The .chi files need to be installed
import Distribution.Simple
import Distribution.Simple.Setup
import Distribution.PackageDescription
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Utils
import Distribution.Verbosity
import System.FilePath
main = defaultMainWithHooks $ simpleUserHooks
{ postCopy = postCopyChi,
postInst = postInstChi
}
getLibDir :: PackageDescription -> LocalBuildInfo -> String
getLibDir pd lbi = libdir (absoluteInstallDirs pd lbi NoCopyDest)
copyChiFiles :: String -> LocalBuildInfo -> IO ()
copyChiFiles destLibDir lbi =
installOrdinaryFiles deafening destLibDir [(buildDir lbi, "Text/Antlrc/Lexer.chi")]
postCopyChi :: Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()
postCopyChi _ cflags pd lbi =
copyChiFiles ((\(CopyTo copyDest) -> copyDest) (fromFlag (copyDest cflags)) ++ tail (getLibDir pd lbi)) lbi
postInstChi :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
postInstChi _ _ pd lbi = copyChiFiles (getLibDir pd lbi) lbi