git.iko.soy/typeable/http-api-data
on master help sign in
Use absolute paths for includes
commitd350e418d8da602d31f1c6296a517047555617c8 authorOleg Grenrus <oleg.grenrus@iki.fi> dateMon 16 Jan 2017, 09:08 (10 years ago) parent8cc39ea
1 file changed+18−2
Setup.lhs+18−2
Setup.lhs+18−2
@@ -3,6 +3,9 @@
33#ifndef MIN_VERSION_Cabal
44#define MIN_VERSION_Cabal(x,y,z) 0
55#endif
6+#ifndef MIN_VERSION_directory
7+#define MIN_VERSION_directory(x,y,z) 0
8+#endif
69#if MIN_VERSION_Cabal(1,24,0)
710#define InstalledPackageId UnitId
811#endif
@@ -26,6 +29,19 @@ import System.FilePath ( (</>) )
2629import Distribution.Simple.BuildPaths ( autogenComponentModulesDir )
2730#endif
2831
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+
2945main :: IO ()
3046main = defaultMainWithHooks simpleUserHooks
3147 { buildHook = \pkg lbi hooks flags -> do
@@ -58,8 +74,8 @@ generateBuildModule flags pkg lbi = do
5874#endif
5975
6076 -- Lib sources and includes
61− let iArgs = map ("-i"++) $ libAutogenDir : hsSourceDirs libBI
62− let includeArgs = map ("-I"++) $ includeDirs libBI
77+ iArgs <- mapM (fmap ("-i"++) . makeAbsolute) $ libAutogenDir : hsSourceDirs libBI
78+ includeArgs <- mapM (fmap ("-I"++) . makeAbsolute) $ includeDirs libBI
6379
6480 -- CPP includes, i.e. include cabal_macros.h
6581 let cppFlags = map ("-optP"++) $