Commit 65e0de80 authored by ka2_mail's avatar ka2_mail
Browse files

Bugfix. Since the .o files are only added to library, it will grow after each...

Bugfix. Since the .o files are only added to library, it will grow after each build. The fix is to remove libHS*.a file before build.
parent 150a9710
...@@ -61,9 +61,11 @@ import Distribution.Simple.Utils (rawSystemExit, setupMessage, ...@@ -61,9 +61,11 @@ import Distribution.Simple.Utils (rawSystemExit, setupMessage,
import Control.Monad (when, unless) import Control.Monad (when, unless)
import Control.Exception (try)
import Data.List(intersperse, nub) import Data.List(intersperse, nub)
import Data.Maybe(fromJust) import Data.Maybe(fromJust)
import System.Environment (getEnv) import System.Environment (getEnv)
import System.Directory (removeFile)
import qualified Distribution.Simple.GHCPackageConfig as GHC (localPackageConfig) import qualified Distribution.Simple.GHCPackageConfig as GHC (localPackageConfig)
#ifdef DEBUG #ifdef DEBUG
...@@ -124,8 +126,9 @@ buildGHC pref pkg_descr lbi = do ...@@ -124,8 +126,9 @@ buildGHC pref pkg_descr lbi = do
cObjs = [ path `joinFilenameDir` file `joinExt` objsuffix cObjs = [ path `joinFilenameDir` file `joinExt` objsuffix
| (path, file, _) <- (map splitFilePath (cSources build)) ] | (path, file, _) <- (map splitFilePath (cSources build)) ]
lib = mkLibName pref (showPackageId (package pkg_descr)) lib = mkLibName pref (showPackageId (package pkg_descr))
unless (null hObjs && null cObjs) unless (null hObjs && null cObjs) $ do
(rawSystemPathExit "ar" (["q", lib] ++ [pathJoin [pref, x] | x <- hObjs ++ cObjs])) try (removeFile lib) -- first remove library if it exists
rawSystemPathExit "ar" (["q", lib] ++ [pathJoin [pref, x] | x <- hObjs ++ cObjs])
-- build any executables -- build any executables
sequence_ [ do let args = ["-package-conf", pkgConf, sequence_ [ do let args = ["-package-conf", pkgConf,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment