From 0d422d500766d954e207009477ffa43ce98c454b Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Sat, 15 Feb 2020 19:26:35 -0500 Subject: gambit: set CC to full path, fixes #78921 Use -Os rather than -O2 as our compilation flag, document why. Document why we always use gcc over clang. Fix openssl path in gambit. Stop trying to make static openssl. --- pkgs/development/compilers/gambit/bootstrap.nix | 6 +- pkgs/development/compilers/gambit/build.nix | 85 ++++++++++++++++--------- 2 files changed, 60 insertions(+), 31 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/gambit/bootstrap.nix b/pkgs/development/compilers/gambit/bootstrap.nix index f00a8b6efc91..2fb9e3ce2fc4 100644 --- a/pkgs/development/compilers/gambit/bootstrap.nix +++ b/pkgs/development/compilers/gambit/bootstrap.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, autoconf, ... }: +{ stdenv, fetchurl, autoconf, gcc, coreutils, ... }: stdenv.mkDerivation { pname = "gambit-bootstrap"; @@ -12,6 +12,10 @@ stdenv.mkDerivation { buildInputs = [ autoconf ]; configurePhase = '' + export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ + CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ + XMKMF=${coreutils}/bin/false + unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS ./configure --prefix=$out ''; diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix index 7a3324d75602..e17241b6d98d 100644 --- a/pkgs/development/compilers/gambit/build.nix +++ b/pkgs/development/compilers/gambit/build.nix @@ -1,4 +1,19 @@ -{ stdenv, git, openssl, autoconf, pkgs, makeStaticLibraries, version, src }: +{ stdenv, git, openssl, autoconf, pkgs, makeStaticLibraries, version, gcc, src, coreutils }: + +# Note that according to a benchmark run by Marc Feeley on May 2018, +# clang is 10x (with default settings) to 15% (with -O2) slower than GCC at compiling +# Gambit output, producing code that is 3x slower. IIRC the benchmarks from Gambit@30, +# the numbers were still heavily in favor of GCC in October 2019. +# Thus we use GCC over clang, even on macOS. + +# Also note that I (fare) just ran benchmarks from https://github.com/ecraven/r7rs-benchmarks +# with Gambit 4.9.3 with -O1 vs -O2 vs -Os on Feb 2020. Which wins depends on the benchmark. +# The fight is unclear between -O1 and -O2, where -O1 wins more often, by up to 17%, +# but sometimes -O2 wins, once by up to 43%, so that overall -O2 is 5% faster. +# However, -Os seems more consistent in winning slightly against both -O1 and -O2, +# and is overall 15% faster than -O2. As for compile times, -O1 is fastest, +# -Os is about 29%-33% slower than -O1, while -O2 is about 40%-50% slower than -O1. +# Overall, -Os seems like the best choice, and that's what we now use. stdenv.mkDerivation rec { pname = "gambit"; @@ -7,38 +22,48 @@ stdenv.mkDerivation rec { bootstrap = import ./bootstrap.nix ( pkgs ); - # Use makeStaticLibraries to enable creation of statically linked binaries - buildInputs = [ git autoconf bootstrap openssl (makeStaticLibraries openssl)]; + # TODO: if/when we can get all the library packages we depend on to have static versions, + # we could use something like (makeStaticLibraries openssl) to enable creation + # of statically linked binaries by gsc. + buildInputs = [ git autoconf bootstrap openssl ]; + + configureFlags = [ + "--enable-single-host" + "--enable-c-opt=-Os" + "--enable-gcc-opts" + "--enable-shared" + "--enable-absolute-shared-libs" # Yes, NixOS will want an absolute path, and fix it. + "--enable-poll" + "--enable-openssl" + "--enable-default-runtime-options=f8,-8,t8" # Default to UTF-8 for source and all I/O + # "--enable-debug" # Nope: enables plenty of good stuff, but also the costly console.log + # "--enable-multiple-versions" # Nope, NixOS already does version multiplexing + # "--enable-guide" + # "--enable-track-scheme" + # "--enable-high-res-timing" + # "--enable-max-processors=4" + # "--enable-multiple-vms" + # "--enable-dynamic-tls" + # "--enable-multiple-threaded-vms" # when SMP branch is merged in + # "--enable-thread-system=posix" # default when --enable-multiple-vms is on. + # "--enable-profile" + # "--enable-coverage" + # "--enable-inline-jumps" + # "--enable-char-size=1" # default is 4 + ]; configurePhase = '' - options=( - --prefix=$out - --enable-single-host - --enable-c-opt=-O2 - --enable-gcc-opts - --enable-shared - --enable-absolute-shared-libs # Yes, NixOS will want an absolute path, and fix it. - --enable-poll - --enable-openssl - --enable-default-runtime-options="f8,-8,t8" # Default to UTF-8 for source and all I/O - #--enable-debug # Nope: enables plenty of good stuff, but also the costly console.log + export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ + CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ + XMKMF=${coreutils}/bin/false + unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS + ./configure --prefix=$out ${builtins.concatStringsSep " " configureFlags} - #--enable-multiple-versions # Nope, NixOS already does version multiplexing - #--enable-guide - #--enable-track-scheme - #--enable-high-res-timing - #--enable-max-processors=4 - #--enable-multiple-vms - #--enable-dynamic-tls - #--enable-multiple-vms - #--enable-multiple-threaded-vms ## when SMP branch is merged in - #--enable-thread-system=posix ## default when --enable-multiple-vms is on. - #--enable-profile - #--enable-coverage - #--enable-inline-jumps - #--enable-char-size=1" ; default is 4 - ) - ./configure ''${options[@]} + # OS-specific paths are hardcoded in ./configure + substituteInPlace config.status \ + --replace /usr/local/opt/openssl/lib "${openssl.out}/lib" \ + --replace /usr/local/opt/openssl@1.1/lib "${openssl.out}/lib" + ./config.status ''; buildPhase = '' -- cgit 1.4.1 From 32b3758b3d9fcb39094b44dc3114d86f712b0fb0 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Mon, 23 Dec 2019 17:34:38 -0500 Subject: gambit-unstable: 2019-07-21 -> 2020-02-24 --- pkgs/development/compilers/gambit/unstable.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/gambit/unstable.nix b/pkgs/development/compilers/gambit/unstable.nix index d855b83f0afc..4c33c83c67b1 100644 --- a/pkgs/development/compilers/gambit/unstable.nix +++ b/pkgs/development/compilers/gambit/unstable.nix @@ -1,13 +1,13 @@ { stdenv, callPackage, fetchFromGitHub }: callPackage ./build.nix { - version = "unstable-2019-07-21"; -# git-version = "4.9.3-109-g3b5f74fa"; + version = "unstable-2020-02-24"; +# git-version = "4.9.3-979-gc69e9f70"; src = fetchFromGitHub { owner = "feeley"; repo = "gambit"; - rev = "3b5f74fae74b2159e3bf6923f29a18b31cc15dcc"; - sha256 = "07cb0d8754dqhxawkp5dp4y0bsa9kfald4dkj60j5yfnsp81y5mi"; + rev = "c69e9f70dfdc6545353b135a5d5e2f9234f1e1cc"; + sha256 = "1f69n7yzzdv3wpnjlrbck38xpa8115vbady43mc544l39ckklr0k"; }; inherit stdenv; } -- cgit 1.4.1 From 4ee219ef8ebf8f3b60106156d2f6a81a156b25fe Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Mon, 23 Dec 2019 17:35:10 -0500 Subject: gerbil-unstable: 2019-11-15 -> 2020-02-27 Let Gerbil Scheme find its GERBIL_HOME where Nix put it when the environment variable is left unspecified. Comment out work in progress for static linking. Notes about working on macOS. --- pkgs/development/compilers/gerbil/build.nix | 39 ++++++++++++++++---------- pkgs/development/compilers/gerbil/unstable.nix | 8 +++--- 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/gerbil/build.nix b/pkgs/development/compilers/gerbil/build.nix index e2ab09764827..21c2936fa0f8 100644 --- a/pkgs/development/compilers/gerbil/build.nix +++ b/pkgs/development/compilers/gerbil/build.nix @@ -3,9 +3,6 @@ openssl, zlib, sqlite, libxml2, libyaml, libmysqlclient, lmdb, leveldb, postgresql, version, git-version, gambit, src }: -# TODO: distinct packages for gerbil-release and gerbil-devel -# TODO: make static compilation work - stdenv.mkDerivation rec { pname = "gerbil"; inherit version; @@ -32,19 +29,23 @@ stdenv.mkDerivation rec { substituteInPlace "$f" --replace '"gsc"' '"${gambit}/bin/gsc"' done substituteInPlace "etc/gerbil.el" --replace '"gxc"' "\"$out/bin/gxc\"" - - cat > etc/gerbil_static_libraries.sh < etc/gerbil_static_libraries.sh < Date: Fri, 28 Feb 2020 01:32:20 -0500 Subject: crystal: use latest openssl --- doc/languages-frameworks/crystal.section.md | 2 +- pkgs/development/compilers/crystal/default.nix | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/doc/languages-frameworks/crystal.section.md b/doc/languages-frameworks/crystal.section.md index 07bfc65a553f..af0853dbf75b 100644 --- a/doc/languages-frameworks/crystal.section.md +++ b/doc/languages-frameworks/crystal.section.md @@ -66,6 +66,6 @@ crystal.buildCrystalPackage rec { shardsFile = ./shards.nix; crystalBinaries.mint.src = "src/mint.cr"; - buildInputs = [ openssl_1_0_2 ]; + buildInputs = [ openssl ]; } ``` diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 5253d6e5a9e3..89dbda4e2a9a 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -1,5 +1,5 @@ { stdenv, lib, fetchFromGitHub, fetchurl, makeWrapper -, coreutils, git, gmp, nettools, openssl_1_0_2, readline, tzdata, libxml2, libyaml +, coreutils, git, gmp, nettools, openssl, readline, tzdata, libxml2, libyaml , boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm, clang, which, zlib, pkgconfig , callPackage }: @@ -20,7 +20,7 @@ let arch = archs.${stdenv.system} or (throw "system ${stdenv.system} not supported"); - checkInputs = [ git gmp openssl_1_0_2 readline libxml2 libyaml ]; + checkInputs = [ git gmp openssl readline libxml2 libyaml ]; genericBinary = { version, sha256s, rel ? 1 }: stdenv.mkDerivation rec { @@ -39,7 +39,7 @@ let }; commonBuildInputs = extraBuildInputs: [ - boehmgc libatomic_ops pcre libevent libyaml zlib libxml2 openssl_1_0_2 + boehmgc libatomic_ops pcre libevent libyaml zlib libxml2 openssl ] ++ extraBuildInputs ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ]; -- cgit 1.4.1 From 9a5ecf1212e42f03e26d41d7b6d53853f4016af3 Mon Sep 17 00:00:00 2001 From: Adam Sandberg Ericsson Date: Tue, 18 Feb 2020 19:02:25 +0000 Subject: ghc: really use ld.gold --- pkgs/development/compilers/ghc/8.10.1.nix | 6 ++++-- pkgs/development/compilers/ghc/8.4.4.nix | 6 ++++-- pkgs/development/compilers/ghc/8.6.5.nix | 6 ++++-- pkgs/development/compilers/ghc/8.8.1.nix | 6 ++++-- pkgs/development/compilers/ghc/8.8.2.nix | 18 +++++++++++++----- pkgs/development/compilers/ghc/head.nix | 6 ++++-- 6 files changed, 33 insertions(+), 15 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/ghc/8.10.1.nix b/pkgs/development/compilers/ghc/8.10.1.nix index 314b2fea9c75..bd67fae158af 100644 --- a/pkgs/development/compilers/ghc/8.10.1.nix +++ b/pkgs/development/compilers/ghc/8.10.1.nix @@ -84,6 +84,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { version = "8.10.0.20200123"; @@ -110,7 +112,7 @@ stdenv.mkDerivation (rec { export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -158,7 +160,7 @@ stdenv.mkDerivation (rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" diff --git a/pkgs/development/compilers/ghc/8.4.4.nix b/pkgs/development/compilers/ghc/8.4.4.nix index 075947a02a4b..d1665574de35 100644 --- a/pkgs/development/compilers/ghc/8.4.4.nix +++ b/pkgs/development/compilers/ghc/8.4.4.nix @@ -79,6 +79,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { version = "8.4.4"; @@ -126,7 +128,7 @@ stdenv.mkDerivation (rec { export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -173,7 +175,7 @@ stdenv.mkDerivation (rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" diff --git a/pkgs/development/compilers/ghc/8.6.5.nix b/pkgs/development/compilers/ghc/8.6.5.nix index b31b3db7eb2e..ead28a3076a8 100644 --- a/pkgs/development/compilers/ghc/8.6.5.nix +++ b/pkgs/development/compilers/ghc/8.6.5.nix @@ -84,6 +84,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { version = "8.6.5"; @@ -125,7 +127,7 @@ stdenv.mkDerivation (rec { export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -173,7 +175,7 @@ stdenv.mkDerivation (rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" diff --git a/pkgs/development/compilers/ghc/8.8.1.nix b/pkgs/development/compilers/ghc/8.8.1.nix index 2b859de97997..cc9dab51df73 100644 --- a/pkgs/development/compilers/ghc/8.8.1.nix +++ b/pkgs/development/compilers/ghc/8.8.1.nix @@ -84,6 +84,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { version = "8.8.1"; @@ -110,7 +112,7 @@ stdenv.mkDerivation (rec { export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -158,7 +160,7 @@ stdenv.mkDerivation (rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" diff --git a/pkgs/development/compilers/ghc/8.8.2.nix b/pkgs/development/compilers/ghc/8.8.2.nix index b0eef9ef924d..0f9fd7731d32 100644 --- a/pkgs/development/compilers/ghc/8.8.2.nix +++ b/pkgs/development/compilers/ghc/8.8.2.nix @@ -84,6 +84,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { version = "8.8.2"; @@ -110,7 +112,7 @@ stdenv.mkDerivation (rec { export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -147,18 +149,24 @@ stdenv.mkDerivation (rec { # TODO(@Ericson2314): Always pass "--target" and always prefix. configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ "--datadir=$doc/share/doc/ghc" "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" - ] ++ stdenv.lib.optionals (libffi != null) ["--with-system-libffi" "--with-ffi-includes=${targetPackages.libffi.dev}/include" "--with-ffi-libraries=${targetPackages.libffi.out}/lib" + ] ++ stdenv.lib.optionals (libffi != null) [ + "--with-system-libffi" + "--with-ffi-includes=${targetPackages.libffi.dev}/include" + "--with-ffi-libraries=${targetPackages.libffi.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && !enableIntegerSimple) [ - "--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib" + "--with-gmp-includes=${targetPackages.gmp.dev}/include" + "--with-gmp-libraries=${targetPackages.gmp.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ - "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + "--with-iconv-includes=${libiconv}/include" + "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index d6ba6dd0fad3..2dd7d5f30c4d 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -85,6 +85,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { inherit version; @@ -117,7 +119,7 @@ stdenv.mkDerivation (rec { export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 # and more generally have a faster linker. - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -167,7 +169,7 @@ stdenv.mkDerivation (rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" -- cgit 1.4.1 From c8554c0574ab7482ed451e7e978e77d05898ac06 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Mon, 24 Feb 2020 20:02:36 +0100 Subject: ghc: add 8.8.3 https://mail.haskell.org/pipermail/ghc-devs/2020-February/018643.html --- doc/languages-frameworks/haskell.section.md | 6 +- pkgs/development/compilers/ghc/8.8.3.nix | 232 ++++++++++++++++++++++++++++ pkgs/top-level/haskell-packages.nix | 11 ++ 3 files changed, 247 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/ghc/8.8.3.nix (limited to 'pkgs/development/compilers') diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md index 8cab6208910d..944c17a137e7 100644 --- a/doc/languages-frameworks/haskell.section.md +++ b/doc/languages-frameworks/haskell.section.md @@ -112,8 +112,10 @@ haskell.compiler.ghc865 ghc-8.6.5 haskell.compiler.integer-simple.ghc865 ghc-8.6.5 haskell.compiler.ghc881 ghc-8.8.1 haskell.compiler.integer-simple.ghc881 ghc-8.8.1 -haskell.compiler.ghc882 ghc-8.8.1.20191211 -haskell.compiler.integer-simple.ghc882 ghc-8.8.1.20191211 +haskell.compiler.ghc882 ghc-8.8.2 +haskell.compiler.integer-simple.ghc882 ghc-8.8.2 +haskell.compiler.ghc883 ghc-8.8.3 +haskell.compiler.integer-simple.ghc883 ghc-8.8.3 haskell.compiler.ghcjs ghcjs-8.6.0.1 ``` diff --git a/pkgs/development/compilers/ghc/8.8.3.nix b/pkgs/development/compilers/ghc/8.8.3.nix new file mode 100644 index 000000000000..43d4b84c5f80 --- /dev/null +++ b/pkgs/development/compilers/ghc/8.8.3.nix @@ -0,0 +1,232 @@ +{ stdenv, pkgsBuildTarget, targetPackages + +# build-tools +, bootPkgs +, autoconf, automake, coreutils, fetchurl, perl, python3, m4, sphinx +, bash + +, libiconv ? null, ncurses + +, # GHC can be built with system libffi or a bundled one. + libffi ? null + +, useLLVM ? !stdenv.targetPlatform.isx86 +, # LLVM is conceptually a run-time-only depedendency, but for + # non-x86, we need LLVM to bootstrap later stages, so it becomes a + # build-time dependency too. + buildLlvmPackages, llvmPackages + +, # If enabled, GHC will be built with the GPL-free but slower integer-simple + # library instead of the faster but GPLed integer-gmp library. + enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp + +, # If enabled, use -fPIC when compiling static libs. + enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform + +, # Whether to build dynamic libs for the standard library (on the target + # platform). Static libs are always built. + enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt + +, # Whetherto build terminfo. + enableTerminfo ? !stdenv.targetPlatform.isWindows + +, # What flavour to build. An empty string indicates no + # specific flavour and falls back to ghc default values. + ghcFlavour ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) + (if useLLVM then "perf-cross" else "perf-cross-ncg") + +, # Whether to disable the large address space allocator + # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ + disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64 +}: + +assert !enableIntegerSimple -> gmp != null; + +let + inherit (stdenv) buildPlatform hostPlatform targetPlatform; + + inherit (bootPkgs) ghc; + + # TODO(@Ericson2314) Make unconditional + targetPrefix = stdenv.lib.optionalString + (targetPlatform != hostPlatform) + "${targetPlatform.config}-"; + + buildMK = '' + BuildFlavour = ${ghcFlavour} + ifneq \"\$(BuildFlavour)\" \"\" + include mk/flavours/\$(BuildFlavour).mk + endif + DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} + INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"} + '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' + Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} + CrossCompilePrefix = ${targetPrefix} + HADDOCK_DOCS = NO + BUILD_SPHINX_HTML = NO + BUILD_SPHINX_PDF = NO + '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' + GhcLibHcOpts += -fPIC + GhcRtsHcOpts += -fPIC + '' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt '' + EXTRA_CC_OPTS += -std=gnu99 + ''; + + # Splicer will pull out correct variations + libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ] + ++ [libffi] + ++ stdenv.lib.optional (!enableIntegerSimple) gmp + ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; + + toolsForTarget = [ + pkgsBuildTarget.targetPackages.stdenv.cc + ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm; + + targetCC = builtins.head toolsForTarget; + +in +stdenv.mkDerivation (rec { + version = "8.8.3"; + name = "${targetPrefix}ghc-${version}"; + + src = fetchurl { + url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz"; + sha256 = "128g932i3wix6ic03v04nh5755vyjiidzri9iybwad72yfmc1p70"; + }; + + enableParallelBuilding = true; + + outputs = [ "out" "doc" ]; + + postPatch = "patchShebangs ."; + + # GHC is a bit confused on its cross terminology. + preConfigure = '' + for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do + export "''${env#TARGET_}=''${!env}" + done + # GHC is a bit confused on its cross terminology, as these would normally be + # the *host* tools. + export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" + export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" + # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" + export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" + export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" + export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" + export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" + export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" + + echo -n "${buildMK}" > mk/build.mk + sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure + '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" + '' + stdenv.lib.optionalString stdenv.isDarwin '' + export NIX_LDFLAGS+=" -no_dtrace_dof" + '' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt '' + sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets + '' + stdenv.lib.optionalString targetPlatform.isMusl '' + echo "patching llvm-targets for musl targets..." + echo "Cloning these existing '*-linux-gnu*' targets:" + grep linux-gnu llvm-targets | sed 's/^/ /' + echo "(go go gadget sed)" + sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets + echo "llvm-targets now contains these '*-linux-musl*' targets:" + grep linux-musl llvm-targets | sed 's/^/ /' + + echo "And now patching to preserve '-musleabi' as done with '-gnueabi'" + # (aclocal.m4 is actual source, but patch configure as well since we don't re-gen) + for x in configure aclocal.m4; do + substituteInPlace $x \ + --replace '*-android*|*-gnueabi*)' \ + '*-android*|*-gnueabi*|*-musleabi*)' + done + ''; + + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] + ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker + configureFlags = [ + "--datadir=$doc/share/doc/ghc" + "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" + ] ++ stdenv.lib.optionals (libffi != null) ["--with-system-libffi" "--with-ffi-includes=${targetPackages.libffi.dev}/include" "--with-ffi-libraries=${targetPackages.libffi.out}/lib" + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && !enableIntegerSimple) [ + "--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib" + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ + "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ + "--enable-bootstrap-with-devel-snapshot" + ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + "CFLAGS=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" + ] ++ stdenv.lib.optionals (disableLargeAddressSpace) [ + "--disable-large-address-space" + ]; + + # Make sure we never relax`$PATH` and hooks support for compatability. + strictDeps = true; + + # Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself. + dontAddExtraLibs = true; + + nativeBuildInputs = [ + perl autoconf automake m4 python3 sphinx + ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour + ]; + + # For building runtime libs + depsBuildTarget = toolsForTarget; + + buildInputs = [ perl bash ] ++ (libDeps hostPlatform); + + propagatedBuildInputs = [ targetPackages.stdenv.cc ] + ++ stdenv.lib.optional useLLVM llvmPackages.llvm; + + depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform); + depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform); + + # required, because otherwise all symbols from HSffi.o are stripped, and + # that in turn causes GHCi to abort + stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; + + checkTarget = "test"; + + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; + + postInstall = '' + # Install the bash completion file. + install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc + + # Patch scripts to include "readelf" and "cat" in $PATH. + for i in "$out/bin/"*; do + test ! -h $i || continue + egrep --quiet '^#!' <(head -n 1 $i) || continue + sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i + done + ''; + + passthru = { + inherit bootPkgs targetPrefix; + + inherit llvmPackages; + inherit enableShared; + + # Our Cabal compiler name + haskellCompilerName = "ghc-${version}"; + }; + + meta = { + homepage = http://haskell.org/ghc; + description = "The Glasgow Haskell Compiler"; + maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ]; + inherit (ghc.meta) license platforms; + }; + +} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt { + dontStrip = true; + dontPatchELF = true; + noAuditTmpdir = true; +}) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index c4c18b264f1d..2d03b3ed8f44 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -68,6 +68,12 @@ in { buildLlvmPackages = buildPackages.llvmPackages_7; llvmPackages = pkgs.llvmPackages_7; }; + ghc883 = callPackage ../development/compilers/ghc/8.8.3.nix { + bootPkgs = packages.ghc863Binary; + inherit (buildPackages.python3Packages) sphinx; + buildLlvmPackages = buildPackages.llvmPackages_7; + llvmPackages = pkgs.llvmPackages_7; + }; ghc8101 = callPackage ../development/compilers/ghc/8.10.1.nix { bootPkgs = packages.ghc863Binary; inherit (buildPackages.python3Packages) sphinx; @@ -137,6 +143,11 @@ in { ghc = bh.compiler.ghc882; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.8.x.nix { }; }; + ghc883 = callPackage ../development/haskell-modules { + buildHaskellPackages = bh.packages.ghc883; + ghc = bh.compiler.ghc883; + compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.8.x.nix { }; + }; ghc8101 = callPackage ../development/haskell-modules { buildHaskellPackages = bh.packages.ghc8101; ghc = bh.compiler.ghc8101; -- cgit 1.4.1 From ff6aeefb916a0dd1fad2825d4f08311df275828b Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Fri, 28 Feb 2020 21:17:10 +0100 Subject: ghc-8.8.3: really use ld.gold (port #80466) --- pkgs/development/compilers/ghc/8.8.3.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'pkgs/development/compilers') diff --git a/pkgs/development/compilers/ghc/8.8.3.nix b/pkgs/development/compilers/ghc/8.8.3.nix index 43d4b84c5f80..e4ece9b8d8c1 100644 --- a/pkgs/development/compilers/ghc/8.8.3.nix +++ b/pkgs/development/compilers/ghc/8.8.3.nix @@ -84,6 +84,8 @@ let targetCC = builtins.head toolsForTarget; + useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false); + in stdenv.mkDerivation (rec { version = "8.8.3"; @@ -110,7 +112,7 @@ stdenv.mkDerivation (rec { export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString (targetPlatform.isLinux && !(targetPlatform.useLLVM or false)) ".gold"}" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString useLdGold ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -147,18 +149,24 @@ stdenv.mkDerivation (rec { # TODO(@Ericson2314): Always pass "--target" and always prefix. configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ "--datadir=$doc/share/doc/ghc" "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" - ] ++ stdenv.lib.optionals (libffi != null) ["--with-system-libffi" "--with-ffi-includes=${targetPackages.libffi.dev}/include" "--with-ffi-libraries=${targetPackages.libffi.out}/lib" + ] ++ stdenv.lib.optionals (libffi != null) [ + "--with-system-libffi" + "--with-ffi-includes=${targetPackages.libffi.dev}/include" + "--with-ffi-libraries=${targetPackages.libffi.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && !enableIntegerSimple) [ - "--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib" + "--with-gmp-includes=${targetPackages.gmp.dev}/include" + "--with-gmp-libraries=${targetPackages.gmp.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ - "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + "--with-iconv-includes=${libiconv}/include" + "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" - ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [ + ] ++ stdenv.lib.optionals useLdGold [ "CFLAGS=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" -- cgit 1.4.1