Sylvain Henry pushed to branch wip/mangoiv/hadrian-uncompressed-tar at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • changelog.d/hadrian-uncompressed-tar
    1
    +section: packaging
    
    2
    +synopsis: Hadrian can now create an uncompressed tar as the release artifact
    
    3
    +  by building the target binary-dist-tar
    
    4
    +issues: #27510
    
    5
    +mrs: !16349

  • hadrian/src/Rules/BinaryDist.hs
    ... ... @@ -366,9 +366,11 @@ bindistRules = do
    366 366
     
    
    367 367
                 -- Finally, we create the archive <root>/bindist/ghc-X.Y.Z-platform.tar.xz
    
    368 368
                 tarProg <- exeSpawnPath =<< builderPath (Tar Create)
    
    369
    -            cmdExe tarProg [Cwd $ root -/- bindist_folder]
    
    370
    -                [ "-c", compressorTarFlag compressor, "-f"
    
    371
    -                , ghcVersionPretty <.> "tar" <.> compressorExtension compressor
    
    369
    +            -- Compressor flags must come before the operands: bsdtar (used on
    
    370
    +            -- darwin) stops option parsing at the first non-option argument.
    
    371
    +            cmdExe tarProg [Cwd $ root -/- bindist_folder] $
    
    372
    +                [ "-c" ] <> compressorTarFlags compressor <>
    
    373
    +                [ "-f" , applyCompressorExtension compressor $ ghcVersionPretty <.> "tar"
    
    372 374
                     , ghcVersionPretty ]
    
    373 375
     
    
    374 376
         forM_ [("binary", buildBinDist), ("reloc-binary", buildBinDistReloc)] $ \(name, mk_bindist) -> do
    
    ... ... @@ -376,6 +378,7 @@ bindistRules = do
    376 378
           phony (name <> "-dist-gzip") $ mk_bindist Gzip
    
    377 379
           phony (name <> "-dist-bzip2") $ mk_bindist Bzip2
    
    378 380
           phony (name <> "-dist-xz") $ mk_bindist Xz
    
    381
    +      phony (name <> "-dist-tar") $ mk_bindist NoCompressor
    
    379 382
     
    
    380 383
         phony "binary-dist-cross" $ buildBinDistX "binary-dist-dir-cross" "bindist" Xz
    
    381 384
         phony "binary-dist-stage3" $ buildBinDistX "binary-dist-dir-stage3" "bindist" Xz
    
    ... ... @@ -426,7 +429,7 @@ bindistRules = do
    426 429
         fixup f | f `elem` ["INSTALL", "README"] = "distrib" -/- f
    
    427 430
                 | otherwise                      = f
    
    428 431
     
    
    429
    -data Compressor = Gzip | Bzip2 | Xz
    
    432
    +data Compressor = Gzip | Bzip2 | Xz | NoCompressor
    
    430 433
                     deriving (Eq, Ord, Show)
    
    431 434
     
    
    432 435
     
    
    ... ... @@ -443,17 +446,19 @@ generateBuildMk BindistConfig{..} = do
    443 446
       where
    
    444 447
         a =. b = a ++ " = " ++ b
    
    445 448
     
    
    446
    --- | Flag to pass to tar to use the given 'Compressor'.
    
    447
    -compressorTarFlag :: Compressor -> String
    
    448
    -compressorTarFlag Gzip  = "--gzip"
    
    449
    -compressorTarFlag Xz    = "--xz"
    
    450
    -compressorTarFlag Bzip2 = "--bzip"
    
    451
    -
    
    452
    --- | File extension to use for archives compressed with the given 'Compressor'.
    
    453
    -compressorExtension :: Compressor -> String
    
    454
    -compressorExtension Gzip  = "gz"
    
    455
    -compressorExtension Xz    = "xz"
    
    456
    -compressorExtension Bzip2 = "bz2"
    
    449
    +-- | Flags to pass to @tar@ to use the given 'Compressor'.
    
    450
    +compressorTarFlags :: Compressor -> [String]
    
    451
    +compressorTarFlags Gzip  = ["--gzip"]
    
    452
    +compressorTarFlags Xz    = ["--xz"  ]
    
    453
    +compressorTarFlags Bzip2 = ["--bzip"]
    
    454
    +compressorTarFlags NoCompressor = []
    
    455
    +
    
    456
    +-- | File extension to use for archives @p@ compressed with the given 'Compressor'.
    
    457
    +applyCompressorExtension :: Compressor -> String -> String
    
    458
    +applyCompressorExtension Gzip  p        = p <.> "gz"
    
    459
    +applyCompressorExtension Xz    p        = p <.> "xz"
    
    460
    +applyCompressorExtension Bzip2 p        = p <.> "bz2"
    
    461
    +applyCompressorExtension NoCompressor p = p
    
    457 462
     
    
    458 463
     -- | A list of files that allow us to support a simple
    
    459 464
     -- @./configure [...] && make install@ workflow.