From a148b889f1dd85ca6cec34b624fe8b4778433ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 19 Nov 2011 18:28:10 +0000 Subject: [PATCH] GDB: Allow cross-compilation for GNU. svn path=/nixpkgs/trunk/; revision=30481 --- pkgs/development/tools/misc/gdb/default.nix | 24 ++++++++++++++++----- pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix index 7da5ac31e2a..0e22aed5887 100644 --- a/pkgs/development/tools/misc/gdb/default.nix +++ b/pkgs/development/tools/misc/gdb/default.nix @@ -4,16 +4,28 @@ # Set it to true to fetch the latest release/branchpoint from git. , bleedingEdgeVersion ? false +# Additional dependencies for GNU/Hurd. +, mig ? null, hurd ? null + # needed for the git version , flex, bison }: let - basename = - if bleedingEdgeVersion - then "gdb-7.3.20110726" - else "gdb-7.3.1"; + basename = + if bleedingEdgeVersion + then "gdb-7.3.20110726" + else "gdb-7.3.1"; + + # Whether (cross-)building for GNU/Hurd. This is an approximation since + # having `stdenv ? cross' doesn't tell us if we're building `hostDrv' and + # `buildDrv'. + isGNU = + stdenv.system == "i586-pc-gnu" + || (stdenv ? cross && stdenv.cross.config == "i586-pc-gnu"); in +assert isGNU -> mig != null && hurd != null; + stdenv.mkDerivation rec { name = basename + stdenv.lib.optionalString (target != null) ("-" + target.config); @@ -34,9 +46,11 @@ stdenv.mkDerivation rec { # I think python is not a native input, but I leave it # here while I will not need it cross building buildNativeInputs = [ texinfo python ] - ++ stdenv.lib.optionals bleedingEdgeVersion [ flex bison ]; + ++ stdenv.lib.optional isGNU mig + ++ stdenv.lib.optionals bleedingEdgeVersion [ flex bison ]; buildInputs = [ ncurses readline gmp mpfr expat ] + ++ stdenv.lib.optional isGNU hurd ++ stdenv.lib.optional doCheck dejagnu; configureFlags = with stdenv.lib; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f18acb25749..81d1c5aa256 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3042,6 +3042,8 @@ let gdb = callPackage ../development/tools/misc/gdb { readline = readline5; + hurd = gnu.hurdCross; + inherit (gnu) mig; }; gdbCross = callPackage ../development/tools/misc/gdb {