Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 108 lines 4.2 kB view raw
1{ stdenv, lib, buildPackages 2, autoreconfHook, texinfo, fetchurl, perl, xz, libiconv, gmp ? null 3, hostPlatform, buildPlatform 4, aclSupport ? false, acl ? null 5, attrSupport ? false, attr ? null 6, selinuxSupport? false, libselinux ? null, libsepol ? null 7, withPrefix ? false 8, singleBinary ? "symlinks" # you can also pass "shebangs" or false 9}: 10 11assert aclSupport -> acl != null; 12assert selinuxSupport -> libselinux != null && libsepol != null; 13 14with lib; 15 16stdenv.mkDerivation rec { 17 name = "coreutils-8.29"; 18 19 src = fetchurl { 20 url = "mirror://gnu/coreutils/${name}.tar.xz"; 21 sha256 = "0plm1zs9il6bb5mk881qvbghq4glc8ybbgakk2lfzb0w64fgml4j"; 22 }; 23 24 patches = optional hostPlatform.isCygwin ./coreutils-8.23-4.cygwin.patch; 25 26 # The test tends to fail on btrfs and maybe other unusual filesystems. 27 postPatch = optionalString (!hostPlatform.isDarwin) '' 28 sed '2i echo Skipping dd sparse test && exit 0' -i ./tests/dd/sparse.sh 29 sed '2i echo Skipping cp sparse test && exit 0' -i ./tests/cp/sparse.sh 30 sed '2i echo Skipping rm deep-2 test && exit 0' -i ./tests/rm/deep-2.sh 31 sed '2i echo Skipping du long-from-unreadable test && exit 0' -i ./tests/du/long-from-unreadable.sh 32 sed '2i echo Skipping chmod setgid test && exit 0' -i ./tests/chmod/setgid.sh 33 substituteInPlace ./tests/install/install-C.sh \ 34 --replace 'mode3=2755' 'mode3=1755' 35 ''; 36 37 outputs = [ "out" "info" ]; 38 39 nativeBuildInputs = [ perl xz.bin ]; 40 configureFlags = 41 optional (singleBinary != false) 42 ("--enable-single-binary" + optionalString (isString singleBinary) "=${singleBinary}") 43 ++ optional hostPlatform.isSunOS "ac_cv_func_inotify_init=no" 44 ++ optional withPrefix "--program-prefix=g" 45 ++ optionals (hostPlatform != buildPlatform && hostPlatform.libc == "glibc") [ 46 # TODO(19b98110126fde7cbb1127af7e3fe1568eacad3d): Needed for fstatfs() I 47 # don't know why it is not properly detected cross building with glibc. 48 "fu_cv_sys_stat_statfs2_bsize=yes" 49 ]; 50 51 52 buildInputs = [ gmp ] 53 ++ optional aclSupport acl 54 ++ optional attrSupport attr 55 ++ optionals hostPlatform.isCygwin [ autoreconfHook texinfo ] # due to patch 56 ++ optionals selinuxSupport [ libselinux libsepol ] 57 # TODO(@Ericson2314): Investigate whether Darwin could benefit too 58 ++ optional (hostPlatform != buildPlatform && hostPlatform.libc != "glibc") libiconv; 59 60 # The tests are known broken on Cygwin 61 # (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19025), 62 # Darwin (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19351), 63 # and {Open,Free}BSD. 64 # With non-standard storeDir: https://github.com/NixOS/nix/issues/512 65 doCheck = hostPlatform == buildPlatform 66 && hostPlatform.libc == "glibc" 67 && builtins.storeDir == "/nix/store"; 68 69 # Prevents attempts of running 'help2man' on cross-built binaries. 70 PERL = if hostPlatform == buildPlatform then null else "missing"; 71 72 # Saw random failures like ‘help2man: can't get '--help' info from 73 # man/sha512sum.td/sha512sum’. 74 enableParallelBuilding = false; 75 76 NIX_LDFLAGS = optionalString selinuxSupport "-lsepol"; 77 FORCE_UNSAFE_CONFIGURE = optionalString hostPlatform.isSunOS "1"; 78 79 # Works around a bug with 8.26: 80 # Makefile:3440: *** Recursive variable 'INSTALL' references itself (eventually). Stop. 81 preInstall = optionalString (hostPlatform != buildPlatform) '' 82 sed -i Makefile -e 's|^INSTALL =.*|INSTALL = ${buildPackages.coreutils}/bin/install -c|' 83 ''; 84 85 postInstall = optionalString (hostPlatform != buildPlatform) '' 86 rm $out/share/man/man1/* 87 cp ${buildPackages.coreutils}/share/man/man1/* $out/share/man/man1 88 ''; 89 90 meta = { 91 homepage = http://www.gnu.org/software/coreutils/; 92 description = "The basic file, shell and text manipulation utilities of the GNU operating system"; 93 94 longDescription = '' 95 The GNU Core Utilities are the basic file, shell and text 96 manipulation utilities of the GNU operating system. These are 97 the core utilities which are expected to exist on every 98 operating system. 99 ''; 100 101 license = licenses.gpl3Plus; 102 103 platforms = platforms.all; 104 105 maintainers = [ maintainers.eelco ]; 106 }; 107 108}