on master help sign in
Make --install respect TARGET for .ibc AND objects

Fixes #509

commit844f927b7278128a8ad32e5702876f1ceb6c4d95 authorLeif Warner <leif@janrain.com> dateWed 2 Oct 2013, 00:49 (13 years ago) parent45e0a55
2 files changed+7−5
src/Pkg/Package.hs+3−4 src/Util/System.hs+4−1
src/Pkg/Package.hs+3−4
@@ -20,7 +20,7 @@ import Idris.AbsSyntax
2020
2121import Pkg.PParser
2222
23−import Paths_idris
23+import Paths_idris (getDataDir)
2424
2525-- To build a package:
2626-- * read the package description
@@ -98,8 +98,7 @@ toIBCFile (NS n ns) = foldl1' (</>) (reverse (toIBCFile n : ns))
9898
9999installIBC :: String -> Name -> IO ()
100100installIBC p m = do let f = toIBCFile m
101− target <- environment "TARGET"
102− d <- maybe getDataDir return target
101+ d <- getTargetDir
103102 let destdir = d </> p </> getDest m
104103 putStrLn $ "Installing " ++ f ++ " to " ++ destdir
105104 createDirectoryIfMissing True destdir
@@ -109,7 +108,7 @@ installIBC p m = do let f = toIBCFile m
109108 getDest (NS n ns) = foldl1' (</>) (reverse (getDest n : ns))
110109
111110installObj :: String -> String -> IO ()
112−installObj p o = do d <- getDataDir
111+installObj p o = do d <- getTargetDir
113112 let destdir = addTrailingPathSeparator (d </> p)
114113 putStrLn $ "Installing " ++ o ++ " to " ++ destdir
115114 createDirectoryIfMissing True destdir
src/Util/System.hs+4−1
@@ -1,5 +1,5 @@
11{-# LANGUAGE CPP #-}
2−module Util.System(tempfile,withTempdir,environment,getCC,
2+module Util.System(tempfile,withTempdir,getTargetDir,getCC,
33 getLibFlags,getIdrisLibDir,getIncFlags,rmFile,
44 getMvn,getExecutablePom,catchIO) where
55
@@ -64,6 +64,9 @@ environment x = catchIO (do e <- getEnv x
6464 return (Just e))
6565 (\_ -> return Nothing)
6666
67+getTargetDir :: IO String
68+getTargetDir = environment "TARGET" >>= maybe getDataDir return
69+
6770rmFile :: FilePath -> IO ()
6871rmFile f = do putStrLn $ "Removing " ++ f
6972 catchIO (removeFile f)