-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup.hs
32 lines (24 loc) · 1.04 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
30
31
32
import Distribution.Simple
import Distribution.Simple.Setup
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Program
import System.FilePath.Posix
import System.Directory
main = defaultMainWithHooks simpleUserHooks { buildHook = bHook
, copyHook = cHook
}
bHook pkg lbi h f = do
buildHook simpleUserHooks pkg lbi h f
let programs = withPrograms lbi
Just ghc = lookupKnownProgram "ghc" programs >>=
\p -> lookupProgram p programs
runProgram (fromFlag $ buildVerbosity f) ghc
["-c", "src/lv2_stub.c", "-fPIC", "-dynamic",
"-I" ++ buildDir lbi, "-odir " ++ buildDir lbi]
cHook pkg lbi h f = do
copyHook simpleUserHooks pkg lbi h f
let dirs = installDirTemplates lbi
outdir = (fromPathTemplate $ libdir dirs) </>
(fromPathTemplate $ libsubdir dirs)
indir = buildDir lbi
copyFile (indir </> "src" </> "lv2_stub.o") (outdir </> "lv2_stub.o")