From f8ad73b9d82fd71897535b60713cd74944648153 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 3 Nov 2020 10:18:21 +0100 Subject: [PATCH] haskell.compiler.ghc8102BinaryMinimal: init To stay within hydra limit of 2^31 output size on aarch64-linux --- .../compilers/ghc/8.10.2-binary.nix | 26 +++++++++++++++++-- pkgs/top-level/haskell-packages.nix | 15 +++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.10.2-binary.nix b/pkgs/development/compilers/ghc/8.10.2-binary.nix index 37238bb13bda..cc9491ede240 100644 --- a/pkgs/development/compilers/ghc/8.10.2-binary.nix +++ b/pkgs/development/compilers/ghc/8.10.2-binary.nix @@ -2,6 +2,14 @@ , fetchurl, perl, gcc , ncurses6, gmp, glibc, libiconv, numactl , llvmPackages + + # minimal = true; will remove files that aren't strictly necessary for + # regular builds and GHC bootstrapping. + # This is "useful" for staying within hydra's output limits for at least the + # aarch64-linux architecture. + # Examples of unnecessary files are the bundled documentation and files that + # are only needed for profiling builds. +, minimal ? false }: # Prebuilt only does native @@ -172,6 +180,13 @@ stdenv.mkDerivation rec { for file in $(find "$out" -name setup-config); do substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)" done + '' + + stdenv.lib.optionalString minimal '' + # Remove profiling objects + find $out -type f -name '*.p_o' -delete + rm $out/lib/ghc-*/bin/ghc-iserv-prof + # Remove docs + rm -r $out/share/{doc,man} ''; doInstallCheck = true; @@ -195,11 +210,18 @@ stdenv.mkDerivation rec { enableShared = true; }; - meta = { + meta = let + platforms = ["x86_64-linux" "armv7l-linux" "aarch64-linux" "i686-linux" "x86_64-darwin"]; + in { homepage = "http://haskell.org/ghc"; description = "The Glasgow Haskell Compiler"; license = stdenv.lib.licenses.bsd3; - platforms = ["x86_64-linux" "armv7l-linux" "aarch64-linux" "i686-linux" "x86_64-darwin"]; + + # The minimal variation can not be distributed because it removes the + # documentation, including licensing information that is required for + # distribution. + inherit platforms; + hydraPlatforms = stdenv.lib.optionals (!minimal) platforms; maintainers = with stdenv.lib.maintainers; [ lostnet ]; }; } diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 0db955c2ae48..da73a4a30518 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -54,6 +54,11 @@ in { llvmPackages = pkgs.llvmPackages_9; }; + ghc8102BinaryMinimal = callPackage ../development/compilers/ghc/8.10.2-binary.nix { + llvmPackages = pkgs.llvmPackages_9; + minimal = true; + }; + ghc865 = callPackage ../development/compilers/ghc/8.6.5.nix { bootPkgs = packages.ghc822Binary; inherit (buildPackages.python3Packages) sphinx; @@ -75,7 +80,7 @@ in { ghc884 = callPackage ../development/compilers/ghc/8.8.4.nix { # aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar bootPkgs = if stdenv.isAarch64 then - packages.ghc8102Binary + packages.ghc8102BinaryMinimal else packages.ghc865Binary; inherit (buildPackages.python3Packages) sphinx; @@ -91,7 +96,7 @@ in { ghc8102 = callPackage ../development/compilers/ghc/8.10.2.nix { # aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar bootPkgs = if stdenv.isAarch64 then - packages.ghc8102Binary + packages.ghc8102BinaryMinimal else packages.ghc865Binary; inherit (buildPackages.python3Packages) sphinx; @@ -164,6 +169,12 @@ in { compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.10.x.nix { }; packageSetConfig = bootstrapPackageSet; }; + ghc8102BinaryMinimal = callPackage ../development/haskell-modules { + buildHaskellPackages = bh.packages.ghc8102BinaryMinimal; + ghc = bh.compiler.ghc8102BinaryMinimal; + compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.10.x.nix { }; + packageSetConfig = bootstrapPackageSet; + }; ghc865 = callPackage ../development/haskell-modules { buildHaskellPackages = bh.packages.ghc865; ghc = bh.compiler.ghc865;