ghc: compile with DWARF support by default

This allows our GHCs to build programs with DWARF debug information
when -g is passed, see https://ghc.haskell.org/trac/ghc/wiki/DWARF.

Compiling with debug symbols is off by default until GHC ticket
https://gitlab.haskell.org/ghc/ghc/issues/15960
(Using -g causes differences in generated core) is fixed.
This commit is contained in:
Domen Kožar 2019-11-05 19:33:15 +01:00
parent 21c201adee
commit 7217090464
No known key found for this signature in database
GPG key ID: C2FFBCAFD2C24246

View file

@ -2,11 +2,14 @@
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchgit, fetchpatch, perl, python3, m4, sphinx
, autoconf, autoreconfHook, automake, coreutils, fetchgit, fetchpatch, perl, python3, m4, sphinx
, bash
, libiconv ? null, ncurses
, enableDwarf ? !stdenv.targetPlatform.isDarwin &&
!stdenv.targetPlatform.isWindows, elfutils # for DWARF support
, 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
@ -27,7 +30,7 @@
, # Whetherto build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, version ? "8.9.20190924"
, version ? "8.10.20191119"
, # 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)
@ -73,7 +76,8 @@ let
# Splicer will pull out correct variations
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv
++ stdenv.lib.optional enableDwarf elfutils;
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
@ -89,8 +93,8 @@ stdenv.mkDerivation (rec {
src = fetchgit {
url = "https://gitlab.haskell.org/ghc/ghc.git/";
rev = "795986aaf33e2ffc233836b86a92a77366c91db2";
sha256 = "0a111x6c53r07q5qdg6c8mnydqp0wh4mpxmw7ga4x5wlap8i0bji";
rev = "0418c38d55c7a47967187dce2db5ea2ab1021b1e";
sha256 = "1d8g30ii0w4xh6fh61bxbalsqqyanny99nn3p727fx7favnhgvxi";
};
enableParallelBuilding = true;
@ -98,13 +102,6 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "doc" ];
patches = [
(fetchpatch { # https://github.com/haskell/haddock/issues/900
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/983.diff";
name = "loadpluginsinmodules.diff";
sha256 = "0bvvv0zsfq2581zsir97zfkggc1kkircbbajc2fz3b169ycpbha1";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
];
postPatch = "patchShebangs .";
@ -176,13 +173,17 @@ stdenv.mkDerivation (rec {
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ stdenv.lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
] ++ stdenv.lib.optional enableDwarf [
"--enable-dwarf-unwind"
"--with-libdw-includes=${stdenv.lib.getDev elfutils}/include"
"--with-libdw-libraries=${stdenv.lib.getLib elfutils}/lib"
];
# Make sure we never relax`$PATH` and hooks support for compatability.
strictDeps = true;
nativeBuildInputs = [
perl autoconf automake m4 python3 sphinx
perl autoconf autoreconfHook automake m4 python3 sphinx
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
];