on master help sign in
Merge pull request #510 from LeifW/universal_target_override

Make --install respect TARGET for .ibc AND objects

commitbaf632e6227c73f9dc1168a0353a26d21863e9ef authorEdwin Brady <edwin.brady@gmail.com> dateThu 3 Oct 2013, 03:09 (13 years ago) parentd8a8fcf844f927
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)