@@ -4,36 +4,37 @@ import Distribution.Simple.Setup
4
4
import Distribution.Simple.Program
5
5
import Distribution.Simple.LocalBuildInfo
6
6
import Distribution.PackageDescription
7
+ import Distribution.ModuleName (components )
7
8
import Control.Monad
8
9
import Data.Maybe
9
10
import System.Directory
10
11
import System.FilePath
11
- defhooks = defaultUserHooks
12
+ defhooks = autoconfUserHooks
12
13
programs = [
13
14
simpleProgram " matlab" ,
14
- Program " mcr" ( \ _ -> return Nothing ) ( \ _ _ -> return Nothing )
15
+ (simpleProgram " mcr" ) { programFindLocation = \ _ -> return Nothing }
15
16
]
16
- runtime desc = maybe False (elem " Foreign. Matlab. Runtime" . exposedModules) $ library desc
17
+ runtime desc = maybe False (elem [ " Foreign" , " Matlab" , " Runtime" ] . map components . exposedModules) $ library desc
17
18
postconf args flags desc build = do
18
19
confExists <- doesFileExist " configure"
19
- unless confExists $ rawSystemPathExit verb " autoconf" []
20
+ unless confExists $ rawSystemExit verb " autoconf" []
20
21
postConf defhooks args flags{ configConfigureArgs = configConfigureArgs flags ++ confargs } desc build
21
22
where
22
- verb = configVerbose flags
23
+ verb = fromFlag $ configVerbosity flags
23
24
confargs = (" --" ++ (if runtime desc then " enable" else " disable" ) ++ " -runtime" ) : map pconfarg pconf
24
25
pconfarg p = " --with-" ++ programId p ++ " =" ++ programPath p ++ " " ++ unwords (programArgs p)
25
26
pconf = mapMaybe (\ p -> lookupProgram p (withPrograms build)) programs
26
27
build desc binfo hooks flags = do
27
- when (runtime desc) $ rawSystemPathExit (buildVerbose flags) " make" [" -Csrc" ]
28
+ when (runtime desc) $ rawSystemExit (fromFlag $ buildVerbosity flags) " make" [" -Csrc" ]
28
29
buildHook defhooks desc binfo hooks flags
29
30
clean desc binfo hooks flags = do
30
31
makeExists <- doesFileExist " src/Makefile"
31
- when makeExists $ rawSystemPathExit (cleanVerbose flags) " make" [" -Csrc" , " clean" ]
32
+ when makeExists $ rawSystemExit (fromFlag $ cleanVerbosity flags) " make" [" -Csrc" , " clean" ]
32
33
cleanHook defhooks desc binfo hooks flags
33
34
install desc binfo hooks flags = do
34
35
instHook defhooks desc binfo hooks flags
35
36
when (runtime desc) $ mapM_ (\ f ->
36
- copyFileVerbose (installVerbose flags)
37
+ copyFileVerbose (fromFlag $ installVerbosity flags)
37
38
(" src" </> f)
38
39
(libdir (absoluteInstallDirs desc binfo NoCopyDest ) </> f))
39
40
[" libhsmatlab.so" ," libhsmatlab.ctf" ]
@@ -44,7 +45,7 @@ reg desc binfo hooks flags = do
44
45
lm l = l{ libBuildInfo = (libBuildInfo l)
45
46
{ ldOptions = (" -Wl,-rpath," ++ lib) : ldOptions (libBuildInfo l) } }
46
47
lib
47
- | regInPlace flags = pwd </> " src"
48
+ | fromFlag $ regInPlace flags = pwd </> " src"
48
49
| otherwise = libdir (absoluteInstallDirs desc binfo NoCopyDest )
49
50
regHook defhooks desc' binfo hooks flags
50
51
hooks = defhooks {
0 commit comments