Uh oh!
There was an error while loading. Please reload this page.
forked from Eelis/geordi
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSetup.hs
More file actions
Latest commit
executable file
·26 lines (23 loc) · 1.26 KB
/
Copy pathSetup.hs
File metadata and controls
executable file
·26 lines (23 loc) · 1.26 KB
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
#! /usr/bin/env runhaskell
importDistribution.Simple
importDistribution.Simple.Setup (ConfigFlags, InstallFlags)
importDistribution.PackageDescription (PackageDescription(..))
importDistribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
importDistribution.Simple.InstallDirs (initialPathTemplateEnv, prefix, bindir, datadir, datasubdir, fromPathTemplate, installDirsTemplateEnv, packageTemplateEnv, substPathTemplate)
importSystem.Posix.Files (setFileMode, ownerModes)
main::IO()
main = defaultMainWithHooks $ autoconfUserHooks { postInst = myPostInst }
myPostInst::Args->InstallFlags->PackageDescription->LocalBuildInfo->IO()
myPostInst args flags pkg_descr lbi =do
(pre, _:post) <-fmap (span (/="DATA=\"\"") .lines) $readFile"scripts/compile-prelude"
let
idt = installDirTemplates lbi
env = installDirsTemplateEnv idt
idt' =fmap (fromPathTemplate
. substPathTemplate env
. substPathTemplate (packageTemplateEnv (package pkg_descr))) idt
-- This makes little sense to me, but it works...
to = bindir idt' ++"/geordi-compile-prelude"
writeFile to $unlines$ pre ++ ["DATA=\""++ datadir idt' ++"/"++ datasubdir idt' ++"/\""] ++ post
setFileMode to ownerModes
postInst autoconfUserHooks args flags pkg_descr lbi