Commit 831b3da7 authored by Liyang HU's avatar Liyang HU
Browse files

Distribution.Simple: remove ranlibProgram; was workaround for old OS X ld issues

∙ At one point under OS X, ld required the mtime of the symbol table to be
  not older than that of the archive itself. This means that even copying an
  .a file required invoking ranlib to update the symbol table mtime.
∙ However running ranlib renders pointless the deterministic mode of #1537.
∙ As of at least 2008 according to the BUGS section of ranlib(1), this has
  no longer been necessary.

First introduction: 12b35902
Current implementation: af3da760
parent 2b69a589
......@@ -105,7 +105,7 @@ import Distribution.Simple.Program
, requireProgramVersion, requireProgram
, userMaybeSpecifyPath, programPath, lookupProgram, addKnownProgram
, ghcProgram, ghcPkgProgram, hsc2hsProgram
, arProgram, ranlibProgram, ldProgram
, arProgram, ldProgram
, gccProgram, stripProgram )
import qualified Distribution.Simple.Program.HcPkg as HcPkg
import qualified Distribution.Simple.Program.Ar as Ar
......@@ -1304,12 +1304,6 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do
whenGHCi $ mapM_ (copy builtDir targetDir) ghciLibNames
whenShared $ mapM_ (copyShared builtDir dynlibTargetDir) sharedLibNames
-- run ranlib if necessary:
whenVanilla $ mapM_ (updateLibArchive verbosity lbi . (targetDir </>))
vanillaLibNames
whenProf $ mapM_ (updateLibArchive verbosity lbi . (targetDir </>))
profileLibNames
where
cid = compilerId (compiler lbi)
libNames = componentLibraries clbi
......@@ -1325,18 +1319,6 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do
whenGHCi = when (hasLib && withGHCiLib lbi)
whenShared = when (hasLib && withSharedLib lbi)
-- | On MacOS X we have to call @ranlib@ to regenerate the archive index after
-- copying. This is because the silly MacOS X linker checks that the archive
-- index is not older than the file itself, which means simply
-- copying/installing the file breaks it!!
--
updateLibArchive :: Verbosity -> LocalBuildInfo -> FilePath -> IO ()
updateLibArchive verbosity lbi path
| buildOS == OSX = do
(ranlib, _) <- requireProgram verbosity ranlibProgram (withPrograms lbi)
rawSystemProgram verbosity ranlib [path]
| otherwise = return ()
-- -----------------------------------------------------------------------------
-- Registering
......
......@@ -96,7 +96,7 @@ import Distribution.Simple.Program
, rawSystemProgramStdout, rawSystemProgramStdoutConf
, requireProgramVersion
, userMaybeSpecifyPath, programPath, lookupProgram, addKnownProgram
, arProgram, ranlibProgram, ldProgram
, arProgram, ldProgram
, gccProgram, stripProgram
, lhcProgram, lhcPkgProgram )
import qualified Distribution.Simple.Program.HcPkg as HcPkg
......@@ -783,12 +783,6 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do
ifGHCi $ mapM_ (copy builtDir targetDir) ghciLibNames
ifShared $ mapM_ (copy builtDir dynlibTargetDir) sharedLibNames
-- run ranlib if necessary:
ifVanilla $ mapM_ (updateLibArchive verbosity lbi . (targetDir </>))
vanillaLibNames
ifProf $ mapM_ (updateLibArchive verbosity lbi . (targetDir </>))
profileLibNames
where
cid = compilerId (compiler lbi)
libNames = componentLibraries clbi
......@@ -806,20 +800,6 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do
runLhc = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi)
-- | use @ranlib@ or @ar -s@ to build an index. This is necessary on systems
-- like MacOS X. If we can't find those, don't worry too much about it.
--
updateLibArchive :: Verbosity -> LocalBuildInfo -> FilePath -> IO ()
updateLibArchive verbosity lbi path =
case lookupProgram ranlibProgram (withPrograms lbi) of
Just ranlib -> rawSystemProgram verbosity ranlib [path]
Nothing -> case lookupProgram arProgram (withPrograms lbi) of
Just ar -> rawSystemProgram verbosity ar ["-s", path]
Nothing -> warn verbosity $
"Unable to generate a symbol index for the static "
++ "library '" ++ path
++ "' (missing the 'ranlib' and 'ar' programs)"
-- -----------------------------------------------------------------------------
-- Registering
......
......@@ -100,7 +100,6 @@ module Distribution.Simple.Program (
, ffihugsProgram
, uhcProgram
, gccProgram
, ranlibProgram
, arProgram
, stripProgram
, happyProgram
......
......@@ -29,7 +29,6 @@ module Distribution.Simple.Program.Builtin (
haskellSuitePkgProgram,
uhcProgram,
gccProgram,
ranlibProgram,
arProgram,
stripProgram,
happyProgram,
......@@ -88,7 +87,6 @@ builtinPrograms =
, greencardProgram
-- platform toolchain
, gccProgram
, ranlibProgram
, arProgram
, stripProgram
, ldProgram
......@@ -237,9 +235,6 @@ gccProgram = (simpleProgram "gcc") {
programFindVersion = findProgramVersion "-dumpversion" id
}
ranlibProgram :: Program
ranlibProgram = simpleProgram "ranlib"
arProgram :: Program
arProgram = simpleProgram "ar"
......
Markdown is supported
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