Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
Don't try to combine object files
Browse files Browse the repository at this point in the history
  • Loading branch information
TerrorJack committed May 26, 2020
1 parent 8bd5b82 commit 0085dcf
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions asterius/app/ahc-ar.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

-- |
-- Module : Main
-- Copyright : (c) 2018 EURL Tweag
Expand Down Expand Up @@ -32,16 +28,13 @@ module Main
where

import qualified Ar as GHC
import Asterius.Binary.ByteString
import Asterius.Binary.File
import Asterius.Binary.NameCache
import Asterius.Types
import qualified Data.ByteString as BS
import Data.Either
import Data.List
import Data.Traversable
import GHC.IO.Unsafe
import System.Environment.Blank
import System.Exit
import System.FilePath
import System.IO.Error

main :: IO ()
Expand Down Expand Up @@ -69,18 +62,17 @@ getAhcArArgs = getArgs >>= fmap concat . mapM expand
-- original object files from the archive, only their combination.
createArchive :: FilePath -> [FilePath] -> IO ()
createArchive arFile objFiles = do
ncu <- newNameCacheUpdater
objs <- rights <$> for objFiles (tryGetFile ncu)
contents <- putBS (mconcat objs :: AsteriusCachedModule)
blobs <- for objFiles (unsafeDupableInterleaveIO . BS.readFile)
GHC.writeGNUAr arFile $
GHC.Archive
[ GHC.ArchiveEntry
{ GHC.filename = "whatever",
{ GHC.filename = takeFileName obj_path,
GHC.filetime = 0,
GHC.fileown = 0,
GHC.filegrp = 0,
GHC.filemode = 0o644,
GHC.filesize = BS.length contents,
GHC.filedata = contents
GHC.filesize = BS.length blob,
GHC.filedata = blob
}
| (obj_path, blob) <- zip objFiles blobs
]

0 comments on commit 0085dcf

Please sign in to comment.