@ -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 = " g d b - 7 . 1 2 . 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 == " i 6 8 6 - g n u "
|| ( stdenv ? cross && stdenv . cross . config == " i 5 8 6 - p c - g n u " ) ;
basename = " g d b - ${ version } " ;
version = " 7 . 1 2 . 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 = " m i r r o r : / / g n u / g d b / ${ basename } . t a r . x z " ;
@ -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 [ " f o r m a t " ] ;
configureFlags = with stdenv . lib ;
[ " - - w i t h - g m p = ${ gmp . dev } " " - - w i t h - m p f r = ${ mpfr . dev } " " - - w i t h - s y s t e m - r e a d l i n e "
" - - w i t h - s y s t e m - z l i b " " - - w i t h - e x p a t " " - - w i t h - l i b e x p a t - p r e f i x = ${ expat . dev } "
configureFlags = with stdenv . lib ; [
" - - w i t h - g m p = ${ gmp . dev } " " - - w i t h - m p f r = ${ mpfr . dev } " " - - w i t h - s y s t e m - r e a d l i n e "
" - - w i t h - s y s t e m - z l i b " " - - w i t h - e x p a t " " - - w i t h - l i b e x p a t - p r e f i x = ${ expat . dev } "
] ++ stdenv . lib . optional hostPlatform . isLinux
# TODO(@Ericson2314): make this conditional on whether host platform is NixOS
" - - w i t h - s e p a r a t e - d e b u g - d i r = / r u n / c u r r e n t - s y s t e m / s w / l i b / d e b u g "
]
++ optional ( target != null ) " - - t a r g e t = ${ target . config } "
++ optional multitarget " - - e n a b l e - t a r g e t s = a l l "
++ optional ( elem stdenv . system platforms . cygwin ) " - - w i t h o u t - p y t h o n " ;
crossAttrs = {
# Do not add --with-python here to avoid cross building it.
configureFlags = with stdenv . lib ;
[ " - - w i t h - g m p = ${ gmp . crossDrv } " " - - w i t h - m p f r = ${ mpfr . crossDrv } " " - - w i t h - s y s t e m - r e a d l i n e "
" - - w i t h - s y s t e m - z l i b " " - - w i t h - e x p a t " " - - w i t h - l i b e x p a t - p r e f i x = ${ expat . crossDrv } " " - - w i t h o u t - p y t h o n "
]
++ optional ( target != null ) " - - t a r g e t = ${ target . config } "
++ optional multitarget " - - e n a b l e - t a r g e t s = a l l " ;
} ;
++ stdenv . lib . optional ( ! pythonSupport ) " - - w i t h o u t - p y t h o n "
# TODO(@Ericson2314): This should be done in stdenv, not per-package
++ stdenv . lib . optional ( targetPlatform != hostPlatform ) " - - t a r g e t = ${ target . config } "
++ stdenv . lib . optional multitarget " - - e n a b l e - t a r g e t s = a l l " ;
postInstall =
'' # R e m o v e I n f o f i l e s a l r e a d y p r o v i d e d b y B i n u t i l s a n d o t h e r p a c k a g e s .