gdb: Modernize and simplify derivation
- `isGNU` to `isHurd`, my sedding did not catch - Simplify cross compilation in general - Be more careful about python - no more `gdbCross` in all-packages
This commit is contained in:
parent
eaa509f33a
commit
c443033be3
@ -1,33 +1,31 @@
|
|||||||
{ fetchurl, stdenv, ncurses, readline, gmp, mpfr, expat, texinfo, zlib
|
{ fetchurl, stdenv, ncurses, readline, gmp, mpfr, expat, texinfo, zlib
|
||||||
, dejagnu, perl, pkgconfig
|
, dejagnu, perl, pkgconfig
|
||||||
, python ? null
|
|
||||||
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
|
||||||
|
, pythonSupport ? hostPlatform == buildPlatform && !hostPlatform.isCygwin, python ? null
|
||||||
, guile ? null
|
, guile ? null
|
||||||
, target ? null
|
|
||||||
# Support all known targets in one gdb binary.
|
# Support all known targets in one gdb binary.
|
||||||
, multitarget ? false
|
, multitarget ? false
|
||||||
|
|
||||||
# Additional dependencies for GNU/Hurd.
|
# Additional dependencies for GNU/Hurd.
|
||||||
, mig ? null, hurd ? null
|
, mig ? null, hurd ? null
|
||||||
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
basename = "gdb-${version}";
|
||||||
basename = "gdb-7.12.1";
|
version = "7.12.1";
|
||||||
|
|
||||||
# Whether (cross-)building for GNU/Hurd. This is an approximation since
|
|
||||||
# having `stdenv ? cross' doesn't tell us if we're building `crossDrv' and
|
|
||||||
# `nativeDrv'.
|
|
||||||
isGNU =
|
|
||||||
stdenv.system == "i686-gnu"
|
|
||||||
|| (stdenv ? cross && stdenv.cross.config == "i586-pc-gnu");
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
assert isGNU -> mig != null && hurd != null;
|
assert targetPlatform.isHurd -> mig != null && hurd != null;
|
||||||
|
assert pythonSupport -> python != null;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = basename + stdenv.lib.optionalString (target != null)
|
name =
|
||||||
("-" + target.config);
|
stdenv.lib.optionalString (targetPlatform != hostPlatform)
|
||||||
|
(targetPlatform.config + "-")
|
||||||
|
+ basename;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://gnu/gdb/${basename}.tar.xz";
|
url = "mirror://gnu/gdb/${basename}.tar.xz";
|
||||||
@ -35,10 +33,12 @@ stdenv.mkDerivation rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig texinfo perl ]
|
nativeBuildInputs = [ pkgconfig texinfo perl ]
|
||||||
++ stdenv.lib.optional isGNU mig;
|
# TODO(@Ericson2314) not sure if should be host or target
|
||||||
|
++ stdenv.lib.optional targetPlatform.isHurd mig;
|
||||||
|
|
||||||
buildInputs = [ ncurses readline gmp mpfr expat zlib python guile ]
|
buildInputs = [ ncurses readline gmp mpfr expat zlib guile ]
|
||||||
++ stdenv.lib.optional isGNU hurd
|
++ stdenv.lib.optional pythonSupport python
|
||||||
|
++ stdenv.lib.optional targetPlatform.isHurd hurd
|
||||||
++ stdenv.lib.optional doCheck dejagnu;
|
++ stdenv.lib.optional doCheck dejagnu;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
@ -46,24 +46,16 @@ stdenv.mkDerivation rec {
|
|||||||
# darwin build fails with format hardening since v7.12
|
# darwin build fails with format hardening since v7.12
|
||||||
hardeningDisable = stdenv.lib.optionals stdenv.isDarwin [ "format" ];
|
hardeningDisable = stdenv.lib.optionals stdenv.isDarwin [ "format" ];
|
||||||
|
|
||||||
configureFlags = with stdenv.lib;
|
configureFlags = with stdenv.lib; [
|
||||||
[ "--with-gmp=${gmp.dev}" "--with-mpfr=${mpfr.dev}" "--with-system-readline"
|
"--with-gmp=${gmp.dev}" "--with-mpfr=${mpfr.dev}" "--with-system-readline"
|
||||||
"--with-system-zlib" "--with-expat" "--with-libexpat-prefix=${expat.dev}"
|
"--with-system-zlib" "--with-expat" "--with-libexpat-prefix=${expat.dev}"
|
||||||
|
] ++ stdenv.lib.optional hostPlatform.isLinux
|
||||||
|
# TODO(@Ericson2314): make this conditional on whether host platform is NixOS
|
||||||
"--with-separate-debug-dir=/run/current-system/sw/lib/debug"
|
"--with-separate-debug-dir=/run/current-system/sw/lib/debug"
|
||||||
]
|
++ stdenv.lib.optional (!pythonSupport) "--without-python"
|
||||||
++ optional (target != null) "--target=${target.config}"
|
# TODO(@Ericson2314): This should be done in stdenv, not per-package
|
||||||
++ optional multitarget "--enable-targets=all"
|
++ stdenv.lib.optional (targetPlatform != hostPlatform) "--target=${target.config}"
|
||||||
++ optional (elem stdenv.system platforms.cygwin) "--without-python";
|
++ stdenv.lib.optional multitarget "--enable-targets=all";
|
||||||
|
|
||||||
crossAttrs = {
|
|
||||||
# Do not add --with-python here to avoid cross building it.
|
|
||||||
configureFlags = with stdenv.lib;
|
|
||||||
[ "--with-gmp=${gmp.crossDrv}" "--with-mpfr=${mpfr.crossDrv}" "--with-system-readline"
|
|
||||||
"--with-system-zlib" "--with-expat" "--with-libexpat-prefix=${expat.crossDrv}" "--without-python"
|
|
||||||
]
|
|
||||||
++ optional (target != null) "--target=${target.config}"
|
|
||||||
++ optional multitarget "--enable-targets=all";
|
|
||||||
};
|
|
||||||
|
|
||||||
postInstall =
|
postInstall =
|
||||||
'' # Remove Info files already provided by Binutils and other packages.
|
'' # Remove Info files already provided by Binutils and other packages.
|
||||||
|
@ -7076,10 +7076,6 @@ with pkgs;
|
|||||||
|
|
||||||
gdbGuile = lowPrio (gdb.override { inherit guile; });
|
gdbGuile = lowPrio (gdb.override { inherit guile; });
|
||||||
|
|
||||||
gdbCross = lowPrio (callPackage ../development/tools/misc/gdb {
|
|
||||||
target = if targetPlatform != buildPlatform then targetPlatform else null;
|
|
||||||
});
|
|
||||||
|
|
||||||
gdb-multitarget = lowPrio (gdb.override { multitarget = true; });
|
gdb-multitarget = lowPrio (gdb.override { multitarget = true; });
|
||||||
|
|
||||||
valgrind = callPackage ../development/tools/analysis/valgrind {
|
valgrind = callPackage ../development/tools/analysis/valgrind {
|
||||||
|
@ -24,7 +24,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
linuxCommon = lib.recursiveUpdate gnuCommon {
|
linuxCommon = lib.recursiveUpdate gnuCommon {
|
||||||
buildPackages.gdbCross = nativePlatforms;
|
buildPackages.gdb = nativePlatforms;
|
||||||
|
|
||||||
bison = nativePlatforms;
|
bison = nativePlatforms;
|
||||||
busybox = nativePlatforms;
|
busybox = nativePlatforms;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user