Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit 330be7b

Browse files
authored
Merge pull request #293 from haskell/fix-abi-issues
fix abi depends
2 parents fbef607 + 5aa727e commit 330be7b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

hptool/src/Target.hs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import Paths
1919
import PlatformDB
2020
import Types
2121
import Utils
22+
import Control.Exception(evaluate)
23+
import Data.List
24+
import Data.Char
2225

2326

2427
targetRules :: BuildConfig -> Rules ()
@@ -70,7 +73,8 @@ buildAction buildDir hpRel bc = do
7073
removeDirectoryRecursive depsDB
7174
localCommand' [] "ghc-pkg" ["init", depsDB]
7275
forM_ deps $ \d -> do
73-
let targetconf = packageTargetConf d
76+
77+
let targetconf = packageInplaceConf d
7478
hasTargetconf <- doesFileExist targetconf
7579
when hasTargetconf $
7680
localCommand' [] "ghc-pkg"
@@ -95,7 +99,8 @@ buildAction buildDir hpRel bc = do
9599
cabal "register"
96100
["--inplace"
97101
, "--gen-pkg-config=" ++ packageInplaceConf pkg `relativeToDir` buildDir]
98-
102+
stripAbiDepends (packageInplaceConf pkg)
103+
stripAbiDepends (packageTargetConf pkg)
99104
cReadArgs <- map (haddockReadArg . osGhcPkgPathMunge pkgHtmlDir)
100105
<$> haddockAllCorePkgLocs hpRel bc
101106
pReadArgs <- map (haddockReadArg . osPlatformPkgPathMunge pkgHtmlDir)
@@ -168,3 +173,12 @@ installRules bc = do
168173
osPackageInstallAction pkg
169174
where
170175
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

Comments
 (0)