lol

Merge pull request #40996 from obsidiansystems/cross-ghc

ghc, haskell-infra: #40929 take 2

authored by

John Ericson and committed by
GitHub
ce0180df a0c480ab

+155 -58
+13 -3
pkgs/development/compilers/ghc/7.10.3.nix
··· 24 , # Whether to build dynamic libs for the standard library (on the target 25 # platform). Static libs are always built. 26 enableShared ? true 27 }: 28 29 assert !enableIntegerSimple -> gmp != null; ··· 42 }; 43 44 buildMK = '' 45 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 46 '' + stdenv.lib.optionalString enableIntegerSimple '' 47 INTEGER_LIBRARY = integer-simple 48 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 49 - BuildFlavour = perf-cross 50 Stage1Only = YES 51 HADDOCK_DOCS = NO 52 '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' ··· 68 targetCC = builtins.head toolsForTarget; 69 70 in 71 - 72 stdenv.mkDerivation rec { 73 version = "7.10.3"; 74 name = "${targetPrefix}ghc-${version}"; ··· 86 docFixes 87 ./relocation.patch 88 ]; 89 90 # GHC is a bit confused on its cross terminology. 91 preConfigure = '' ··· 103 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 104 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 105 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 106 echo -n "${buildMK}" > mk/build.mk 107 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 108 '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' ··· 135 crossConfig = true; 136 137 nativeBuildInputs = [ 138 - ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour 139 ]; 140 141 # For building runtime libs
··· 24 , # Whether to build dynamic libs for the standard library (on the target 25 # platform). Static libs are always built. 26 enableShared ? true 27 + 28 + , # What flavour to build. An empty string indicates no 29 + # specific flavour and falls back to ghc default values. 30 + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" 31 }: 32 33 assert !enableIntegerSimple -> gmp != null; ··· 46 }; 47 48 buildMK = '' 49 + BuildFlavour = ${ghcFlavour} 50 + ifneq \"\$(BuildFlavour)\" \"\" 51 + include mk/flavours/\$(BuildFlavour).mk 52 + endif 53 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 54 '' + stdenv.lib.optionalString enableIntegerSimple '' 55 INTEGER_LIBRARY = integer-simple 56 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 57 Stage1Only = YES 58 HADDOCK_DOCS = NO 59 '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' ··· 75 targetCC = builtins.head toolsForTarget; 76 77 in 78 stdenv.mkDerivation rec { 79 version = "7.10.3"; 80 name = "${targetPrefix}ghc-${version}"; ··· 92 docFixes 93 ./relocation.patch 94 ]; 95 + 96 + postPatch = "patchShebangs ."; 97 98 # GHC is a bit confused on its cross terminology. 99 preConfigure = '' ··· 111 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 112 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 113 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 114 + 115 echo -n "${buildMK}" > mk/build.mk 116 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 117 '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' ··· 144 crossConfig = true; 145 146 nativeBuildInputs = [ 147 + perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 148 + ghc hscolour 149 ]; 150 151 # For building runtime libs
+19 -5
pkgs/development/compilers/ghc/8.0.2.nix
··· 23 , # Whether to build dynamic libs for the standard library (on the target 24 # platform). Static libs are always built. 25 enableShared ? true 26 }: 27 28 assert !enableIntegerSimple -> gmp != null; ··· 36 "${targetPlatform.config}-"; 37 38 buildMK = '' 39 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 40 '' + stdenv.lib.optionalString enableIntegerSimple '' 41 INTEGER_LIBRARY = integer-simple 42 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 43 - BuildFlavour = perf-cross 44 Stage1Only = YES 45 HADDOCK_DOCS = NO 46 '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' ··· 87 ++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch 88 ++ stdenv.lib.optional stdenv.isDarwin ./backport-dylib-command-size-limit.patch; 89 90 # GHC is a bit confused on its cross terminology. 91 preConfigure = '' 92 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do ··· 103 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 104 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 105 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 106 echo -n "${buildMK}" > mk/build.mk 107 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 108 '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' ··· 134 # masss-rebuild. 135 crossConfig = true; 136 137 - nativeBuildInputs = [ ghc perl hscolour sphinx ]; 138 139 # For building runtime libs 140 depsBuildTarget = toolsForTarget; ··· 151 # that in turn causes GHCi to abort 152 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; 153 154 - # zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't 155 - # treat that as a unary `{x,y,z,..}` repetition. 156 postInstall = '' 157 - paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} 158 159 # Install the bash completion file. 160 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
··· 23 , # Whether to build dynamic libs for the standard library (on the target 24 # platform). Static libs are always built. 25 enableShared ? true 26 + 27 + , # What flavour to build. An empty string indicates no 28 + # specific flavour and falls back to ghc default values. 29 + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" 30 }: 31 32 assert !enableIntegerSimple -> gmp != null; ··· 40 "${targetPlatform.config}-"; 41 42 buildMK = '' 43 + BuildFlavour = ${ghcFlavour} 44 + ifneq \"\$(BuildFlavour)\" \"\" 45 + include mk/flavours/\$(BuildFlavour).mk 46 + endif 47 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 48 '' + stdenv.lib.optionalString enableIntegerSimple '' 49 INTEGER_LIBRARY = integer-simple 50 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 51 Stage1Only = YES 52 HADDOCK_DOCS = NO 53 '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' ··· 94 ++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch 95 ++ stdenv.lib.optional stdenv.isDarwin ./backport-dylib-command-size-limit.patch; 96 97 + postPatch = "patchShebangs ."; 98 + 99 # GHC is a bit confused on its cross terminology. 100 preConfigure = '' 101 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do ··· 112 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 113 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 114 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 115 + 116 echo -n "${buildMK}" > mk/build.mk 117 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 118 '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' ··· 144 # masss-rebuild. 145 crossConfig = true; 146 147 + nativeBuildInputs = [ 148 + perl sphinx 149 + ghc hscolour 150 + ]; 151 152 # For building runtime libs 153 depsBuildTarget = toolsForTarget; ··· 164 # that in turn causes GHCi to abort 165 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; 166 167 postInstall = '' 168 + for bin in "$out"/lib/${name}/bin/*; do 169 + isELF "$bin" || continue 170 + paxmark m "$bin" 171 + done 172 173 # Install the bash completion file. 174 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
+17 -9
pkgs/development/compilers/ghc/8.2.2.nix
··· 23 24 , # Whether to build dynamic libs for the standard library (on the target 25 # platform). Static libs are always built. 26 - enableShared ? 27 - !(targetPlatform.isDarwin 28 - # On iOS, dynamic linking is not supported 29 - && (targetPlatform.isAarch64 || targetPlatform.isAarch32)) 30 , # Whether to backport https://phabricator.haskell.org/D4388 for 31 # deterministic profiling symbol names, at the cost of a slightly 32 # non-standard GHC API ··· 44 "${targetPlatform.config}-"; 45 46 buildMK = '' 47 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 48 '' + stdenv.lib.optionalString enableIntegerSimple '' 49 INTEGER_LIBRARY = integer-simple 50 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 51 - BuildFlavour = perf-cross 52 Stage1Only = YES 53 HADDOCK_DOCS = NO 54 BUILD_SPHINX_HTML = NO ··· 153 # masss-rebuild. 154 crossConfig = true; 155 156 - nativeBuildInputs = [ alex autoconf autoreconfHook automake ghc happy hscolour perl python3 sphinx ]; 157 158 # For building runtime libs 159 depsBuildTarget = toolsForTarget; ··· 172 173 checkTarget = "test"; 174 175 - # zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't 176 - # treat that as a unary `{x,y,z,..}` repetition. 177 postInstall = '' 178 - paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} 179 180 # Install the bash completion file. 181 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
··· 23 24 , # Whether to build dynamic libs for the standard library (on the target 25 # platform). Static libs are always built. 26 + enableShared ? true 27 + 28 + , # What flavour to build. An empty string indicates no 29 + # specific flavour and falls back to ghc default values. 30 + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" 31 , # Whether to backport https://phabricator.haskell.org/D4388 for 32 # deterministic profiling symbol names, at the cost of a slightly 33 # non-standard GHC API ··· 45 "${targetPlatform.config}-"; 46 47 buildMK = '' 48 + BuildFlavour = ${ghcFlavour} 49 + ifneq \"\$(BuildFlavour)\" \"\" 50 + include mk/flavours/\$(BuildFlavour).mk 51 + endif 52 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 53 '' + stdenv.lib.optionalString enableIntegerSimple '' 54 INTEGER_LIBRARY = integer-simple 55 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 56 Stage1Only = YES 57 HADDOCK_DOCS = NO 58 BUILD_SPHINX_HTML = NO ··· 157 # masss-rebuild. 158 crossConfig = true; 159 160 + nativeBuildInputs = [ 161 + autoconf autoreconfHook automake perl python3 sphinx 162 + ghc alex happy hscolour 163 + ]; 164 165 # For building runtime libs 166 depsBuildTarget = toolsForTarget; ··· 179 180 checkTarget = "test"; 181 182 postInstall = '' 183 + for bin in "$out"/lib/${name}/bin/*; do 184 + isELF "$bin" || continue 185 + paxmark m "$bin" 186 + done 187 188 # Install the bash completion file. 189 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
+25 -13
pkgs/development/compilers/ghc/8.4.2.nix
··· 3 4 # build-tools 5 , bootPkgs, alex, happy 6 - , autoconf, automake, coreutils, fetchurl, fetchpatch, perl, python3 7 8 , libffi, libiconv ? null, ncurses 9 ··· 15 16 , # If enabled, GHC will be built with the GPL-free but slower integer-simple 17 # library instead of the faster but GPLed integer-gmp library. 18 - enableIntegerSimple ? false, gmp ? null, m4 19 20 , # If enabled, use -fPIC when compiling static libs. 21 enableRelocatedStaticLibs ? targetPlatform != hostPlatform 22 23 , # Whether to build dynamic libs for the standard library (on the target 24 # platform). Static libs are always built. 25 - enableShared ? !targetPlatform.useAndroidPrebuilt 26 27 - , version ? "8.4.2" 28 }: 29 30 assert !enableIntegerSimple -> gmp != null; ··· 38 "${targetPlatform.config}-"; 39 40 buildMK = '' 41 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 42 '' + stdenv.lib.optionalString enableIntegerSimple '' 43 INTEGER_LIBRARY = integer-simple 44 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 45 - BuildFlavour = perf-cross 46 Stage1Only = YES 47 HADDOCK_DOCS = NO 48 BUILD_SPHINX_HTML = NO ··· 55 ''; 56 57 # Splicer will pull out correct variations 58 - libDeps = platform: [ ncurses ] 59 ++ stdenv.lib.optional (!enableIntegerSimple) gmp 60 - ++ stdenv.lib.optional (platform.libc != "glibc") libiconv; 61 62 toolsForTarget = 63 if hostPlatform == buildPlatform then ··· 69 70 in 71 stdenv.mkDerivation rec { 72 - inherit version; 73 name = "${targetPrefix}ghc-${version}"; 74 75 src = fetchurl { ··· 126 "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" 127 ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ 128 "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" 129 - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [ 130 "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" 131 ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ 132 "--enable-bootstrap-with-devel-snapshot" ··· 144 # masss-rebuild. 145 crossConfig = true; 146 147 - nativeBuildInputs = [ ghc perl autoconf automake m4 happy alex python3 ]; 148 149 # For building runtime libs 150 depsBuildTarget = toolsForTarget; ··· 163 164 checkTarget = "test"; 165 166 - # zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't 167 - # treat that as a unary `{x,y,z,..}` repetition. 168 postInstall = '' 169 - paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} 170 171 # Install the bash completion file. 172 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
··· 3 4 # build-tools 5 , bootPkgs, alex, happy 6 + , autoconf, automake, coreutils, fetchurl, fetchpatch, perl, python3, m4 7 8 , libffi, libiconv ? null, ncurses 9 ··· 15 16 , # If enabled, GHC will be built with the GPL-free but slower integer-simple 17 # library instead of the faster but GPLed integer-gmp library. 18 + enableIntegerSimple ? false, gmp ? null 19 20 , # If enabled, use -fPIC when compiling static libs. 21 enableRelocatedStaticLibs ? targetPlatform != hostPlatform 22 23 , # Whether to build dynamic libs for the standard library (on the target 24 # platform). Static libs are always built. 25 + enableShared ? !targetPlatform.isWindows && !targetPlatform.useAndroidPrebuilt 26 27 + , # Whetherto build terminfo. 28 + enableTerminfo ? !targetPlatform.isWindows 29 + 30 + , # What flavour to build. An empty string indicates no 31 + # specific flavour and falls back to ghc default values. 32 + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" 33 }: 34 35 assert !enableIntegerSimple -> gmp != null; ··· 43 "${targetPlatform.config}-"; 44 45 buildMK = '' 46 + BuildFlavour = ${ghcFlavour} 47 + ifneq \"\$(BuildFlavour)\" \"\" 48 + include mk/flavours/\$(BuildFlavour).mk 49 + endif 50 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 51 '' + stdenv.lib.optionalString enableIntegerSimple '' 52 INTEGER_LIBRARY = integer-simple 53 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 54 Stage1Only = YES 55 HADDOCK_DOCS = NO 56 BUILD_SPHINX_HTML = NO ··· 63 ''; 64 65 # Splicer will pull out correct variations 66 + libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ] 67 ++ stdenv.lib.optional (!enableIntegerSimple) gmp 68 + ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 69 70 toolsForTarget = 71 if hostPlatform == buildPlatform then ··· 77 78 in 79 stdenv.mkDerivation rec { 80 + version = "8.4.2"; 81 name = "${targetPrefix}ghc-${version}"; 82 83 src = fetchurl { ··· 134 "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" 135 ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ 136 "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" 137 + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ 138 "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" 139 ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ 140 "--enable-bootstrap-with-devel-snapshot" ··· 152 # masss-rebuild. 153 crossConfig = true; 154 155 + nativeBuildInputs = [ 156 + perl autoconf automake m4 python3 157 + ghc alex happy 158 + ]; 159 160 # For building runtime libs 161 depsBuildTarget = toolsForTarget; ··· 174 175 checkTarget = "test"; 176 177 postInstall = '' 178 + for bin in "$out"/lib/${name}/bin/*; do 179 + isELF "$bin" || continue 180 + paxmark m "$bin" 181 + done 182 183 # Install the bash completion file. 184 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
+23 -10
pkgs/development/compilers/ghc/head.nix
··· 3 4 # build-tools 5 , bootPkgs, alex, happy 6 - , autoconf, automake, coreutils, fetchgit, perl, python3 7 8 , libffi, libiconv ? null, ncurses 9 ··· 22 23 , # Whether to build dynamic libs for the standard library (on the target 24 # platform). Static libs are always built. 25 - enableShared ? !targetPlatform.useAndroidPrebuilt 26 27 , version ? "8.5.20180118" 28 }: 29 30 assert !enableIntegerSimple -> gmp != null; ··· 38 "${targetPlatform.config}-"; 39 40 buildMK = '' 41 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 42 '' + stdenv.lib.optionalString enableIntegerSimple '' 43 INTEGER_LIBRARY = integer-simple 44 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 45 - BuildFlavour = perf-cross 46 Stage1Only = YES 47 HADDOCK_DOCS = NO 48 BUILD_SPHINX_HTML = NO ··· 55 ''; 56 57 # Splicer will pull out correct variations 58 - libDeps = platform: [ ncurses ] 59 ++ stdenv.lib.optional (!enableIntegerSimple) gmp 60 - ++ stdenv.lib.optional (platform.libc != "glibc") libiconv; 61 62 toolsForTarget = 63 if hostPlatform == buildPlatform then ··· 123 "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" 124 ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ 125 "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" 126 - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [ 127 "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" 128 ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ 129 "--enable-bootstrap-with-devel-snapshot" ··· 141 # masss-rebuild. 142 crossConfig = true; 143 144 - nativeBuildInputs = [ ghc perl autoconf automake happy alex python3 ]; 145 146 # For building runtime libs 147 depsBuildTarget = toolsForTarget; ··· 160 161 checkTarget = "test"; 162 163 - # zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't 164 - # treat that as a unary `{x,y,z,..}` repetition. 165 postInstall = '' 166 - paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} 167 168 # Install the bash completion file. 169 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
··· 3 4 # build-tools 5 , bootPkgs, alex, happy 6 + , autoconf, automake, coreutils, fetchgit, perl, python3, m4 7 8 , libffi, libiconv ? null, ncurses 9 ··· 22 23 , # Whether to build dynamic libs for the standard library (on the target 24 # platform). Static libs are always built. 25 + enableShared ? !targetPlatform.isWindows && !targetPlatform.useAndroidPrebuilt 26 + 27 + , # Whetherto build terminfo. 28 + enableTerminfo ? !targetPlatform.isWindows 29 30 , version ? "8.5.20180118" 31 + , # What flavour to build. An empty string indicates no 32 + # specific flavour and falls back to ghc default values. 33 + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" 34 }: 35 36 assert !enableIntegerSimple -> gmp != null; ··· 44 "${targetPlatform.config}-"; 45 46 buildMK = '' 47 + BuildFlavour = ${ghcFlavour} 48 + ifneq \"\$(BuildFlavour)\" \"\" 49 + include mk/flavours/\$(BuildFlavour).mk 50 + endif 51 DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} 52 '' + stdenv.lib.optionalString enableIntegerSimple '' 53 INTEGER_LIBRARY = integer-simple 54 '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' 55 Stage1Only = YES 56 HADDOCK_DOCS = NO 57 BUILD_SPHINX_HTML = NO ··· 64 ''; 65 66 # Splicer will pull out correct variations 67 + libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ] 68 ++ stdenv.lib.optional (!enableIntegerSimple) gmp 69 + ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 70 71 toolsForTarget = 72 if hostPlatform == buildPlatform then ··· 132 "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" 133 ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ 134 "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" 135 + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ 136 "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" 137 ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ 138 "--enable-bootstrap-with-devel-snapshot" ··· 150 # masss-rebuild. 151 crossConfig = true; 152 153 + nativeBuildInputs = [ 154 + perl autoconf automake m4 python3 155 + ghc alex happy 156 + ]; 157 158 # For building runtime libs 159 depsBuildTarget = toolsForTarget; ··· 172 173 checkTarget = "test"; 174 175 postInstall = '' 176 + for bin in "$out"/lib/${name}/bin/*; do 177 + isELF "$bin" || continue 178 + paxmark m "$bin" 179 + done 180 181 # Install the bash completion file. 182 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
+1 -1
pkgs/development/haskell-modules/configuration-nix.nix
··· 128 129 # Prevents needing to add security_tool as a build tool to all of x509-system's 130 # dependencies. 131 - x509-system = if pkgs.stdenv.isDarwin && !pkgs.stdenv.cc.nativeLibc 132 then let inherit (pkgs.darwin) security_tool; 133 in pkgs.lib.overrideDerivation (addBuildDepend super.x509-system security_tool) (drv: { 134 postPatch = (drv.postPatch or "") + ''
··· 128 129 # Prevents needing to add security_tool as a build tool to all of x509-system's 130 # dependencies. 131 + x509-system = if pkgs.stdenv.targetPlatform.isDarwin && !pkgs.stdenv.cc.nativeLibc 132 then let inherit (pkgs.darwin) security_tool; 133 in pkgs.lib.overrideDerivation (addBuildDepend super.x509-system security_tool) (drv: { 134 postPatch = (drv.postPatch or "") + ''
+55 -17
pkgs/development/haskell-modules/generic-builder.nix
··· 19 , buildTarget ? "" 20 , buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? [], benchmarkToolDepends ? [] 21 , configureFlags ? [] 22 , description ? "" 23 , doCheck ? !isCross && stdenv.lib.versionOlder "7.4" ghc.version 24 , doBenchmark ? false ··· 31 , enableSharedExecutables ? false 32 , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version) 33 , enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin 34 - , enableStaticLibraries ? true 35 , enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4" 36 , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? [] 37 , homepage ? "http://hackage.haskell.org/package/${pname}" ··· 67 } @ args: 68 69 assert editedCabalFile != null -> revision != null; 70 71 let 72 ··· 125 126 crossCabalFlagsString = 127 stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags); 128 129 defaultConfigureFlags = [ 130 "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid" ··· 169 optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends; 170 171 nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++ 172 buildTools ++ libraryToolDepends ++ executableToolDepends; 173 propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends; 174 - otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ 175 allPkgconfigDepends ++ 176 optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++ 177 optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends); 178 allBuildInputs = propagatedBuildInputs ++ otherBuildInputs; 179 180 haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs; 181 systemBuildInputs = stdenv.lib.filter isSystemPkg allBuildInputs; 182 183 - ghcEnv = ghc.withPackages (p: haskellBuildInputs); 184 185 setupCommand = "./Setup"; 186 ··· 190 191 nativeGhcCommand = "${nativeGhc.targetPrefix}ghc"; 192 193 in 194 195 assert allPkgconfigDepends != [] -> pkgconfig != null; ··· 230 echo "Build with ${ghc}." 231 ${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"} 232 233 packageConfDir="$TMPDIR/package.conf.d" 234 mkdir -p $packageConfDir 235 236 setupCompileFlags="${concatStringsSep " " setupCompileFlags}" 237 configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags" 238 239 - # host.*Pkgs defined in stdenv/setup.hs 240 for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do 241 - if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then 242 - cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/ 243 - continue 244 - fi 245 - if [ -d "$p/include" ]; then 246 - configureFlags+=" --extra-include-dirs=$p/include" 247 - fi 248 - if [ -d "$p/lib" ]; then 249 - configureFlags+=" --extra-lib-dirs=$p/lib" 250 - fi 251 done 252 '' 253 # only use the links hack if we're actually building dylibs. otherwise, the 254 # "dynamic-library-dirs" point to nonexistent paths, and the ln command becomes 255 # "ln -s $out/lib/links", which tries to recreate the links dir and fails 256 - + (optionalString (stdenv.isDarwin && enableSharedLibraries) '' 257 # Work around a limit in the macOS Sierra linker on the number of paths 258 # referenced by any one dynamic library: 259 # ··· 282 done 283 284 echo setupCompileFlags: $setupCompileFlags 285 - ${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i 286 287 runHook postCompileBuildDriver 288 ''; ··· 310 311 buildPhase = '' 312 runHook preBuild 313 - ${setupCommand} build ${buildTarget}${crossCabalFlagsString} 314 runHook postBuild 315 ''; 316
··· 19 , buildTarget ? "" 20 , buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? [], benchmarkToolDepends ? [] 21 , configureFlags ? [] 22 + , buildFlags ? [] 23 , description ? "" 24 , doCheck ? !isCross && stdenv.lib.versionOlder "7.4" ghc.version 25 , doBenchmark ? false ··· 32 , enableSharedExecutables ? false 33 , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version) 34 , enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin 35 + , enableStaticLibraries ? !hostPlatform.isWindows 36 , enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4" 37 , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? [] 38 , homepage ? "http://hackage.haskell.org/package/${pname}" ··· 68 } @ args: 69 70 assert editedCabalFile != null -> revision != null; 71 + 72 + # --enable-static does not work on windows. This is a bug in GHC. 73 + # --enable-static will pass -staticlib to ghc, which only works for mach-o and elf. 74 + assert hostPlatform.isWindows -> enableStaticLibraries == false; 75 76 let 77 ··· 130 131 crossCabalFlagsString = 132 stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags); 133 + 134 + buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags); 135 136 defaultConfigureFlags = [ 137 "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid" ··· 176 optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends; 177 178 nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++ 179 + setupHaskellDepends ++ 180 buildTools ++ libraryToolDepends ++ executableToolDepends; 181 propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends; 182 + otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ 183 allPkgconfigDepends ++ 184 optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++ 185 optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends); 186 + 187 allBuildInputs = propagatedBuildInputs ++ otherBuildInputs; 188 189 haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs; 190 systemBuildInputs = stdenv.lib.filter isSystemPkg allBuildInputs; 191 192 + # When not cross compiling, also include Setup.hs dependencies. 193 + ghcEnv = ghc.withPackages (p: 194 + haskellBuildInputs ++ stdenv.lib.optional (!isCross) setupHaskellDepends); 195 196 setupCommand = "./Setup"; 197 ··· 201 202 nativeGhcCommand = "${nativeGhc.targetPrefix}ghc"; 203 204 + buildPkgDb = ghcName: '' 205 + if [ -d "$p/lib/${ghcName}/package.conf.d" ]; then 206 + cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf $packageConfDir/ 207 + continue 208 + fi 209 + if [ -d "$p/include" ]; then 210 + configureFlags+=" --extra-include-dirs=$p/include" 211 + fi 212 + if [ -d "$p/lib" ]; then 213 + configureFlags+=" --extra-lib-dirs=$p/lib" 214 + fi 215 + if [[ -d "$p/Library/Frameworks" ]]; then 216 + configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks" 217 + fi 218 + ''; 219 + 220 in 221 222 assert allPkgconfigDepends != [] -> pkgconfig != null; ··· 257 echo "Build with ${ghc}." 258 ${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"} 259 260 + '' + (optionalString (setupHaskellDepends != []) '' 261 + setupPackageConfDir="$TMPDIR/setup-package.conf.d" 262 + mkdir -p $setupPackageConfDir 263 + '') + '' 264 packageConfDir="$TMPDIR/package.conf.d" 265 mkdir -p $packageConfDir 266 267 setupCompileFlags="${concatStringsSep " " setupCompileFlags}" 268 configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags" 269 + '' 270 + # We build the Setup.hs on the *build* machine, and as such should only add 271 + # dependencies for the build machine. 272 + # 273 + # pkgs* arrays defined in stdenv/setup.hs 274 + + (optionalString (setupHaskellDepends != []) '' 275 + for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do 276 + ${buildPkgDb nativeGhc.name} 277 + done 278 + ${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache 279 + '') 280 281 + # For normal components 282 + + '' 283 for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do 284 + ${buildPkgDb ghc.name} 285 done 286 '' 287 # only use the links hack if we're actually building dylibs. otherwise, the 288 # "dynamic-library-dirs" point to nonexistent paths, and the ln command becomes 289 # "ln -s $out/lib/links", which tries to recreate the links dir and fails 290 + + (optionalString (stdenv.isDarwin && (enableSharedLibraries || enableSharedExecutables)) '' 291 # Work around a limit in the macOS Sierra linker on the number of paths 292 # referenced by any one dynamic library: 293 # ··· 316 done 317 318 echo setupCompileFlags: $setupCompileFlags 319 + ${optionalString (setupHaskellDepends != []) 320 + '' 321 + echo GHC_PACKAGE_PATH="$setupPackageConfDir:" 322 + GHC_PACKAGE_PATH="$setupPackageConfDir:" '' 323 + }${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i 324 325 runHook postCompileBuildDriver 326 ''; ··· 348 349 buildPhase = '' 350 runHook preBuild 351 + ${setupCommand} build ${buildTarget}${crossCabalFlagsString}${buildFlagsString} 352 runHook postBuild 353 ''; 354
+2
pkgs/development/haskell-modules/lib.nix
··· 131 */ 132 appendConfigureFlag = drv: x: overrideCabal drv (drv: { configureFlags = (drv.configureFlags or []) ++ [x]; }); 133 134 /* removeConfigureFlag drv x is a Haskell package like drv, but with 135 all cabal configure arguments that are equal to x removed. 136
··· 131 */ 132 appendConfigureFlag = drv: x: overrideCabal drv (drv: { configureFlags = (drv.configureFlags or []) ++ [x]; }); 133 134 + appendBuildFlag = drv: x: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ [x]; }); 135 + appendBuildFlags = drv: xs: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ xs; }); 136 /* removeConfigureFlag drv x is a Haskell package like drv, but with 137 all cabal configure arguments that are equal to x removed. 138