on master help sign in
Some packaging fixes
e8f4bb1Edwin Brady
src/IRTS/Compiler.hs+4−1
@@ -47,6 +47,7 @@ compile codegen f tm
47 libs <- getLibs codegen
47 libs <- getLibs codegen
48 flags <- getFlags codegen
48 flags <- getFlags codegen
49 hdrs <- getHdrs codegen
49 hdrs <- getHdrs codegen
50+ impdirs <- allImportDirs
50 let defs = defsIn ++ [(MN 0 "runMain", maindef)]
51 let defs = defsIn ++ [(MN 0 "runMain", maindef)]
51 -- iputStrLn $ showSep "\n" (map show defs)
52 -- iputStrLn $ showSep "\n" (map show defs)
52 let (nexttag, tagged) = addTags 65536 (liftAll defs)
53 let (nexttag, tagged) = addTags 65536 (liftAll defs)
@@ -79,7 +80,8 @@ compile codegen f tm
79 codegenC c f outty hdrs
80 codegenC c f outty hdrs
80 (concatMap mkObj objs)
81 (concatMap mkObj objs)
81 (concatMap mkLib libs)
82 (concatMap mkLib libs)
82− (concatMap mkFlag flags) NONE
83+ (concatMap mkFlag flags ++
84+ concatMap incdir impdirs) NONE
83 ViaJava ->
85 ViaJava ->
84 codegenJava [] c f hdrs libs outty
86 codegenJava [] c f hdrs libs outty
85 ViaJavaScript ->
87 ViaJavaScript ->
@@ -101,6 +103,7 @@ compile codegen f tm
101 mkLib l = "-l" ++ l ++ " "
103 mkLib l = "-l" ++ l ++ " "
102 mkFlag l = l ++ " "
104 mkFlag l = l ++ " "
103
105
106+ incdir i = "-I" ++ i ++ " "
104
107
105
108
106irMain :: TT Name -> Idris LDecl
109irMain :: TT Name -> Idris LDecl
src/Idris/AbsSyntax.hs+4−3
@@ -483,9 +483,10 @@ setImportDirs fps = do i <- getIState
483 let opt' = opts { opt_importdirs = fps }
483 let opt' = opts { opt_importdirs = fps }
484 putIState $ i { idris_options = opt' }
484 putIState $ i { idris_options = opt' }
485
485
486−allImportDirs :: IState -> Idris [FilePath]
486+allImportDirs :: Idris [FilePath]
487+allImportDirs = do i <- getIState
487−allImportDirs i = do let optdirs = opt_importdirs (idris_options i)
488+ let optdirs = opt_importdirs (idris_options i)
488− return ("." : reverse optdirs)
489+ return ("." : reverse optdirs)
489
490
490colourise :: Idris Bool
491colourise :: Idris Bool
491colourise = do i <- getIState
492colourise = do i <- getIState
src/Idris/Chaser.hs+1−1
@@ -79,7 +79,7 @@ buildTree built fp = idrisCatch (btree [] fp)
79 let file = takeWhile (/= ' ') f
79 let file = takeWhile (/= ' ') f
80 iLOG $ "CHASING " ++ show file
80 iLOG $ "CHASING " ++ show file
81 ibcsd <- valIBCSubDir i
81 ibcsd <- valIBCSubDir i
82− ids <- allImportDirs i
82+ ids <- allImportDirs
83 fp <- liftIO $ findImport ids ibcsd file
83 fp <- liftIO $ findImport ids ibcsd file
84 mt <- liftIO $ getIModTime fp
84 mt <- liftIO $ getIModTime fp
85 if (file `elem` built)
85 if (file `elem` built)
src/Idris/IBC.hs+4−2
@@ -179,7 +179,7 @@ pImports :: [FilePath] -> Idris ()
179pImports fs
179pImports fs
180 = do mapM_ (\f -> do i <- getIState
180 = do mapM_ (\f -> do i <- getIState
181 ibcsd <- valIBCSubDir i
181 ibcsd <- valIBCSubDir i
182− ids <- allImportDirs i
182+ ids <- allImportDirs
183 fp <- liftIO $ findImport ids ibcsd f
183 fp <- liftIO $ findImport ids ibcsd f
184 if (f `elem` imported i)
184 if (f `elem` imported i)
185 then iLOG $ "Already read " ++ f
185 then iLOG $ "Already read " ++ f
@@ -257,7 +257,9 @@ pKeywords k = do i <- getIState
257 putIState (i { syntax_keywords = k ++ syntax_keywords i })
257 putIState (i { syntax_keywords = k ++ syntax_keywords i })
258
258
259pObjs :: [(Codegen, FilePath)] -> Idris ()
259pObjs :: [(Codegen, FilePath)] -> Idris ()
260+pObjs os = mapM_ (\ (cg, obj) -> do dirs <- allImportDirs
261+ o <- liftIO $ findInPath dirs obj
260−pObjs os = mapM_ (uncurry addObjectFile) os
262+ addObjectFile cg o) os
261
263
262pLibs :: [(Codegen, String)] -> Idris ()
264pLibs :: [(Codegen, String)] -> Idris ()
263pLibs ls = mapM_ (uncurry addLib) ls
265pLibs ls = mapM_ (uncurry addLib) ls
src/Idris/Imports.hs+1−1
@@ -70,6 +70,6 @@ findInPath :: [FilePath] -> FilePath -> IO FilePath
70findInPath [] fp = fail $ "Can't find file " ++ fp
70findInPath [] fp = fail $ "Can't find file " ++ fp
71findInPath (d:ds) fp = do let p = d </> fp
71findInPath (d:ds) fp = do let p = d </> fp
72 e <- doesFileExist p
72 e <- doesFileExist p
73− if e then return p else findInPath ds p
73+ if e then return p else findInPath ds fp
74
74
75
75
src/Idris/Parser.hs+4−4
@@ -69,7 +69,7 @@ loadModule f
69 = idrisCatch (do i <- getIState
69 = idrisCatch (do i <- getIState
70 let file = takeWhile (/= ' ') f
70 let file = takeWhile (/= ' ') f
71 ibcsd <- valIBCSubDir i
71 ibcsd <- valIBCSubDir i
72− ids <- allImportDirs i
72+ ids <- allImportDirs
73 fp <- liftIO $ findImport ids ibcsd file
73 fp <- liftIO $ findImport ids ibcsd file
74 if file `elem` imported i
74 if file `elem` imported i
75 then iLOG $ "Already read " ++ file
75 then iLOG $ "Already read " ++ file
@@ -1624,9 +1624,9 @@ pDirective syn = try (do lchar '%'; reserved "lib"; cgn <- pCodegen; lib <- strl
1624 return [PDirective (do addLib cgn lib
1624 return [PDirective (do addLib cgn lib
1625 addIBC (IBCLib cgn lib))])
1625 addIBC (IBCLib cgn lib))])
1626 <|> try (do lchar '%'; reserved "link"; cgn <- pCodegen; obj <- strlit;
1626 <|> try (do lchar '%'; reserved "link"; cgn <- pCodegen; obj <- strlit;
1627− return [PDirective (do datadir <- liftIO getDataDir
1627+ return [PDirective (do dirs <- allImportDirs
1628− o <- liftIO $ findInPath [".", datadir] obj
1628+ o <- liftIO $ findInPath dirs obj
1629− addIBC (IBCObj cgn o)
1629+ addIBC (IBCObj cgn obj) -- just name, search on loading ibc
1630 addObjectFile cgn o)])
1630 addObjectFile cgn o)])
1631 <|> try (do lchar '%'; reserved "flag"; cgn <- pCodegen;
1631 <|> try (do lchar '%'; reserved "flag"; cgn <- pCodegen;
1632 flag <- strlit
1632 flag <- strlit
src/Pkg/Package.hs+3−3
@@ -34,9 +34,9 @@ buildPkg warnonly (install, fp)
34 = do pkgdesc <- parseDesc fp
34 = do pkgdesc <- parseDesc fp
35 ok <- mapM (testLib warnonly (pkgname pkgdesc)) (libdeps pkgdesc)
35 ok <- mapM (testLib warnonly (pkgname pkgdesc)) (libdeps pkgdesc)
36 when (and ok) $
36 when (and ok) $
37− do make (makefile pkgdesc)
38− dir <- getCurrentDirectory
37+ do dir <- getCurrentDirectory
39 setCurrentDirectory $ dir </> sourcedir pkgdesc
38 setCurrentDirectory $ dir </> sourcedir pkgdesc
39+ make (makefile pkgdesc)
40 case (execout pkgdesc) of
40 case (execout pkgdesc) of
41 Nothing -> buildMods (NoREPL : Verbose : idris_opts pkgdesc)
41 Nothing -> buildMods (NoREPL : Verbose : idris_opts pkgdesc)
42 (modules pkgdesc)
42 (modules pkgdesc)
@@ -50,9 +50,9 @@ buildPkg warnonly (install, fp)
50cleanPkg :: FilePath -> IO ()
50cleanPkg :: FilePath -> IO ()
51cleanPkg fp
51cleanPkg fp
52 = do pkgdesc <- parseDesc fp
52 = do pkgdesc <- parseDesc fp
53− clean (makefile pkgdesc)
54 dir <- getCurrentDirectory
53 dir <- getCurrentDirectory
55 setCurrentDirectory $ dir </> sourcedir pkgdesc
54 setCurrentDirectory $ dir </> sourcedir pkgdesc
55+ clean (makefile pkgdesc)
56 mapM_ rmIBC (modules pkgdesc)
56 mapM_ rmIBC (modules pkgdesc)
57 case execout pkgdesc of
57 case execout pkgdesc of
58 Nothing -> return ()
58 Nothing -> return ()