2019-12-01 22:13:24 +00:00
|
|
|
{ stdenv, targetPackages
|
2017-10-17 21:44:24 +01:00
|
|
|
|
|
|
|
# Build time
|
2021-01-19 06:50:56 +00:00
|
|
|
, fetchurl, pkg-config, perl, texinfo, setupDebugInfoDirs, buildPackages
|
2017-10-17 21:44:24 +01:00
|
|
|
|
|
|
|
# Run time
|
2019-09-22 22:34:32 +01:00
|
|
|
, ncurses, readline, gmp, mpfr, expat, libipt, zlib, dejagnu
|
2017-05-22 21:36:59 +01:00
|
|
|
|
2018-12-01 09:00:51 +00:00
|
|
|
, pythonSupport ? stdenv.hostPlatform == stdenv.buildPlatform && !stdenv.hostPlatform.isCygwin, python3 ? null
|
2015-11-26 12:00:36 +00:00
|
|
|
, guile ? null
|
2019-12-01 22:13:24 +00:00
|
|
|
, safePaths ? [
|
|
|
|
# $debugdir:$datadir/auto-load are whitelisted by default by GDB
|
|
|
|
"$debugdir" "$datadir/auto-load"
|
|
|
|
# targetPackages so we get the right libc when cross-compiling and using buildPackages.gdb
|
|
|
|
targetPackages.stdenv.cc.cc.lib
|
|
|
|
]
|
2012-06-21 14:28:17 +01:00
|
|
|
}:
|
2007-02-22 16:07:51 +00:00
|
|
|
|
2009-12-02 20:54:40 +00:00
|
|
|
let
|
2020-08-20 19:19:33 +01:00
|
|
|
basename = "gdb";
|
|
|
|
targetPrefix = stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
|
|
|
"${stdenv.targetPlatform.config}-";
|
2009-12-02 20:54:40 +00:00
|
|
|
in
|
2011-08-20 15:30:23 +01:00
|
|
|
|
2018-12-01 09:00:51 +00:00
|
|
|
assert pythonSupport -> python3 != null;
|
2011-11-19 18:28:10 +00:00
|
|
|
|
2007-11-16 17:30:34 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-08-20 19:19:33 +01:00
|
|
|
pname = targetPrefix + basename;
|
2020-10-24 19:22:36 +01:00
|
|
|
version = "10.1";
|
2008-09-03 14:12:23 +01:00
|
|
|
|
2012-06-21 14:28:17 +01:00
|
|
|
src = fetchurl {
|
2020-08-20 19:19:33 +01:00
|
|
|
url = "mirror://gnu/gdb/${basename}-${version}.tar.xz";
|
2020-10-24 19:22:36 +01:00
|
|
|
sha256 = "1h32dckz1y8fnyxh22iyw8h3hnhxr79v1ng85px3ljn1xv71wbzq";
|
2012-06-21 14:28:17 +01:00
|
|
|
};
|
2008-09-03 14:12:23 +01:00
|
|
|
|
2019-06-10 04:56:08 +01:00
|
|
|
postPatch = if stdenv.isDarwin then ''
|
|
|
|
substituteInPlace gdb/darwin-nat.c \
|
|
|
|
--replace '#include "bfd/mach-o.h"' '#include "mach-o.h"'
|
|
|
|
'' else null;
|
|
|
|
|
2018-11-16 07:31:05 +00:00
|
|
|
patches = [
|
|
|
|
./debug-info-from-env.patch
|
|
|
|
] ++ stdenv.lib.optionals stdenv.isDarwin [
|
|
|
|
./darwin-target-match.patch
|
|
|
|
];
|
2017-07-28 12:51:27 +01:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];
|
2011-08-20 15:30:23 +01:00
|
|
|
|
2019-09-22 22:34:32 +01:00
|
|
|
buildInputs = [ ncurses readline gmp mpfr expat libipt zlib guile ]
|
2018-12-01 09:00:51 +00:00
|
|
|
++ stdenv.lib.optional pythonSupport python3
|
2010-09-05 16:19:07 +01:00
|
|
|
++ stdenv.lib.optional doCheck dejagnu;
|
2008-09-03 14:12:23 +01:00
|
|
|
|
2017-07-28 13:22:48 +01:00
|
|
|
propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
|
|
|
|
|
2018-12-12 00:30:00 +00:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
2012-06-21 14:28:17 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-10-12 22:18:23 +01:00
|
|
|
# darwin build fails with format hardening since v7.12
|
|
|
|
hardeningDisable = stdenv.lib.optionals stdenv.isDarwin [ "format" ];
|
|
|
|
|
2017-06-11 10:34:17 +01:00
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-format-nonliteral";
|
|
|
|
|
2017-06-23 22:45:27 +01:00
|
|
|
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
2018-08-20 19:43:41 +01:00
|
|
|
configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";
|
2017-06-23 22:45:27 +01:00
|
|
|
|
2020-02-10 13:52:49 +00:00
|
|
|
# GDB have to be built out of tree.
|
|
|
|
preConfigure = ''
|
|
|
|
mkdir _build
|
|
|
|
cd _build
|
|
|
|
'';
|
|
|
|
configureScript = "../configure";
|
|
|
|
|
2017-05-22 21:36:59 +01:00
|
|
|
configureFlags = with stdenv.lib; [
|
2017-10-17 21:44:24 +01:00
|
|
|
"--enable-targets=all" "--enable-64-bit-bfd"
|
|
|
|
"--disable-install-libbfd"
|
|
|
|
"--disable-shared" "--enable-static"
|
|
|
|
"--with-system-zlib"
|
|
|
|
"--with-system-readline"
|
|
|
|
|
|
|
|
"--with-gmp=${gmp.dev}"
|
|
|
|
"--with-mpfr=${mpfr.dev}"
|
|
|
|
"--with-expat" "--with-libexpat-prefix=${expat.dev}"
|
2019-11-20 17:14:54 +00:00
|
|
|
"--with-auto-load-safe-path=${builtins.concatStringsSep ":" safePaths}"
|
2017-10-17 21:44:24 +01:00
|
|
|
] ++ stdenv.lib.optional (!pythonSupport) "--without-python";
|
2010-12-04 10:35:04 +00:00
|
|
|
|
2009-10-28 22:25:50 +00:00
|
|
|
postInstall =
|
|
|
|
'' # Remove Info files already provided by Binutils and other packages.
|
2015-04-14 16:25:34 +01:00
|
|
|
rm -v $out/share/info/bfd.info
|
2009-10-28 22:25:50 +00:00
|
|
|
'';
|
2009-10-12 11:06:41 +01:00
|
|
|
|
2010-09-05 16:19:07 +01:00
|
|
|
# TODO: Investigate & fix the test failures.
|
|
|
|
doCheck = false;
|
|
|
|
|
2011-08-20 15:30:23 +01:00
|
|
|
meta = with stdenv.lib; {
|
2014-08-24 15:21:08 +01:00
|
|
|
description = "The GNU Project debugger";
|
2008-09-03 14:12:23 +01:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
GDB, the GNU Project debugger, allows you to see what is going
|
|
|
|
on `inside' another program while it executes -- or what another
|
|
|
|
program was doing at the moment it crashed.
|
|
|
|
'';
|
|
|
|
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.gnu.org/software/gdb/";
|
2008-09-03 14:12:23 +01:00
|
|
|
|
2014-06-19 05:19:00 +01:00
|
|
|
license = stdenv.lib.licenses.gpl3Plus;
|
2009-09-23 20:45:02 +01:00
|
|
|
|
2014-01-15 14:33:31 +00:00
|
|
|
platforms = with platforms; linux ++ cygwin ++ darwin;
|
2020-02-10 13:52:49 +00:00
|
|
|
maintainers = with maintainers; [ pierron globin lsix ];
|
2007-02-22 16:07:51 +00:00
|
|
|
};
|
|
|
|
}
|