[Git][ghc/ghc][wip/release-fixes] 2 commits: hadrian/bindist: Eliminate extraneous `dirname` invocation

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Mon Mar 11 21:56:04 UTC 2024



Ben Gamari pushed to branch wip/release-fixes at Glasgow Haskell Compiler / GHC


Commits:
fe9f4cda by Ben Gamari at 2024-03-11T17:55:48-04:00
hadrian/bindist: Eliminate extraneous `dirname` invocation

Previously we would call `dirname` twice per installed library file.
We now instead reuse this result. This helps appreciably on Windows, where
processes are quite expensive.

- - - - -
069a38ec by Ben Gamari at 2024-03-11T17:55:57-04:00
hadrian: Package mingw toolchain in expected location

This fixes #24525, a regression due to 41cbaf44a6ab5eb9fa676d65d32df8377898dc89.
Specifically, GHC expects to find the mingw32 toolchain in the binary distribution
root. However, after this patch it was packaged in the `lib/` directory.

- - - - -


2 changed files:

- hadrian/bindist/Makefile
- hadrian/src/Rules/BinaryDist.hs


Changes:

=====================================
hadrian/bindist/Makefile
=====================================
@@ -175,18 +175,19 @@ install_lib: lib/settings
 	@dest="$(DESTDIR)$(ActualLibsDir)"; \
 	cd lib; \
 	for i in `$(FIND) . -type f`; do \
-		$(INSTALL_DIR) "$$dest/`dirname $$i`" ; \
+		dir="`dirname $$i`"; \
+		$(INSTALL_DIR) "$$dest/$$dir" ; \
 		case $$i in \
 		  *.a) \
-		    $(INSTALL_DATA) $$i "$$dest/`dirname $$i`" ; \
+		    $(INSTALL_DATA) $$i "$$dest/$$dir" ; \
 		    $(RANLIB_CMD) "$$dest"/$$i ;; \
 		  *.dll) \
-		    $(INSTALL_PROGRAM) $$i "$$dest/`dirname $$i`" ; \
+		    $(INSTALL_PROGRAM) $$i "$$dest/$$dir" ; \
 		    $(STRIP_CMD) "$$dest"/$$i ;; \
 		  *.so) \
-		    $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \
+		    $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \
 		  *.dylib) \
-		    $(INSTALL_SHLIB) $$i "$$dest/`dirname $$i`" ;; \
+		    $(INSTALL_SHLIB) $$i "$$dest/$$dir" ;; \
 		  *.mjs) \
 		    $(INSTALL_SCRIPT) $$i "$$dest/`dirname $$i`" ;; \
 		  *) \


=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -135,7 +135,8 @@ bindistRules = do
         let ghcVersionPretty = "ghc-" ++ version ++ "-" ++ targetPlatform
         let prefix = cwd -/- root -/- "reloc-bindist" -/- ghcVersionPretty
         installTo Relocatable prefix
-
+        copyDirectory (root -/- "mingw") prefix
+        liftIO $ IO.removeDirectoryRecursive (prefix -/- "lib" -/- "mingw")
 
     phony "install" $ do
         need ["binary-dist-dir"]
@@ -145,8 +146,6 @@ bindistRules = do
         installTo NotRelocatable installPrefix
 
     phony "binary-dist-dir" $ do
-
-
         version        <- setting ProjectVersion
         targetPlatform <- setting TargetPlatformFull
         distDir        <- Context.distDir Stage1
@@ -309,7 +308,7 @@ bindistRules = do
 
     let buildBinDist compressor = do
           win_target <- isWinTarget
-          when win_target (error "normal binary-dist does not work for windows target, use `reloc-binary-dist-*` target instead.")
+          when win_target (error "normal binary-dist does not work for Windows targets, use `reloc-binary-dist-*` target instead.")
           buildBinDistX "binary-dist-dir" "bindist" compressor
         buildBinDistReloc = buildBinDistX "reloc-binary-dist-dir" "reloc-bindist"
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c32c59b924f59ce0718f5894b7ff0ebdb85fe65...069a38ec2120f10fdfe40e3fa2807b93c03857d1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c32c59b924f59ce0718f5894b7ff0ebdb85fe65...069a38ec2120f10fdfe40e3fa2807b93c03857d1
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/20240311/45a8ea03/attachment-0001.html>


More information about the ghc-commits mailing list