1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 21:21:06 +00:00

Merge pull request #25997 from obsidiansystems/isHurd

stdenv: Rename `isGNU` to `isHurd` as GNU is a userland
This commit is contained in:
John Ericson 2017-05-22 19:02:49 -04:00 committed by GitHub
commit c3b2c5bf77
12 changed files with 54 additions and 65 deletions

View file

@ -7,6 +7,7 @@ rec {
"64bit" = { cpu = { bits = 64; }; }; "64bit" = { cpu = { bits = 64; }; };
i686 = { cpu = cpuTypes.i686; }; i686 = { cpu = cpuTypes.i686; };
x86_64 = { cpu = cpuTypes.x86_64; }; x86_64 = { cpu = cpuTypes.x86_64; };
x86 = { cpu = { family = "x86"; }; };
Arm = { cpu = { family = "arm"; }; }; Arm = { cpu = { family = "arm"; }; };
Mips = { cpu = { family = "mips"; }; }; Mips = { cpu = { family = "mips"; }; };
BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; }; BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };
@ -19,6 +20,7 @@ rec {
Linux = { kernel = kernels.linux; }; Linux = { kernel = kernels.linux; };
SunOS = { kernel = kernels.solaris; }; SunOS = { kernel = kernels.solaris; };
FreeBSD = { kernel = kernels.freebsd; }; FreeBSD = { kernel = kernels.freebsd; };
Hurd = { kernel = kernels.hurd; };
NetBSD = { kernel = kernels.netbsd; }; NetBSD = { kernel = kernels.netbsd; };
OpenBSD = { kernel = kernels.openbsd; }; OpenBSD = { kernel = kernels.openbsd; };
Windows = { kernel = kernels.windows; }; Windows = { kernel = kernels.windows; };
@ -27,7 +29,6 @@ rec {
Arm32 = recursiveUpdate patterns.Arm patterns."32bit"; Arm32 = recursiveUpdate patterns.Arm patterns."32bit";
Arm64 = recursiveUpdate patterns.Arm patterns."64bit"; Arm64 = recursiveUpdate patterns.Arm patterns."64bit";
}; };
predicates = mapAttrs' predicates = mapAttrs'

View file

@ -77,6 +77,7 @@ rec {
{ {
darwin = { execFormat = macho; families = { inherit unix; }; }; darwin = { execFormat = macho; families = { inherit unix; }; };
freebsd = { execFormat = elf; families = { inherit unix bsd; }; }; freebsd = { execFormat = elf; families = { inherit unix bsd; }; };
hurd = { execFormat = elf; families = { inherit unix; }; };
linux = { execFormat = elf; families = { inherit unix; }; }; linux = { execFormat = elf; families = { inherit unix; }; };
netbsd = { execFormat = elf; families = { inherit unix bsd; }; }; netbsd = { execFormat = elf; families = { inherit unix bsd; }; };
none = { execFormat = unknown; families = { inherit unix; }; }; none = { execFormat = unknown; families = { inherit unix; }; };
@ -113,7 +114,9 @@ rec {
mkSkeletonFromList = l: { mkSkeletonFromList = l: {
"2" = # We only do 2-part hacks for things Nix already supports "2" = # We only do 2-part hacks for things Nix already supports
if elemAt l 1 == "cygwin" if elemAt l 1 == "cygwin"
then { cpu = elemAt l 0; kernel = "windows"; abi = "cygnus"; } then { cpu = elemAt l 0; kernel = "windows"; abi = "cygnus"; }
else if elemAt l 1 == "gnu"
then { cpu = elemAt l 0; kernel = "hurd"; abi = "gnu"; }
else { cpu = elemAt l 0; kernel = elemAt l 1; }; else { cpu = elemAt l 0; kernel = elemAt l 1; };
"3" = # Awkwards hacks, beware! "3" = # Awkwards hacks, beware!
if elemAt l 1 == "apple" if elemAt l 1 == "apple"

View file

@ -226,7 +226,7 @@ stdenv.mkDerivation ({
libc_dev = stdenv.cc.libc_dev; libc_dev = stdenv.cc.libc_dev;
postPatch = postPatch =
if (stdenv.isGNU if (stdenv.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")

View file

@ -230,7 +230,7 @@ stdenv.mkDerivation ({
libc_dev = stdenv.cc.libc_dev; libc_dev = stdenv.cc.libc_dev;
postPatch = postPatch =
if (stdenv.isGNU if (stdenv.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")

View file

@ -247,7 +247,7 @@ stdenv.mkDerivation ({
''; '';
postPatch = postPatch =
if (stdenv.isGNU if (stdenv.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")

View file

@ -229,7 +229,7 @@ stdenv.mkDerivation ({
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
postPatch = postPatch =
if (stdenv.isGNU if (stdenv.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")

View file

@ -230,7 +230,7 @@ stdenv.mkDerivation ({
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
postPatch = postPatch =
if (stdenv.isGNU if (stdenv.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")

View file

@ -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.

View file

@ -402,13 +402,10 @@ let
# Utility flags to test the type of platform. # Utility flags to test the type of platform.
inherit (hostPlatform) inherit (hostPlatform)
isDarwin isLinux isSunOS isCygwin isFreeBSD isOpenBSD isi686 isx86_64 isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
is64bit isMips isBigEndian; isi686 isx86_64 is64bit isMips isBigEndian;
isArm = hostPlatform.isArm32; isArm = hostPlatform.isArm32;
isAarch64 = hostPlatform.isArm64; isAarch64 = hostPlatform.isArm64;
# Other code instead checks for anything using GNU userland,
# e.g. GNU/linux. This refers just to GNU Hurd.
isGNU = system == "i686-gnu";
# Whether we should run paxctl to pax-mark binaries. # Whether we should run paxctl to pax-mark binaries.
needsPax = isLinux; needsPax = isLinux;

View file

@ -1,7 +1,10 @@
{ stdenv, fetchurl, unzip }: { stdenv, fetchurl, unzip
, buildPlatform, hostPlatform
}:
let let
s = # Generated upstream information # Generated upstream information
rec { s = rec {
baseName="zpaqd"; baseName="zpaqd";
version="715"; version="715";
name="${baseName}-${version}"; name="${baseName}-${version}";
@ -9,15 +12,12 @@ let
url="http://mattmahoney.net/dc/zpaqd715.zip"; url="http://mattmahoney.net/dc/zpaqd715.zip";
sha256="0868lynb45lm79yvx5f10lj5h6bfv0yck8whcls2j080vmk3n7rk"; sha256="0868lynb45lm79yvx5f10lj5h6bfv0yck8whcls2j080vmk3n7rk";
}; };
isUnix = with stdenv; isLinux || isGNU || isDarwin || isFreeBSD || isOpenBSD;
isx86 = stdenv.isi686 || stdenv.isx86_64; compileFlags = stdenv.lib.concatStringsSep " " ([ "-O3" "-mtune=generic" "-DNDEBUG" ]
compileFlags = with stdenv; "" ++ stdenv.lib.optional (hostPlatform.isUnix) "-Dunix -pthread"
+ (lib.optionalString (isUnix) " -Dunix -pthread") ++ stdenv.lib.optional (hostPlatform.isi686) "-march=i686"
+ (lib.optionalString (isi686) " -march=i686") ++ stdenv.lib.optional (hostPlatform.isx86_64) "-march=nocona"
+ (lib.optionalString (isx86_64) " -march=nocona") ++ stdenv.lib.optional (!hostPlatform.isx86) "-DNOJIT");
+ (lib.optionalString (!isx86) " -DNOJIT")
+ " -O3 -mtune=generic -DNDEBUG"
;
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit (s) name version; inherit (s) name version;

View file

@ -7142,10 +7142,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 {

View file

@ -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;