[Git][ghc/ghc][wip/rts-configure-new-cabal] Get newer Cabal for Hadrian, use for `findPtr`

John Ericson (@Ericson2314) gitlab at gitlab.haskell.org
Sat Jan 21 01:48:43 UTC 2023



John Ericson pushed to branch wip/rts-configure-new-cabal at Glasgow Haskell Compiler / GHC


Commits:
eecd024b by John Ericson at 2023-01-20T20:48:06-05:00
Get newer Cabal for Hadrian, use for `findPtr`

There are many more things we would use this for, this is just a first
simple example to ensure the Cabal bump is working as intended.

The support for multiple package in `bootstrap.py` matches Cabal's
`bootstrap.py`, its inspiration, in order to keep it easy to sync
changes back and forth.

- - - - -


15 changed files:

- hadrian/bootstrap/bootstrap.py
- hadrian/bootstrap/plan-bootstrap-9_2_1.json
- hadrian/bootstrap/plan-bootstrap-9_2_2.json
- hadrian/bootstrap/plan-bootstrap-9_2_3.json
- hadrian/bootstrap/plan-bootstrap-9_2_4.json
- hadrian/bootstrap/plan-bootstrap-9_2_5.json
- hadrian/bootstrap/plan-bootstrap-9_4_1.json
- hadrian/bootstrap/plan-bootstrap-9_4_2.json
- hadrian/bootstrap/plan-bootstrap-9_4_3.json
- hadrian/cabal.project
- hadrian/hadrian.cabal
- hadrian/stack.yaml
- rts/configure.ac
- rts/external-symbols.list.in
- rts/rts.cabal.in


Changes:

=====================================
hadrian/bootstrap/bootstrap.py
=====================================
@@ -78,6 +78,8 @@ FetchInfo = NamedTuple('FetchInfo', [
 
 FetchPlan = Dict[Path, FetchInfo]
 
+local_packages: List[PackageName] = ["hadrian", "Cabal-syntax", "Cabal"]
+
 class Compiler:
     def __init__(self, ghc_path: Path):
         if not ghc_path.is_file():
@@ -173,7 +175,7 @@ def resolve_dep(dep : BootstrapDep) -> Path:
             shutil.copyfile(cabal_file, sdist_dir / f'{dep.package}.cabal')
 
     elif dep.source == PackageSource.LOCAL:
-        if dep.package == 'hadrian':
+        if dep.package in local_packages:
             sdist_dir = Path(sys.path[0]).parent.resolve()
         else:
             raise ValueError(f'Unknown local package {dep.package}')
@@ -341,7 +343,7 @@ def fetch_from_plan(plan : FetchPlan, output_dir : Path):
 def gen_fetch_plan(info : BootstrapInfo) -> FetchPlan :
     sources_dict = {}
     for dep in info.dependencies:
-      if dep.package != 'hadrian':
+      if not(dep.package in local_packages):
         sources_dict[f"{dep.package}-{dep.version}.tar.gz"] = FetchInfo(package_url(dep.package, dep.version), dep.src_sha256)
         if dep.revision is not None:
           sources_dict[f"{dep.package}.cabal"] = FetchInfo(package_cabal_url(dep.package, dep.version, dep.revision), dep.cabal_sha256)


=====================================
hadrian/bootstrap/plan-bootstrap-9_2_1.json
=====================================
@@ -83,10 +83,6 @@
     {
       "package": "process",
       "version": "1.6.13.2"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.6.0.0"
     }
   ],
   "dependencies": [
@@ -253,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/bootstrap/plan-bootstrap-9_2_2.json
=====================================
@@ -83,10 +83,6 @@
     {
       "package": "process",
       "version": "1.6.13.2"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.6.3.0"
     }
   ],
   "dependencies": [
@@ -253,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/bootstrap/plan-bootstrap-9_2_3.json
=====================================
@@ -83,10 +83,6 @@
     {
       "package": "process",
       "version": "1.6.13.2"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.6.3.0"
     }
   ],
   "dependencies": [
@@ -253,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/bootstrap/plan-bootstrap-9_2_4.json
=====================================
@@ -83,10 +83,6 @@
     {
       "package": "process",
       "version": "1.6.13.2"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.6.3.0"
     }
   ],
   "dependencies": [
@@ -253,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/bootstrap/plan-bootstrap-9_2_5.json
=====================================
@@ -83,10 +83,6 @@
     {
       "package": "process",
       "version": "1.6.16.0"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.6.3.0"
     }
   ],
   "dependencies": [
@@ -253,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/bootstrap/plan-bootstrap-9_4_1.json
=====================================
@@ -80,17 +80,9 @@
       "package": "parsec",
       "version": "3.1.15.0"
     },
-    {
-      "package": "Cabal-syntax",
-      "version": "3.8.1.0"
-    },
     {
       "package": "process",
       "version": "1.6.15.0"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.8.1.0"
     }
   ],
   "dependencies": [
@@ -257,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/bootstrap/plan-bootstrap-9_4_2.json
=====================================
@@ -80,17 +80,9 @@
       "package": "parsec",
       "version": "3.1.15.0"
     },
-    {
-      "package": "Cabal-syntax",
-      "version": "3.8.1.0"
-    },
     {
       "package": "process",
       "version": "1.6.15.0"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.8.1.0"
     }
   ],
   "dependencies": [
@@ -257,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/bootstrap/plan-bootstrap-9_4_3.json
=====================================
@@ -80,17 +80,9 @@
       "package": "parsec",
       "version": "3.1.15.0"
     },
-    {
-      "package": "Cabal-syntax",
-      "version": "3.8.1.0"
-    },
     {
       "package": "process",
       "version": "1.6.16.0"
-    },
-    {
-      "package": "Cabal",
-      "version": "3.8.1.0"
     }
   ],
   "dependencies": [
@@ -257,6 +249,24 @@
       "source": "local",
       "src_sha256": null,
       "version": "0.1.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
+    },
+    {
+      "cabal_sha256": null,
+      "flags": [],
+      "package": "Cabal-syntax",
+      "revision": null,
+      "source": "local",
+      "src_sha256": null,
+      "version": "3.9.0.0"
     }
   ]
 }


=====================================
hadrian/cabal.project
=====================================
@@ -1,4 +1,6 @@
 packages: ./
+-- N.B. This could be removed once Cabal 3.9 is released.
+packages: ../libraries/Cabal/Cabal, ../libraries/Cabal/Cabal-syntax
 
 -- This essentially freezes the build plan for hadrian
 index-state: 2022-11-19T22:13:06Z


=====================================
hadrian/hadrian.cabal
=====================================
@@ -149,7 +149,7 @@ executable hadrian
                        , TypeOperators
     other-extensions:    MultiParamTypeClasses
                        , TypeFamilies
-    build-depends:       Cabal                >= 3.2     && < 3.9
+    build-depends:       Cabal                >= 3.9     && < 3.10
                        , base                 >= 4.11    && < 5
                        , bytestring           >= 0.10    && < 0.12
                        , containers           >= 0.5     && < 0.7


=====================================
hadrian/stack.yaml
=====================================
@@ -2,6 +2,8 @@ resolver: lts-19.8
 
 packages:
 - '.'
+- '../libraries/Cabal/Cabal'
+- '../libraries/Cabal/Cabal-syntax'
 
 nix:
    enable: false


=====================================
rts/configure.ac
=====================================
@@ -62,8 +62,14 @@ dnl ######################################################################
 
 dnl See Note [Undefined symbols in the RTS]
 
+[
+symbolExtraDefs=''
+if [[ $CABAL_FLAG_find_ptr = 1 ]]; then
+    symbolExtraDefs+=' -DFIND_PTR'
+fi
+
 cat $srcdir/external-symbols.list.in \
-    | "$CC" -E -P -traditional -Iinclude - -o - \
+    | "$CC" $symbolExtraDefs -E -P -traditional -Iinclude - -o - \
     | sed '/^$/d' \
     > external-symbols.list \
     || exit 1
@@ -75,14 +81,17 @@ else
     sed 's/^/  -Wl,-u,/' external-symbols.tmp > external-symbols.list
 fi
 rm -f external-symbols.tmp
+]
 
 dnl ######################################################################
 dnl Generate build-info
 dnl ######################################################################
 
+[
 cat $srcdir/rts.buildinfo.in | \
     sed -e 's/^  *//' | \
     "$CC" -E -P -traditional - -o - \
     > rts.buildinfo
 echo "" >> rts.buildinfo
 rm -f external-symbols.list
+]


=====================================
rts/external-symbols.list.in
=====================================
@@ -19,6 +19,10 @@ hs_atomicwrite64
 base_GHCziEventziWindows_processRemoteCompletion_closure
 #endif
 
+#if FIND_PTR
+findPtr
+#endif
+
 base_GHCziTopHandler_runIO_closure
 base_GHCziTopHandler_runNonIO_closure
 ghczmprim_GHCziTupleziPrim_Z0T_closure


=====================================
rts/rts.cabal.in
=====================================
@@ -295,23 +295,6 @@ library
                         stg/Ticky.h
                         stg/Types.h
 
-      -- See Note [Undefined symbols in the RTS]
-      --
-      -- We should handle this symbol with the others in the configure script
-      -- once we are using Cabal containing
-      -- https://github.com/haskell/cabal/pull/8565 /
-      -- 30f8a46008d164b5c4c6ce0b4453eb93eb5ef46c.
-      if flag(leading-underscore)
-        if flag(find-ptr)
-          -- This symbol is useful in gdb, but not referred to anywhere,
-          -- so we need to force it to be included in the binary.
-          ld-options: "-Wl,-u,_findPtr"
-      else
-        if flag(find-ptr)
-          -- This symbol is useful in gdb, but not referred to anywhere,
-          -- so we need to force it to be included in the binary.
-          ld-options: "-Wl,-u,findPtr"
-
       if os(osx)
         ld-options: "-Wl,-search_paths_first"
                     -- See Note [fd_set_overflow]



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eecd024b029c3e51ecbbdbe4c7f09a822e6b3e95
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/20230120/b4c557d8/attachment-0001.html>


More information about the ghc-commits mailing list