Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 131 lines 5.3 kB view raw
1{ stdenv, lib, buildPackages 2, autoreconfHook, texinfo, fetchurl, perl, xz, libiconv, gmp ? null 3, aclSupport ? stdenv.isLinux, acl ? null 4, attrSupport ? stdenv.isLinux, attr ? null 5, selinuxSupport? false, libselinux ? null, libsepol ? null 6# No openssl in default version, so openssl-induced rebuilds aren't too big. 7# It makes *sum functions significantly faster. 8, minimal ? true, withOpenssl ? !minimal, openssl ? null 9, withPrefix ? false 10, singleBinary ? "symlinks" # you can also pass "shebangs" or false 11}: 12 13assert aclSupport -> acl != null; 14assert selinuxSupport -> libselinux != null && libsepol != null; 15 16with lib; 17 18stdenv.mkDerivation rec { 19 name = "coreutils-8.30"; 20 21 src = fetchurl { 22 url = "mirror://gnu/coreutils/${name}.tar.xz"; 23 sha256 = "0mxhw43d4wpqmvg0l4znk1vm10fy92biyh90lzdnqjcic2lb6cg8"; 24 }; 25 26 patches = optional stdenv.hostPlatform.isCygwin ./coreutils-8.23-4.cygwin.patch; 27 28 postPatch = '' 29 # The test tends to fail on btrfs,f2fs and maybe other unusual filesystems. 30 sed '2i echo Skipping dd sparse test && exit 0' -i ./tests/dd/sparse.sh 31 sed '2i echo Skipping du threshold test && exit 0' -i ./tests/du/threshold.sh 32 sed '2i echo Skipping cp sparse test && exit 0' -i ./tests/cp/sparse.sh 33 sed '2i echo Skipping rm deep-2 test && exit 0' -i ./tests/rm/deep-2.sh 34 sed '2i echo Skipping du long-from-unreadable test && exit 0' -i ./tests/du/long-from-unreadable.sh 35 36 # sandbox does not allow setgid 37 sed '2i echo Skipping chmod setgid test && exit 0' -i ./tests/chmod/setgid.sh 38 substituteInPlace ./tests/install/install-C.sh \ 39 --replace 'mode3=2755' 'mode3=1755' 40 41 sed '2i print "Skipping env -S test"; exit 0;' -i ./tests/misc/env-S.pl 42 43 # these tests fail in the unprivileged nix sandbox (without nix-daemon) as we break posix assumptions 44 for f in ./tests/chgrp/{basic.sh,recurse.sh,default-no-deref.sh,no-x.sh,posix-H.sh}; do 45 sed '2i echo Skipping chgrp && exit 0' -i "$f" 46 done 47 for f in gnulib-tests/{test-chown.c,test-fchownat.c,test-lchown.c}; do 48 echo "int main() { return 0; }" > "$f" 49 done 50 ''; 51 52 outputs = [ "out" "info" ]; 53 54 nativeBuildInputs = [ perl xz.bin ]; 55 configureFlags = [ "--with-packager=https://NixOS.org" ] 56 ++ optional (singleBinary != false) 57 ("--enable-single-binary" + optionalString (isString singleBinary) "=${singleBinary}") 58 ++ optional withOpenssl "--with-openssl" 59 ++ optional stdenv.hostPlatform.isSunOS "ac_cv_func_inotify_init=no" 60 ++ optional withPrefix "--program-prefix=g" 61 ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "glibc") [ 62 # TODO(19b98110126fde7cbb1127af7e3fe1568eacad3d): Needed for fstatfs() I 63 # don't know why it is not properly detected cross building with glibc. 64 "fu_cv_sys_stat_statfs2_bsize=yes" 65 ]; 66 67 68 buildInputs = [ gmp ] 69 ++ optional aclSupport acl 70 ++ optional attrSupport attr 71 ++ optional withOpenssl openssl 72 ++ optionals stdenv.hostPlatform.isCygwin [ autoreconfHook texinfo ] # due to patch 73 ++ optionals selinuxSupport [ libselinux libsepol ] 74 # TODO(@Ericson2314): Investigate whether Darwin could benefit too 75 ++ optional (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc != "glibc") libiconv; 76 77 # The tests are known broken on Cygwin 78 # (http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/19025), 79 # Darwin (http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/19351), 80 # and {Open,Free}BSD. 81 # With non-standard storeDir: https://github.com/NixOS/nix/issues/512 82 doCheck = stdenv.hostPlatform == stdenv.buildPlatform 83 && stdenv.hostPlatform.libc == "glibc" 84 && builtins.storeDir == "/nix/store"; 85 86 # Prevents attempts of running 'help2man' on cross-built binaries. 87 PERL = if stdenv.hostPlatform == stdenv.buildPlatform then null else "missing"; 88 89 # Saw random failures like ‘help2man: can't get '--help' info from 90 # man/sha512sum.td/sha512sum’. 91 enableParallelBuilding = false; 92 93 NIX_LDFLAGS = optionalString selinuxSupport "-lsepol"; 94 FORCE_UNSAFE_CONFIGURE = optionalString stdenv.hostPlatform.isSunOS "1"; 95 96 # Works around a bug with 8.26: 97 # Makefile:3440: *** Recursive variable 'INSTALL' references itself (eventually). Stop. 98 preInstall = optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' 99 sed -i Makefile -e 's|^INSTALL =.*|INSTALL = ${buildPackages.coreutils}/bin/install -c|' 100 ''; 101 102 postInstall = optionalString (stdenv.hostPlatform != stdenv.buildPlatform && !minimal) '' 103 rm $out/share/man/man1/* 104 cp ${buildPackages.coreutils-full}/share/man/man1/* $out/share/man/man1 105 '' 106 # du: 8.7 M locale + 0.4 M man pages 107 + optionalString minimal '' 108 rm -r "$out/share" 109 ''; 110 111 meta = { 112 homepage = https://www.gnu.org/software/coreutils/; 113 description = "The basic file, shell and text manipulation utilities of the GNU operating system"; 114 115 longDescription = '' 116 The GNU Core Utilities are the basic file, shell and text 117 manipulation utilities of the GNU operating system. These are 118 the core utilities which are expected to exist on every 119 operating system. 120 ''; 121 122 license = licenses.gpl3Plus; 123 124 platforms = platforms.unix ++ platforms.windows; 125 126 priority = 10; 127 128 maintainers = [ maintainers.eelco ]; 129 }; 130 131}