at v192 99 lines 3.2 kB view raw
1{ stdenv, fetchurl, perl, gmp ? null 2, aclSupport ? false, acl ? null 3, selinuxSupport? false, libselinux ? null, libsepol ? null 4, autoconf, automake114x, texinfo 5}: 6 7assert aclSupport -> acl != null; 8assert selinuxSupport -> libselinux != null && libsepol != null; 9 10 11with { inherit (stdenv.lib) optional optionals optionalString optionalAttrs; }; 12 13let 14 self = stdenv.mkDerivation rec { 15 name = "coreutils-8.24"; 16 17 src = fetchurl { 18 url = "mirror://gnu/coreutils/${name}.tar.xz"; 19 sha256 = "0w11jw3fb5sslf0f72kxy7llxgk1ia3a6bcw0c9kmvxrlj355mx2"; 20 }; 21 22 patches = if stdenv.isCygwin then [ ./coreutils-8.23-4.cygwin.patch ] else null; 23 24 # The test tends to fail on btrfs and maybe other unusual filesystems. 25 postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) '' 26 sed '2i echo Skipping dd sparse test && exit 0' -i ./tests/dd/sparse.sh 27 sed '2i echo Skipping cp sparse test && exit 0' -i ./tests/cp/sparse.sh 28 ''; 29 30 nativeBuildInputs = [ perl ]; 31 buildInputs = [ gmp ] 32 ++ optional aclSupport acl 33 ++ optionals stdenv.isCygwin [ autoconf automake114x texinfo ] # due to patch 34 ++ optionals selinuxSupport [ libselinux libsepol ]; 35 36 crossAttrs = { 37 buildInputs = [ gmp.crossDrv ] 38 ++ optional aclSupport acl.crossDrv 39 ++ optionals selinuxSupport [ libselinux.crossDrv libsepol.crossDrv ] 40 ++ optional (stdenv.ccCross.libc ? libiconv) 41 stdenv.ccCross.libc.libiconv.crossDrv; 42 43 buildPhase = '' 44 make || ( 45 pushd man 46 for a in *.x; do 47 touch `basename $a .x`.1 48 done 49 popd; make ) 50 ''; 51 52 postInstall = '' 53 rm $out/share/man/man1/* 54 cp ${self}/share/man/man1/* $out/share/man/man1 55 ''; 56 57 # Needed for fstatfs() 58 # I don't know why it is not properly detected cross building with glibc. 59 configureFlags = [ "fu_cv_sys_stat_statfs2_bsize=yes" ]; 60 doCheck = false; 61 }; 62 63 # The tests are known broken on Cygwin 64 # (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19025), 65 # Darwin (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19351), 66 # and {Open,Free}BSD. 67 doCheck = stdenv ? glibc; 68 69 # Saw random failures like ‘help2man: can't get '--help' info from 70 # man/sha512sum.td/sha512sum’. 71 enableParallelBuilding = false; 72 73 NIX_LDFLAGS = optionalString selinuxSupport "-lsepol"; 74 75 makeFlags = optionalString stdenv.isDarwin "CFLAGS=-D_FORTIFY_SOURCE=0"; 76 77 meta = { 78 homepage = http://www.gnu.org/software/coreutils/; 79 description = "The basic file, shell and text manipulation utilities of the GNU operating system"; 80 81 longDescription = '' 82 The GNU Core Utilities are the basic file, shell and text 83 manipulation utilities of the GNU operating system. These are 84 the core utilities which are expected to exist on every 85 operating system. 86 ''; 87 88 license = stdenv.lib.licenses.gpl3Plus; 89 90 platforms = stdenv.lib.platforms.all; 91 92 maintainers = [ stdenv.lib.maintainers.eelco ]; 93 }; 94 }; 95in 96 self 97 // stdenv.lib.optionalAttrs (stdenv.system == "armv7l-linux" || stdenv.isSunOS) { 98 FORCE_UNSAFE_CONFIGURE = 1; 99 }