[commit: hadrian] master: Fix the path to touchy (#572) (32e26b0)

git at git.haskell.org git at git.haskell.org
Wed Apr 25 23:20:54 UTC 2018


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

On branch  : master
Link       : http://git.haskell.org/hadrian.git/commitdiff/32e26b0fa5adec71fa513a8e6e1d4d655fc562b7

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

commit 32e26b0fa5adec71fa513a8e6e1d4d655fc562b7
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Apr 16 20:01:00 2018 +0100

    Fix the path to touchy (#572)
    
    * Fix the path to touchy
    
    * Allow binaries to live in lib/bin


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

32e26b0fa5adec71fa513a8e6e1d4d655fc562b7
 src/GHC.hs           | 8 ++++++--
 src/Rules/Program.hs | 3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/GHC.hs b/src/GHC.hs
index 5a7dc31..0262823 100644
--- a/src/GHC.hs
+++ b/src/GHC.hs
@@ -128,8 +128,12 @@ installStage pkg
 -- | The 'FilePath' to a program executable in a given 'Context'.
 programPath :: Context -> Action FilePath
 programPath context at Context {..} = do
-    path    <- stageBinPath stage
-    pgm     <- programName context
+    -- The @touchy@ utility lives in the @lib/bin@ directory instead of @bin@,
+    -- which is likely just a historical accident that will hopefully be fixed.
+    -- See: https://github.com/snowleopard/hadrian/issues/570
+    path <- if package /= touchy then stageBinPath stage
+                                 else stageLibPath stage <&> (-/- "bin")
+    pgm  <- programName context
     return $ path -/- pgm <.> exe
 
 -- | Some contexts are special: their packages do not have @.cabal@ metadata or
diff --git a/src/Rules/Program.hs b/src/Rules/Program.hs
index 32a8eb8..67a310f 100644
--- a/src/Rules/Program.hs
+++ b/src/Rules/Program.hs
@@ -19,7 +19,8 @@ buildProgram :: [(Resource, Int)] -> Rules ()
 buildProgram rs = do
     root <- buildRootRules
     forM_ [Stage0 ..] $ \stage ->
-      root -/- stageString stage -/- "bin" -/- "*" %> \bin -> do
+      [ root -/- stageString stage -/- "bin"     -/- "*"
+      , root -/- stageString stage -/- "lib/bin" -/- "*" ] |%> \bin -> do
 
           -- quite inefficient. But we can't access the programName from
           -- Rules, as it's an Action, due to being backed by an Oracle.



More information about the ghc-commits mailing list