@@ -19,6 +19,9 @@ import Paths
19
19
import PlatformDB
20
20
import Types
21
21
import Utils
22
+ import Control.Exception (evaluate )
23
+ import Data.List
24
+ import Data.Char
22
25
23
26
24
27
targetRules :: BuildConfig -> Rules ()
@@ -70,7 +73,8 @@ buildAction buildDir hpRel bc = do
70
73
removeDirectoryRecursive depsDB
71
74
localCommand' [] " ghc-pkg" [" init" , depsDB]
72
75
forM_ deps $ \ d -> do
73
- let targetconf = packageTargetConf d
76
+
77
+ let targetconf = packageInplaceConf d
74
78
hasTargetconf <- doesFileExist targetconf
75
79
when hasTargetconf $
76
80
localCommand' [] " ghc-pkg"
@@ -95,7 +99,8 @@ buildAction buildDir hpRel bc = do
95
99
cabal " register"
96
100
[" --inplace"
97
101
, " --gen-pkg-config=" ++ packageInplaceConf pkg `relativeToDir` buildDir]
98
-
102
+ stripAbiDepends (packageInplaceConf pkg)
103
+ stripAbiDepends (packageTargetConf pkg)
99
104
cReadArgs <- map (haddockReadArg . osGhcPkgPathMunge pkgHtmlDir)
100
105
<$> haddockAllCorePkgLocs hpRel bc
101
106
pReadArgs <- map (haddockReadArg . osPlatformPkgPathMunge pkgHtmlDir)
@@ -168,3 +173,12 @@ installRules bc = do
168
173
osPackageInstallAction pkg
169
174
where
170
175
OS {.. } = osFromConfig bc
176
+
177
+ stripAbiDepends :: FilePath -> Action ()
178
+ stripAbiDepends f = do
179
+ hasF <- doesFileExist f
180
+ when hasF $ liftIO $ do
181
+ ls <- lines <$> readFile f
182
+ _ <- evaluate $ length ls
183
+ let (l1,l2) = break (" abi-depends:" `isPrefixOf` ) ls
184
+ writeFile f $ unlines $ l1 ++ (dropWhile (all isSeparator . take 1 ) (drop 1 l2))
0 commit comments