[Git][ghc/ghc][master] hadrian: fix no_dynamic_libs flavour transformer

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu May 11 15:57:45 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
1bb24432 by Cheng Shao at 2023-05-11T11:57:15-04:00
hadrian: fix no_dynamic_libs flavour transformer

This patch fixes the no_dynamic_libs flavour transformer and make
fully_static reuse it. Previously building with no_dynamic_libs fails
since ghc program is still dynamic and transitively brings in dyn ways
of rts which are produced by no rules.

- - - - -


1 changed file:

- hadrian/src/Flavour.hs


Changes:

=====================================
hadrian/src/Flavour.hs
=====================================
@@ -243,10 +243,12 @@ enableProfiledGhc flavour =
 disableDynamicGhcPrograms :: Flavour -> Flavour
 disableDynamicGhcPrograms flavour = flavour { dynamicGhcPrograms = pure False }
 
--- | Don't build libraries in profiled 'Way's.
+-- | Don't build libraries in dynamic 'Way's.
 disableDynamicLibs :: Flavour -> Flavour
 disableDynamicLibs flavour =
-  flavour { libraryWays = prune $ libraryWays flavour
+  flavour { libraryWays = prune $ libraryWays flavour,
+            rtsWays = prune $ rtsWays flavour,
+            dynamicGhcPrograms = pure False
           }
   where
     prune :: Ways -> Ways
@@ -306,18 +308,8 @@ enableBootNonmovingGc = addArgs $ mconcat
 -- for static linking.
 fullyStatic :: Flavour -> Flavour
 fullyStatic flavour =
-    addArgs staticExec
-    $ flavour { dynamicGhcPrograms = return False
-              , libraryWays = prune $ libraryWays flavour
-              , rtsWays     = prune $ rtsWays flavour }
+    addArgs staticExec $ disableDynamicLibs flavour
   where
-    -- Remove any Way that contains a WayUnit of Dynamic
-    prune :: Ways -> Ways
-    prune = fmap $ Set.filter staticCompatible
-
-    staticCompatible :: Way -> Bool
-    staticCompatible = not . wayUnit Dynamic
-
     staticExec :: Args
     {- Some packages, especially iserv, seem to force a set of build ways,
      - including some that are dynamic (in Rules.BinaryDist).  Trying to
@@ -326,7 +318,7 @@ fullyStatic flavour =
      - the Ways will need to include a Way that's not explicitly dynamic
      - (like "vanilla").
      -}
-    staticExec = staticCompatible <$> getWay ? mconcat
+    staticExec = mconcat
         {-
          - Disable dynamic linking by the built ghc executable because the
          - statically-linked musl doesn't support dynamic linking, but will



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bb24432ff77e11a0340a7d8586e151e15bba2a1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bb24432ff77e11a0340a7d8586e151e15bba2a1
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230511/ba7a64fa/attachment-0001.html>


More information about the ghc-commits mailing list