git.iko.soy/typeable/http-api-data
on master help sign in
Use absolute paths for includes
d350e41Oleg Grenrus
Setup.lhs+18−2
@@ -3,6 +3,9 @@
3#ifndef MIN_VERSION_Cabal
3#ifndef MIN_VERSION_Cabal
4#define MIN_VERSION_Cabal(x,y,z) 0
4#define MIN_VERSION_Cabal(x,y,z) 0
5#endif
5#endif
6+#ifndef MIN_VERSION_directory
7+#define MIN_VERSION_directory(x,y,z) 0
8+#endif
6#if MIN_VERSION_Cabal(1,24,0)
9#if MIN_VERSION_Cabal(1,24,0)
7#define InstalledPackageId UnitId
10#define InstalledPackageId UnitId
8#endif
11#endif
@@ -26,6 +29,19 @@ import System.FilePath ( (</>) )
26import Distribution.Simple.BuildPaths ( autogenComponentModulesDir )
29import Distribution.Simple.BuildPaths ( autogenComponentModulesDir )
27#endif
30#endif
28
31
32+#if MIN_VERSION_directory(1,2,2)
33+import System.Directory (makeAbsolute)
34+#else
35+import System.Directory (getCurrentDirectory)
36+import System.FilePath (isAbsolute)
37+
38+makeAbsolute :: FilePath -> IO FilePath
39+makeAbsolute p | isAbsolute p = return p
40+ | otherwise = do
41+ cwd <- getCurrentDirectory
42+ return $ cwd </> p
43+#endif
44+
29main :: IO ()
45main :: IO ()
30main = defaultMainWithHooks simpleUserHooks
46main = defaultMainWithHooks simpleUserHooks
31 { buildHook = \pkg lbi hooks flags -> do
47 { buildHook = \pkg lbi hooks flags -> do
@@ -58,8 +74,8 @@ generateBuildModule flags pkg lbi = do
58#endif
74#endif
59
75
60 -- Lib sources and includes
76 -- Lib sources and includes
61− let iArgs = map ("-i"++) $ libAutogenDir : hsSourceDirs libBI
77+ iArgs <- mapM (fmap ("-i"++) . makeAbsolute) $ libAutogenDir : hsSourceDirs libBI
62− let includeArgs = map ("-I"++) $ includeDirs libBI
78+ includeArgs <- mapM (fmap ("-I"++) . makeAbsolute) $ includeDirs libBI
63
79
64 -- CPP includes, i.e. include cabal_macros.h
80 -- CPP includes, i.e. include cabal_macros.h
65 let cppFlags = map ("-optP"++) $
81 let cppFlags = map ("-optP"++) $