Skip to content

Commit 4f250f7

Browse files
committed
update for cabal 1.6
darcs-hash:20081102073116-56c21-57827d86ebd0bfdab3e20893dc4a340e3a369e5f
1 parent b12cc31 commit 4f250f7

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

Setup.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,37 @@ import Distribution.Simple.Setup
44
import Distribution.Simple.Program
55
import Distribution.Simple.LocalBuildInfo
66
import Distribution.PackageDescription
7+
import Distribution.ModuleName (components)
78
import Control.Monad
89
import Data.Maybe
910
import System.Directory
1011
import System.FilePath
11-
defhooks = defaultUserHooks
12+
defhooks = autoconfUserHooks
1213
programs = [
1314
simpleProgram "matlab",
14-
Program "mcr" (\_ -> return Nothing) (\_ _ -> return Nothing)
15+
(simpleProgram "mcr") { programFindLocation = \_ -> return Nothing }
1516
]
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
1718
postconf args flags desc build = do
1819
confExists <- doesFileExist "configure"
19-
unless confExists $ rawSystemPathExit verb "autoconf" []
20+
unless confExists $ rawSystemExit verb "autoconf" []
2021
postConf defhooks args flags{ configConfigureArgs = configConfigureArgs flags ++ confargs } desc build
2122
where
22-
verb = configVerbose flags
23+
verb = fromFlag $ configVerbosity flags
2324
confargs = ("--" ++ (if runtime desc then "enable" else "disable") ++ "-runtime") : map pconfarg pconf
2425
pconfarg p = "--with-" ++ programId p ++ "=" ++ programPath p ++ " " ++ unwords (programArgs p)
2526
pconf = mapMaybe (\p -> lookupProgram p (withPrograms build)) programs
2627
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"]
2829
buildHook defhooks desc binfo hooks flags
2930
clean desc binfo hooks flags = do
3031
makeExists <- doesFileExist "src/Makefile"
31-
when makeExists $ rawSystemPathExit (cleanVerbose flags) "make" ["-Csrc", "clean"]
32+
when makeExists $ rawSystemExit (fromFlag $ cleanVerbosity flags) "make" ["-Csrc", "clean"]
3233
cleanHook defhooks desc binfo hooks flags
3334
install desc binfo hooks flags = do
3435
instHook defhooks desc binfo hooks flags
3536
when (runtime desc) $ mapM_ (\f ->
36-
copyFileVerbose (installVerbose flags)
37+
copyFileVerbose (fromFlag $ installVerbosity flags)
3738
("src" </> f)
3839
(libdir (absoluteInstallDirs desc binfo NoCopyDest) </> f))
3940
["libhsmatlab.so","libhsmatlab.ctf"]
@@ -44,7 +45,7 @@ reg desc binfo hooks flags = do
4445
lm l = l{ libBuildInfo = (libBuildInfo l)
4546
{ ldOptions = ("-Wl,-rpath," ++ lib) : ldOptions (libBuildInfo l) } }
4647
lib
47-
| regInPlace flags = pwd </> "src"
48+
| fromFlag $ regInPlace flags = pwd </> "src"
4849
| otherwise = libdir (absoluteInstallDirs desc binfo NoCopyDest)
4950
regHook defhooks desc' binfo hooks flags
5051
hooks = defhooks {

test/hsmli.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Control.Monad
2+
import Foreign.Matlab
3+
import Foreign.Matlab.Runtime.Generic
4+
5+
loop ml = do
6+
i <- getLine
7+
when (i /= "") $ do
8+
mlGenericEval ml i 0
9+
loop ml
10+
11+
main = do
12+
ml <- openMLGeneric ["-nojvm", "-nojit"]
13+
putStrLn "ready. enter matlab expression or blank line to exit."
14+
loop ml
15+
closeMLGeneric ml

0 commit comments

Comments
 (0)