on master help sign in
Allow $TARGET to override libdir on the `idris --install` command.

Some way of installing .ibc files to a location other than datadir using idris --install is necessary for making a system package out of this. I have a standard script for making an Arch Linux package out of a cabal package up at: https://gist.github.com/4158545 During the build step, it runs: ``` cabal configure --prefix=/usr -O cabal build ``` and then during the package step: ``` cabal copy --destdir=/tmp/idris/pkg ``` Trouble with the current impl is, that last step calls the Makefile, which calls `idris --install base.ipkg`, which then tries to write into /usr/share/idris-9.5 and gets "Permission denied" errors. That destdir passed to "cabal copy" is already being passed into the Makefile as destdir/datadir: $TARGET=/tmp/idris/pkg/usr/share/idris-0.9.5. So this just gives a way of installing idris packages to a location other that datadir, if desired: TARGET=$HOME/foo idris --install blah

commit81d917f6944bcb6eaa6fbe33805dc67b772a5515 authorLeif Warner <leif@janrain.com> dateTue 27 Nov 2012, 20:24 (14 years ago) parent160eedd
1 file changed+3−1
src/Pkg/Package.hs+3−1
src/Pkg/Package.hs+3−1
@@ -5,6 +5,7 @@ import System.Directory
55import System.Exit
66import System.IO
77import System.FilePath ((</>), addTrailingPathSeparator)
8+import System.Environment (lookupEnv)
89
910import Util.System
1011
@@ -101,7 +102,8 @@ toIBCFile (NS n ns) = foldl1 (</>) (reverse (toIBCFile n : ns))
101102
102103installIBC :: String -> Name -> IO ()
103104installIBC p m = do let f = toIBCFile m
104− d <- getDataDir
105+ target <- lookupEnv "TARGET"
106+ d <- maybe getDataDir return target
105107 let destdir = d </> p </> getDest m
106108 putStrLn $ "Installing " ++ f ++ " to " ++ destdir
107109 system $ "mkdir -p " ++ destdir