diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2017-05-22 16:36:59 -0400 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2017-05-22 17:10:29 -0400 |
commit | c443033be325f0f39d621d28407ea00af2b45631 (patch) | |
tree | bfadee668d8884a453a557f0dca0c912ce562563 | |
parent | eaa509f33a7058bd819f02a1da32c4ed372e6b49 (diff) | |
download | nixlib-c443033be325f0f39d621d28407ea00af2b45631.tar nixlib-c443033be325f0f39d621d28407ea00af2b45631.tar.gz nixlib-c443033be325f0f39d621d28407ea00af2b45631.tar.bz2 nixlib-c443033be325f0f39d621d28407ea00af2b45631.tar.lz nixlib-c443033be325f0f39d621d28407ea00af2b45631.tar.xz nixlib-c443033be325f0f39d621d28407ea00af2b45631.tar.zst nixlib-c443033be325f0f39d621d28407ea00af2b45631.zip |
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
-rw-r--r-- | pkgs/development/tools/misc/gdb/default.nix | 64 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 | ||||
-rw-r--r-- | pkgs/top-level/release-cross.nix | 2 |
3 files changed, 29 insertions, 41 deletions
diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix index f39d15bc7be6..d1ac6eba709a 100644 --- a/pkgs/development/tools/misc/gdb/default.nix +++ b/pkgs/development/tools/misc/gdb/default.nix @@ -1,33 +1,31 @@ { fetchurl, stdenv, ncurses, readline, gmp, mpfr, expat, texinfo, zlib , dejagnu, perl, pkgconfig -, python ? null + +, buildPlatform, hostPlatform, targetPlatform + +, pythonSupport ? hostPlatform == buildPlatform && !hostPlatform.isCygwin, python ? null , guile ? null -, target ? null + # Support all known targets in one gdb binary. , multitarget ? false + # Additional dependencies for GNU/Hurd. , mig ? null, hurd ? null - }: let - - basename = "gdb-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"); - + basename = "gdb-${version}"; + version = "7.12.1"; in -assert isGNU -> mig != null && hurd != null; +assert targetPlatform.isHurd -> mig != null && hurd != null; +assert pythonSupport -> python != null; stdenv.mkDerivation rec { - name = basename + stdenv.lib.optionalString (target != null) - ("-" + target.config); + name = + stdenv.lib.optionalString (targetPlatform != hostPlatform) + (targetPlatform.config + "-") + + basename; src = fetchurl { url = "mirror://gnu/gdb/${basename}.tar.xz"; @@ -35,10 +33,12 @@ stdenv.mkDerivation rec { }; 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 ] - ++ stdenv.lib.optional isGNU hurd + buildInputs = [ ncurses readline gmp mpfr expat zlib guile ] + ++ stdenv.lib.optional pythonSupport python + ++ stdenv.lib.optional targetPlatform.isHurd hurd ++ stdenv.lib.optional doCheck dejagnu; enableParallelBuilding = true; @@ -46,24 +46,16 @@ stdenv.mkDerivation rec { # darwin build fails with format hardening since v7.12 hardeningDisable = stdenv.lib.optionals stdenv.isDarwin [ "format" ]; - configureFlags = with stdenv.lib; - [ "--with-gmp=${gmp.dev}" "--with-mpfr=${mpfr.dev}" "--with-system-readline" - "--with-system-zlib" "--with-expat" "--with-libexpat-prefix=${expat.dev}" + configureFlags = with stdenv.lib; [ + "--with-gmp=${gmp.dev}" "--with-mpfr=${mpfr.dev}" "--with-system-readline" + "--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" - ] - ++ optional (target != null) "--target=${target.config}" - ++ optional multitarget "--enable-targets=all" - ++ optional (elem stdenv.system platforms.cygwin) "--without-python"; - - 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"; - }; + ++ stdenv.lib.optional (!pythonSupport) "--without-python" + # TODO(@Ericson2314): This should be done in stdenv, not per-package + ++ stdenv.lib.optional (targetPlatform != hostPlatform) "--target=${target.config}" + ++ stdenv.lib.optional multitarget "--enable-targets=all"; postInstall = '' # Remove Info files already provided by Binutils and other packages. diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a74fd79d6e74..173d63553cea 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7076,10 +7076,6 @@ with pkgs; 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; }); valgrind = callPackage ../development/tools/analysis/valgrind { diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index 1e764ef00727..b4da273cac99 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -24,7 +24,7 @@ let }; linuxCommon = lib.recursiveUpdate gnuCommon { - buildPackages.gdbCross = nativePlatforms; + buildPackages.gdb = nativePlatforms; bison = nativePlatforms; busybox = nativePlatforms; |