[commit: ghc] wip/nfs-locking: Use correct ar for host/target (#356) (b7550b2)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:19:47 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/b7550b2bdbd148e80e3d5b06419549bcb7ca92ee/ghc

>---------------------------------------------------------------

commit b7550b2bdbd148e80e3d5b06419549bcb7ca92ee
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Jul 10 13:40:54 2017 -0400

    Use correct ar for host/target (#356)
    
    Previously we would always use the ar of the target; this is incorrect.
    
    Fixes #350.


>---------------------------------------------------------------

b7550b2bdbd148e80e3d5b06419549bcb7ca92ee
 cfg/system.config.in              | 1 +
 src/Builder.hs                    | 2 +-
 src/Oracles/Path.hs               | 3 ++-
 src/Rules/Gmp.hs                  | 4 ++--
 src/Rules/Libffi.hs               | 2 +-
 src/Rules/Library.hs              | 4 ++--
 src/Settings/Builders/GhcCabal.hs | 4 ++--
 src/Util.hs                       | 2 +-
 8 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/cfg/system.config.in b/cfg/system.config.in
index 078e1ec..34ef7b9 100644
--- a/cfg/system.config.in
+++ b/cfg/system.config.in
@@ -16,6 +16,7 @@ make           = @MakeCmd@
 nm             = @NmCmd@
 objdump        = @ObjdumpCmd@
 ranlib         = @REAL_RANLIB_CMD@
+system-ar      = @AR_STAGE0@
 system-cc      = @CC_STAGE0@
 system-ghc     = @WithGhc@
 system-ghc-pkg = @GhcPkgCmd@
diff --git a/src/Builder.hs b/src/Builder.hs
index b2fbca3..7937319 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -28,7 +28,7 @@ data GhcPkgMode = Init | Update deriving (Eq, Generic, Show)
 -- @GhcPkg Stage0@ is the bootstrapping @GhcPkg at .
 -- @GhcPkg Stage1@ is the one built in Stage0.
 data Builder = Alex
-             | Ar
+             | Ar Stage
              | DeriveConstants
              | Cc CcMode Stage
              | Configure FilePath
diff --git a/src/Oracles/Path.hs b/src/Oracles/Path.hs
index a1c56f5..2ec2773 100644
--- a/src/Oracles/Path.hs
+++ b/src/Oracles/Path.hs
@@ -24,7 +24,8 @@ getTopDirectory = lift topDirectory
 systemBuilderPath :: Builder -> Action FilePath
 systemBuilderPath builder = case builder of
     Alex            -> fromKey "alex"
-    Ar              -> fromKey "ar"
+    Ar Stage0       -> fromKey "system-ar"
+    Ar _            -> fromKey "ar"
     Cc  _  Stage0   -> fromKey "system-cc"
     Cc  _  _        -> fromKey "cc"
     -- We can't ask configure for the path to configure!
diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index a3e32d3..ee8eb82 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -25,7 +25,7 @@ gmpMakefile = gmpBuildPath -/- "Makefile"
 
 configureEnvironment :: Action [CmdOption]
 configureEnvironment = sequence [ builderEnvironment "CC" $ Cc CompileC Stage1
-                                , builderEnvironment "AR" Ar
+                                , builderEnvironment "AR" (Ar Stage1)
                                 , builderEnvironment "NM" Nm ]
 
 gmpRules :: Rules ()
@@ -43,7 +43,7 @@ gmpRules = do
             putBuild "| No GMP library/framework detected; in tree GMP will be built"
             need [gmpLibrary]
             createDirectory gmpObjects
-            build $ Target gmpContext Ar [gmpLibrary] [gmpObjects]
+            build $ Target gmpContext (Ar Stage1) [gmpLibrary] [gmpObjects]
             copyFile (gmpBuildPath -/- "gmp.h") header
             copyFile (gmpBuildPath -/- "gmp.h") gmpLibraryInTreeH
 
diff --git a/src/Rules/Libffi.hs b/src/Rules/Libffi.hs
index 57f6263..bac9970 100644
--- a/src/Rules/Libffi.hs
+++ b/src/Rules/Libffi.hs
@@ -31,7 +31,7 @@ configureEnvironment = do
     sequence [ builderEnvironment "CC" $ Cc CompileC Stage1
              , builderEnvironment "CXX" $ Cc CompileC Stage1
              , builderEnvironment "LD" Ld
-             , builderEnvironment "AR" Ar
+             , builderEnvironment "AR" (Ar Stage1)
              , builderEnvironment "NM" Nm
              , builderEnvironment "RANLIB" Ranlib
              , return . AddEnv  "CFLAGS" $ unwords  cFlags ++ " -w"
diff --git a/src/Rules/Library.hs b/src/Rules/Library.hs
index 455c57c..b746279 100644
--- a/src/Rules/Library.hs
+++ b/src/Rules/Library.hs
@@ -72,8 +72,8 @@ buildPackageLibrary context at Context {..} = do
 
         asuf <- libsuf way
         let isLib0 = ("//*-0" ++ asuf) ?== a
-        if isLib0 then build $ Target context Ar []   [a] -- TODO: Scan for dlls
-                  else build $ Target context Ar objs [a]
+        if isLib0 then build $ Target context (Ar stage) []   [a] -- TODO: Scan for dlls
+                  else build $ Target context (Ar stage) objs [a]
 
         synopsis <- interpretInContext context $ getPkgData Synopsis
         unless isLib0 . putSuccess $ renderLibrary
diff --git a/src/Settings/Builders/GhcCabal.hs b/src/Settings/Builders/GhcCabal.hs
index 9ddfe15..18816e1 100644
--- a/src/Settings/Builders/GhcCabal.hs
+++ b/src/Settings/Builders/GhcCabal.hs
@@ -25,7 +25,7 @@ ghcCabalBuilderArgs = builder GhcCabal ? do
             , packageConstraints
             , withStaged $ Cc CompileC
             , notStage0 ? with Ld
-            , with Ar
+            , withStaged Ar
             , with Alex
             , with Happy
             , verbosity < Chatty ? append [ "-v0", "--configure-option=--quiet"
@@ -91,7 +91,7 @@ cppArgs = arg $ "-I" ++ generatedPath
 
 withBuilderKey :: Builder -> String
 withBuilderKey b = case b of
-    Ar         -> "--with-ar="
+    Ar _       -> "--with-ar="
     Ld         -> "--with-ld="
     Cc  _ _    -> "--with-gcc="
     Ghc _ _    -> "--with-ghc="
diff --git a/src/Util.hs b/src/Util.hs
index da12e21..944e8e5 100644
--- a/src/Util.hs
+++ b/src/Util.hs
@@ -53,7 +53,7 @@ customBuild rs opts target at Target {..} = do
     withResources rs $ do
         putInfo target
         quietlyUnlessVerbose $ case builder of
-            Ar -> do
+            Ar _ -> do
                 output <- interpret target getOutput
                 if "//*.a" ?== output
                 then arCmd path argList



More information about the ghc-commits mailing list