on master help sign in
Merge pull request #3462 from jfdm/install-doc-files

Allow Idris to install IdrisDoc into a central location & fix some issues with how paths are overridden.

commitd1eccd8311554091e4b5515e2139d1bd1ed81727 authorJan de Muijnck-Hughes <jfdm@users.noreply.github.com> dateThu 29 Sep 2016, 16:50 (10 years ago) parentf6fccd7a0d1566
19 files changed+205−92
CHANGELOG.md+7−3 Setup.hs+1−2 docs/reference/compilation.rst+27−19 libs/Makefile−1 libs/base/Makefile+3−2 libs/contrib/Makefile+3−2 libs/effects/Makefile+1 libs/prelude/Makefile+2−1 libs/pruviloj/Makefile+1 main/Main.hs+2−1 src/IRTS/CodegenC.hs+2−2 src/IRTS/CodegenJavaScript.hs+16−16 src/IRTS/System.hs+34−13 src/Idris/AbsSyntax.hs+5−4 src/Idris/AbsSyntaxTree.hs+4−2 src/Idris/CmdOptions.hs+10−8 src/Idris/Info.hs+17−1 src/Idris/Info/Show.hs+48 src/Idris/Package.hs+22−15
CHANGELOG.md+7−3
@@ -40,10 +40,14 @@
4040
4141* Idris' documentation system now displays the documentation for auto
4242 implicits in the output of `:doc`. This is tested for in `docs005`.
43−
4443* New command line flag `--info` that displays information about the installation.
45−
4644* New command line flag `--sourcepath <dir>` that allows adding directories to the source search path.
45+* Allow 'installation' of a package's IdrisDoc documentation into a central location. The default location is the subdirectory `docs` of Idris' data directory.
46+ * New flag `--installdoc <ipkg>` provided to install documentation
47+ * New flag `--docdir` provided to show default documentation installation location.
48+ * New environment variable `IDRIS_DOC_PATH` to allow specification of an alternative installation path for documentation.
49+* Semantic meaning behind several environment variables has been clarified in documentation and code. See compilation section of the reference manual for more details.
50+
4751## Miscellaneous updates
4852
4953* The test suite now uses [tasty-golden](https://hackage.haskell.org/package/tasty-golden). New tests must be registered in `test/TestData.hs`, as explained in the relevant `README.md`.
@@ -51,7 +55,7 @@
5155
5256## UI Changes
5357
54−* The :e command can now handle an $EDITOR with arguments in it, like "emacs -nw"
58+* The :e command can now handle an $EDITOR with arguments in it, like "emacs -nw"
5559
5660
5761# New in 0.12:
Setup.hs+1−2
@@ -254,7 +254,7 @@ idrisInstall verbosity copy pkg local = unless (execOnly (configFlags local)) $
254254 target = datadir $ L.absoluteInstallDirs pkg local copy
255255
256256 installStdLib = do
257− let target' = target </> "libs"
257+ let target' = target -- </> "libs"
258258 putStrLn $ "Installing libraries in " ++ target'
259259 makeInstall "libs" target'
260260
@@ -268,7 +268,6 @@ idrisInstall verbosity copy pkg local = unless (execOnly (configFlags local)) $
268268 notice verbosity $ unwords ["Copying man page to", mandest]
269269 installOrdinaryFiles verbosity mandest [("man", "idris.1")]
270270
271−
272271 makeInstall src target =
273272 make verbosity [ "-C", src, "install" , "TARGET=" ++ target, "IDRIS=" ++ idrisCmd local]
274273
docs/reference/compilation.rst+27−19
@@ -86,22 +86,30 @@ overridden through environment variables. The provided variables are:
8686
8787* `IDRIS_CC` Change the `C` compiler used by the `C` backend.
8888* `IDRIS_CFLAGS` Change the `C` flags passed to the `C` compiler.
89−* `TARGET` Change the target directory to generate files.
90−* `IDRIS_LIBRARY_PATH` Change the location of where installed packages are found.
91−
92−Alternativly, and perhaps a cleaner approach is to configure these
93−options using the CLI options. Idris also supports options to augment
94−the paths used, and pass options to the code generator backend.
95−
96−The option `--cg-opt <ARG>` can be used to pass options to the code
97−generator. The format of `<ARG>` is dependent on the selected backend.
98−
99−Further, Idris does support multiple include paths. The CLI option
100−`-i <dir>` allows you to add a directory to the library search path; this
101−option can be used multiple times. This is a cleaner option when you
102−wish to add single directories to the `IDRIS_LIBRARY_PATH` than
103−ammending `IDRIS_LIBRARY_PATH` directly.
104−To add directories to the source search path, use the `--sourcepath <dir>` option.
105−
106−Moreover, rather than using `TARGET` the CLI option `--ibcsubdir` can
107−be used to direct where built IBC files are placed.
89+* `TARGET` Change the target directory i.e. `data dir` where Idris installs files when installing using Cabal/Stack.
90+* `IDRIS_LIBRARY_PATH` Change the location of where installed packages are found/installed.
91+* `IDRIS_DOC_PATH` Change the location of where generated idrisdoc for packages are installed.
92+
93+.. note::
94+
95+ In versions of Idris prior to 0.12.3 the environment variables
96+ `IDRIS_LIBRARY_PATH` and `TARGET` were both used to affect the
97+ installation of single packages and direct where Idris installed
98+ its data. The meaning of these variables has changed, and command
99+ line options are preferred when changing where individual packages
100+ are installed.
101+
102+The CLI option `--ibcsubdir` can be used to direct where generated IBC
103+files are placed. However, this means Idris will install files in a
104+non-standard location separate from the rest of the installed
105+packages. The CLI option `--idrispath <dir>` allows you to add a
106+directory to the library search path; this option can be used multiple
107+times and can be shortened to `-i <dir>`. Similary, the `--sourcepath
108+<dir>` option can be used to add directories to the source search
109+path. There is no shortened version for this option as `-s` is a
110+reserved flag.
111+
112+Further, Idris also supports options to augment the paths used, and
113+pass options to the code generator backend. The option `--cg-opt
114+<ARG>` can be used to pass options to the code generator. The format
115+of `<ARG>` is dependent on the selected backend.
libs/Makefile−1
@@ -34,5 +34,4 @@ doc_clean:
3434 $(MAKE) -C effects doc_clean
3535 $(MAKE) -C pruviloj doc_clean
3636
37−
3837.PHONY: build install clean doc doc_clean
libs/base/Makefile+3−2
@@ -4,8 +4,9 @@ PKG := base
44build:
55 $(IDRIS) --build ${PKG}.ipkg
66
7−install:
7+install:
88 $(IDRIS) --install ${PKG}.ipkg
9+ ${IDRIS} --installdoc ${PKG}.ipkg
910
1011clean:
1112 $(IDRIS) --clean ${PKG}.ipkg
@@ -21,4 +22,4 @@ doc_clean:
2122linecount:
2223 find . -name '*.idr' | xargs wc -l
2324
24−.PHONY: build install clean rebuild linecount
25+.PHONY: build install clean rebuild linecount doc doc_clean
libs/contrib/Makefile+3−2
@@ -4,8 +4,9 @@ PKG := contrib
44build:
55 $(IDRIS) --build ${PKG}.ipkg
66
7−install:
7+install:
88 $(IDRIS) --install ${PKG}.ipkg
9+ ${IDRIS} --installdoc ${PKG}.ipkg
910
1011clean:
1112 $(IDRIS) --clean ${PKG}.ipkg
@@ -21,4 +22,4 @@ doc_clean:
2122linecount:
2223 find . -name '*.idr' | xargs wc -l
2324
24−.PHONY: build install clean rebuild linecount
25+.PHONY: build install clean rebuild linecount doc doc_clean
libs/effects/Makefile+1
@@ -9,6 +9,7 @@ clean:
99
1010install:
1111 $(IDRIS) --install ${PKG}.ipkg
12+ ${IDRIS} --installdoc ${PKG}.ipkg
1213
1314rebuild: clean build
1415
libs/prelude/Makefile+2−1
@@ -4,8 +4,9 @@ PKG := prelude
44build:
55 $(IDRIS) --build ${PKG}.ipkg
66
7−install:
7+install:
88 $(IDRIS) --install ${PKG}.ipkg
9+ ${IDRIS} --installdoc ${PKG}.ipkg
910
1011clean:
1112 $(IDRIS) --clean ${PKG}.ipkg
libs/pruviloj/Makefile+1
@@ -9,6 +9,7 @@ clean:
99
1010install:
1111 $(IDRIS) --install ${PKG}.ipkg
12+ ${IDRIS} --installdoc ${PKG}.ipkg
1213
1314rebuild: clean build
1415
main/Main.hs+2−1
@@ -18,7 +18,8 @@ processShowOptions opts = runIO $ do
1818 when (ShowLoggingCats `elem` opts) $ showExitIdrisLoggingCategories
1919 when (ShowIncs `elem` opts) $ showExitIdrisFlagsInc
2020 when (ShowLibs `elem` opts) $ showExitIdrisFlagsLibs
21− when (ShowLibdir `elem` opts) $ showExitIdrisLibDir
21+ when (ShowLibDir `elem` opts) $ showExitIdrisLibDir
22+ when (ShowDocDir `elem` opts) $ showExitIdrisDocDir
2223 when (ShowPkgs `elem` opts) $ showExitIdrisInstalledPackages
2324
2425check :: [Opt] -> (Opt -> Maybe a) -> ([a] -> Idris ()) -> Idris ()
src/IRTS/CodegenC.hs+2−2
@@ -66,8 +66,8 @@ codegenC' defs out exec incs objs libs flags exports iface dbg
6666 let h = concatMap toDecl (map fst bc)
6767 let cc = concatMap (uncurry toC) bc
6868 let hi = concatMap ifaceC (concatMap getExp exports)
69− d <- getDataDir
70− mprog <- readFile (d </> "rts" </> "idris_main" <.> "c")
69+ d <- getIdrisCRTSDir
70+ mprog <- readFile (d </> "idris_main" <.> "c")
7171 let cout = headers incs ++ debug dbg ++ h ++ wrappers ++ cc ++
7272 (if (exec == Executable) then mprog else hi)
7373 case exec of
src/IRTS/CodegenJavaScript.hs+16−16
@@ -121,27 +121,27 @@ codegenJS_all
121121 -> OutputType
122122 -> IO ()
123123codegenJS_all target definitions includes libs filename exports outputType = do
124− let bytecode = map toBC definitions
125− let info = initCompileInfo bytecode
126− let js = concatMap (translateDecl info) bytecode
127− let full = concatMap processFunction js
124+ let bytecode = map toBC definitions
125+ let info = initCompileInfo bytecode
126+ let js = concatMap (translateDecl info) bytecode
127+ let full = concatMap processFunction js
128128 let exportedNames = map translateName ((getExpNames exports) ++ [sUN "call__IO"])
129− let code = deadCodeElim exportedNames full
130− let ext = takeExtension filename
131− let isHtml = target == JavaScript && ext == ".html"
132− let htmlPrologue = T.pack "<!doctype html><html><head><script>\n"
133− let htmlEpilogue = T.pack "\n</script></head><body></body></html>"
134− let (cons, opt) = optimizeConstructors code
135− let (header, rt) = case target of
136− Node -> ("#!/usr/bin/env node\n", "-node")
129+ let code = deadCodeElim exportedNames full
130+ let ext = takeExtension filename
131+ let isHtml = target == JavaScript && ext == ".html"
132+ let htmlPrologue = T.pack "<!doctype html><html><head><script>\n"
133+ let htmlEpilogue = T.pack "\n</script></head><body></body></html>"
134+ let (cons, opt) = optimizeConstructors code
135+ let (header, rt) = case target of
136+ Node -> ("#!/usr/bin/env node\n", "-node")
137137 JavaScript -> ("", "-browser")
138138
139139 included <- concat <$> getIncludes includes
140− path <- (++) <$> getDataDir <*> (pure "/jsrts/")
141− idrRuntime <- readFile $ path ++ "Runtime-common.js"
142− tgtRuntime <- readFile $ concat [path, "Runtime", rt, ".js"]
140+ path <- getIdrisJSRTSDir
141+ idrRuntime <- readFile $ path </> "Runtime-common.js"
142+ tgtRuntime <- readFile $ path </> concat ["Runtime", rt, ".js"]
143143 jsbn <- if compileInfoNeedsBigInt info
144− then readFile $ path ++ "jsbn/jsbn.js"
144+ then readFile $ path </> "jsbn/jsbn.js"
145145 else return ""
146146 let runtime = ( header
147147 ++ includeLibs libs
src/IRTS/System.hs+34−13
@@ -7,11 +7,13 @@ Maintainer : The Idris Community.
77-}
88{-# LANGUAGE CPP #-}
99module IRTS.System( getDataFileName
10− , getDataDir
11− , getTargetDir
1210 , getCC
1311 , getLibFlags
12+ , getIdrisDataDir
1413 , getIdrisLibDir
14+ , getIdrisDocDir
15+ , getIdrisCRTSDir
16+ , getIdrisJSRTSDir
1517 , getIncFlags
1618 , getEnvFlags
1719 , version
@@ -31,13 +33,24 @@ import Paths_idris (version)
3133import Paths_idris
3234#endif
3335
34−overrideDataDirWith :: String -> IO FilePath
35−overrideDataDirWith envVar = do
36− envValue <- lookupEnv envVar
36+getIdrisDataDir :: IO String
37+getIdrisDataDir = do
38+ envValue <- lookupEnv "TARGET"
3739 case envValue of
3840 Nothing -> do
3941 ddir <- getDataDir
40− return (ddir </> "libs")
42+ return ddir
43+ Just ddir -> return ddir
44+
45+overrideIdrisSubDirWith :: String -- ^ Sub directory in `getDataDir` location.
46+ -> String -- ^ Environment variable to get new location from.
47+ -> IO FilePath
48+overrideIdrisSubDirWith fp envVar = do
49+ envValue <- lookupEnv envVar
50+ case envValue of
51+ Nothing -> do
52+ ddir <- getIdrisDataDir
53+ return (ddir </> fp)
4154 Just ddir -> return ddir
4255
4356getCC :: IO String
@@ -46,8 +59,6 @@ getCC = fromMaybe "gcc" <$> lookupEnv "IDRIS_CC"
4659getEnvFlags :: IO [String]
4760getEnvFlags = maybe [] (splitOn " ") <$> lookupEnv "IDRIS_CFLAGS"
4861
49−getTargetDir :: IO String
50−getTargetDir = overrideDataDirWith "TARGET"
5162
5263#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)\
5364 || defined(openbsd_HOST_OS) || defined(netbsd_HOST_OS)
@@ -64,11 +75,21 @@ gmpLib = ["-lgmp"]
6475gmpLib = []
6576#endif
6677
67−getLibFlags = do dir <- getDataDir
68− return $ ["-L" ++ (dir </> "rts"),
78+getLibFlags = do dir <- getIdrisCRTSDir
79+ return $ ["-L" ++ dir,
6980 "-lidris_rts"] ++ extraLib ++ gmpLib ++ ["-lpthread"]
7081
71−getIdrisLibDir = addTrailingPathSeparator <$> overrideDataDirWith "IDRIS_LIBRARY_PATH"
82+getIdrisLibDir = addTrailingPathSeparator <$> overrideIdrisSubDirWith "libs" "IDRIS_LIBRARY_PATH"
83+
84+getIdrisDocDir = addTrailingPathSeparator <$> overrideIdrisSubDirWith "docs" "IDRIS_DOC_PATH"
85+
86+getIdrisJSRTSDir = do
87+ ddir <- getIdrisDataDir
88+ return $ addTrailingPathSeparator (ddir </> "jsrts")
89+
90+getIdrisCRTSDir = do
91+ ddir <- getIdrisDataDir
92+ return $ addTrailingPathSeparator (ddir </> "rts")
7293
73−getIncFlags = do dir <- getDataDir
74− return $ ("-I" ++ dir </> "rts") : extraInclude
94+getIncFlags = do dir <- getIdrisCRTSDir
95+ return $ ("-I" ++ dir) : extraInclude
src/Idris/AbsSyntax.hs+5−4
@@ -2545,7 +2545,7 @@ getPkgDir (Pkg str) = Just str
25452545getPkgDir _ = Nothing
25462546
25472547getPkg :: Opt -> Maybe (Bool, String)
2548−getPkg (PkgBuild str) = Just (False, str)
2548+getPkg (PkgBuild str) = Just (False, str)
25492549getPkg (PkgInstall str) = Just (True, str)
25502550getPkg _ = Nothing
25512551
@@ -2563,9 +2563,10 @@ getPkgCheck _ = Nothing
25632563
25642564-- | Returns None if given an Opt which is not PkgMkDoc
25652565-- Otherwise returns Just x, where x is the contents of PkgMkDoc
2566−getPkgMkDoc :: Opt -- ^ Opt to extract
2567− -> Maybe String -- ^ Result
2568−getPkgMkDoc (PkgMkDoc str) = Just str
2566+getPkgMkDoc :: Opt -- ^ Opt to extract
2567+ -> Maybe (Bool, String) -- ^ Result
2568+getPkgMkDoc (PkgDocBuild str) = Just (False,str)
2569+getPkgMkDoc (PkgDocInstall str) = Just (True,str)
25692570getPkgMkDoc _ = Nothing
25702571
25712572getPkgTest :: Opt -- ^ the option to extract
src/Idris/AbsSyntaxTree.hs+4−2
@@ -492,7 +492,8 @@ data Opt = Filename String
492492 | IdemodeSocket
493493 | ShowAll
494494 | ShowLibs
495− | ShowLibdir
495+ | ShowLibDir
496+ | ShowDocDir
496497 | ShowIncs
497498 | ShowPkgs
498499 | ShowLoggingCats
@@ -524,7 +525,8 @@ data Opt = Filename String
524525 | PkgClean String
525526 | PkgCheck String
526527 | PkgREPL String
527− | PkgMkDoc String -- IdrisDoc
528+ | PkgDocBuild String -- IdrisDoc
529+ | PkgDocInstall String
528530 | PkgTest String
529531 | PkgIndex FilePath
530532 | WarnOnly
src/Idris/CmdOptions.hs+10−8
@@ -129,7 +129,8 @@ parseFlags = many $
129129 <|> flag' ShowLoggingCats (long "listlogcats" <> help "Display logging categories")
130130 <|> flag' ShowLibs (long "link" <> help "Display link flags")
131131 <|> flag' ShowPkgs (long "listlibs" <> help "Display installed libraries")
132− <|> flag' ShowLibdir (long "libdir" <> help "Display library directory")
132+ <|> flag' ShowLibDir (long "libdir" <> help "Display library directory")
133+ <|> flag' ShowDocDir (long "docdir" <> help "Display idrisdoc install directory")
133134 <|> flag' ShowIncs (long "include" <> help "Display the includes flags")
134135
135136 <|> flag' Verbose (short 'V' <> long "verbose" <> help "Loud verbosity")
@@ -144,13 +145,14 @@ parseFlags = many $
144145 <|> (Port <$> option portReader (long "port" <> metavar "PORT" <> help "REPL TCP port - pass \"none\" to not bind any port"))
145146
146147 -- Package commands
147− <|> (PkgBuild <$> strOption (long "build" <> metavar "IPKG" <> help "Build package"))
148− <|> (PkgInstall <$> strOption (long "install" <> metavar "IPKG" <> help "Install package"))
149− <|> (PkgREPL <$> strOption (long "repl" <> metavar "IPKG" <> help "Launch REPL, only for executables"))
150− <|> (PkgClean <$> strOption (long "clean" <> metavar "IPKG" <> help "Clean package"))
151− <|> (PkgMkDoc <$> strOption (long "mkdoc" <> metavar "IPKG" <> help "Generate IdrisDoc for package"))
152− <|> (PkgCheck <$> strOption (long "checkpkg" <> metavar "IPKG" <> help "Check package only"))
153− <|> (PkgTest <$> strOption (long "testpkg" <> metavar "IPKG" <> help "Run tests for package"))
148+ <|> (PkgBuild <$> strOption (long "build" <> metavar "IPKG" <> help "Build package"))
149+ <|> (PkgInstall <$> strOption (long "install" <> metavar "IPKG" <> help "Install package"))
150+ <|> (PkgREPL <$> strOption (long "repl" <> metavar "IPKG" <> help "Launch REPL, only for executables"))
151+ <|> (PkgClean <$> strOption (long "clean" <> metavar "IPKG" <> help "Clean package"))
152+ <|> (PkgDocBuild <$> strOption (long "mkdoc" <> metavar "IPKG" <> help "Generate IdrisDoc for package"))
153+ <|> (PkgDocInstall <$> strOption (long "installdoc" <> metavar "IPKG" <> help "Install IdrisDoc for package"))
154+ <|> (PkgCheck <$> strOption (long "checkpkg" <> metavar "IPKG" <> help "Check package only"))
155+ <|> (PkgTest <$> strOption (long "testpkg" <> metavar "IPKG" <> help "Run tests for package"))
154156
155157 -- Misc options
156158 <|> (BCAsm <$> strOption (long "bytecode"))
src/Idris/Info.hs+17−1
@@ -6,7 +6,11 @@ License : BSD3
66Maintainer : The Idris Community.
77-}
88module Idris.Info
9− ( getIdrisLibDir
9+ ( getIdrisDataDir
10+ , getIdrisCRTSDir
11+ , getIdrisJSRTSDir
12+ , getIdrisLibDir
13+ , getIdrisDocDir
1014 , getIdrisFlagsLib
1115 , getIdrisFlagsInc
1216 , getIdrisFlagsEnv
@@ -33,6 +37,18 @@ import Version_idris (gitHash)
3337
3438import Paths_idris
3539
40+getIdrisDataDir :: IO String
41+getIdrisDataDir = S.getIdrisDataDir
42+
43+getIdrisCRTSDir :: IO String
44+getIdrisCRTSDir = S.getIdrisCRTSDir
45+
46+getIdrisJSRTSDir :: IO String
47+getIdrisJSRTSDir = S.getIdrisJSRTSDir
48+
49+getIdrisDocDir :: IO String
50+getIdrisDocDir = S.getIdrisDocDir
51+
3652getIdrisLibDir :: IO String
3753getIdrisLibDir = S.getIdrisLibDir
3854
src/Idris/Info/Show.hs+48
@@ -4,6 +4,26 @@ import System.Exit
44
55import Idris.Info
66
7+showIdrisCRTSDir :: IO ()
8+showIdrisCRTSDir = do
9+ ldir <- getIdrisCRTSDir
10+ putStrLn ldir
11+
12+showExitIdrisCRTSDir :: IO ()
13+showExitIdrisCRTSDir = do
14+ showIdrisCRTSDir
15+ exitSuccess
16+
17+showIdrisJSRTSDir :: IO ()
18+showIdrisJSRTSDir = do
19+ ldir <- getIdrisJSRTSDir
20+ putStrLn ldir
21+
22+showExitIdrisJSRTSDir :: IO ()
23+showExitIdrisJSRTSDir = do
24+ showIdrisJSRTSDir
25+ exitSuccess
26+
727showIdrisFlagsLibs :: IO ()
828showIdrisFlagsLibs = do
929 libFlags <- getIdrisFlagsLib
@@ -14,6 +34,16 @@ showExitIdrisFlagsLibs = do
1434 showIdrisFlagsLibs
1535 exitSuccess
1636
37+showIdrisDataDir :: IO ()
38+showIdrisDataDir = do
39+ ldir <- getIdrisDataDir
40+ putStrLn ldir
41+
42+showExitIdrisDataDir :: IO ()
43+showExitIdrisDataDir = do
44+ showIdrisDataDir
45+ exitSuccess
46+
1747showIdrisLibDir :: IO ()
1848showIdrisLibDir = do
1949 ldir <- getIdrisLibDir
@@ -24,6 +54,16 @@ showExitIdrisLibDir = do
2454 showIdrisLibDir
2555 exitSuccess
2656
57+showIdrisDocDir :: IO ()
58+showIdrisDocDir = do
59+ ldir <- getIdrisDocDir
60+ putStrLn ldir
61+
62+showExitIdrisDocDir :: IO ()
63+showExitIdrisDocDir = do
64+ showIdrisDocDir
65+ exitSuccess
66+
2767showIdrisFlagsInc :: IO ()
2868showIdrisFlagsInc = do
2969 incFlags <- getIdrisFlagsInc
@@ -68,8 +108,16 @@ showIdrisInfo = do
68108 putStrLn "Paths:"
69109 ldir <- getIdrisLibDir
70110 udir <- getIdrisUserDataDir
111+ ddir <- getIdrisDocDir
112+ idir <- getIdrisDataDir
113+ crdir <- getIdrisCRTSDir
114+ jrdir <- getIdrisJSRTSDir
115+ putStrLn $ unwords ["-", "Data Dir:", idir]
71116 putStrLn $ unwords ["-", "Library Dir:", ldir]
117+ putStrLn $ unwords ["-", "C RTS Dir:", crdir]
118+ putStrLn $ unwords ["-", "JS RTS Dir:", jrdir]
72119 putStrLn $ unwords ["-", "User Dir:", udir]
120+ putStrLn $ unwords ["-", "Documentation Dir:", ddir]
73121
74122 putStrLn "Flags:"
75123 lflag <- getIdrisFlagsLib
src/Idris/Package.hs+22−15
@@ -190,10 +190,10 @@ cleanPkg copts fp = do
190190--
191191-- Issue number #1572 on the issue tracker
192192-- https://github.com/idris-lang/Idris-dev/issues/1572
193−documentPkg :: [Opt] -- ^ Command line options.
194− -> FilePath -- ^ Path to ipkg file.
193+documentPkg :: [Opt] -- ^ Command line options.
194+ -> (Bool,FilePath) -- ^ (Should we install?, Path to ipkg file).
195195 -> IO ()
196−documentPkg copts fp = do
196+documentPkg copts (install,fp) = do
197197 pkgdesc <- parseDesc fp
198198 cd <- getCurrentDirectory
199199 let pkgDir = cd </> takeDirectory fp
@@ -223,7 +223,13 @@ documentPkg copts fp = do
223223 putStrLn $ pshow idrisInit err
224224 exitWith (ExitFailure 1)
225225 Right ist -> do
226− docRes <- generateDocs ist mods outputDir
226+ iDocDir <- getIdrisDocDir
227+ pkgDocDir <- makeAbsolute (iDocDir </> pkgname pkgdesc)
228+ let out_dir = if install then pkgDocDir else outputDir
229+ when install $ do
230+ putStrLn $ unwords ["Attempting to install IdrisDocs for", pkgname pkgdesc, "in:", out_dir]
231+
232+ docRes <- generateDocs ist mods out_dir
227233 case docRes of
228234 Right _ -> return ()
229235 Left msg -> do
@@ -279,7 +285,7 @@ installPkg :: [String] -- ^ Alternate install location
279285 -> PkgDesc -- ^ iPKG file.
280286 -> IO ()
281287installPkg altdests pkgdesc = inPkgDir pkgdesc $ do
282− d <- getTargetDir
288+ d <- getIdrisLibDir
283289 let destdir = case altdests of
284290 [] -> d
285291 (d':_) -> d'
@@ -302,11 +308,11 @@ buildMods opts ns = do let f = map (toPath . showCG) ns
302308
303309testLib :: Bool -> String -> String -> IO Bool
304310testLib warn p f
305− = do d <- getDataDir
311+ = do d <- getIdrisCRTSDir
306312 gcc <- getCC
307313 (tmpf, tmph) <- tempfile ""
308314 hClose tmph
309− let libtest = d </> "rts" </> "libtest.c"
315+ let libtest = d </> "libtest.c"
310316 e <- rawSystem gcc [libtest, "-l" ++ f, "-o", tmpf]
311317 case e of
312318 ExitSuccess -> return True
@@ -416,14 +422,15 @@ mergeOptions copts popts =
416422 normaliseOpts = filter filtOpt
417423
418424 filtOpt :: Opt -> Bool
419− filtOpt (PkgBuild _) = False
420− filtOpt (PkgInstall _) = False
421− filtOpt (PkgClean _) = False
422− filtOpt (PkgCheck _) = False
423− filtOpt (PkgREPL _) = False
424− filtOpt (PkgMkDoc _) = False
425− filtOpt (PkgTest _) = False
426− filtOpt _ = True
425+ filtOpt (PkgBuild _) = False
426+ filtOpt (PkgInstall _) = False
427+ filtOpt (PkgClean _) = False
428+ filtOpt (PkgCheck _) = False
429+ filtOpt (PkgREPL _) = False
430+ filtOpt (PkgDocBuild _) = False
431+ filtOpt (PkgDocInstall _) = False
432+ filtOpt (PkgTest _) = False
433+ filtOpt _ = True
427434
428435 chkOpt :: Opt -> Either String Opt
429436 chkOpt o@(OLogging _) = Right o