Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 17.09 113 lines 4.4 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.28"; 18 19 src = fetchurl { 20 url = "mirror://gnu/coreutils/${name}.tar.xz"; 21 sha256 = "0r8c1bgm68kl70j1lgd0rv12iykw6143k4m9a56xip9rc2hv25qi"; 22 }; 23 24 # FIXME needs gcc 4.9 in bootstrap tools 25 hardeningDisable = [ "stackprotector" ]; 26 27 patches = optional hostPlatform.isCygwin ./coreutils-8.23-4.cygwin.patch; 28 29 # The test tends to fail on btrfs and maybe other unusual filesystems. 30 postPatch = optionalString (!hostPlatform.isDarwin) '' 31 sed '2i echo Skipping dd sparse test && exit 0' -i ./tests/dd/sparse.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 sed '2i echo Skipping chmod setgid test && exit 0' -i ./tests/chmod/setgid.sh 36 substituteInPlace ./tests/install/install-C.sh \ 37 --replace 'mode3=2755' 'mode3=1755' 38 ''; 39 40 outputs = [ "out" "info" ]; 41 42 nativeBuildInputs = [ perl xz.bin ]; 43 configureFlags = 44 optional (singleBinary != false) 45 ("--enable-single-binary" + optionalString (isString singleBinary) "=${singleBinary}") 46 ++ optional hostPlatform.isSunOS "ac_cv_func_inotify_init=no" 47 ++ optional withPrefix "--program-prefix=g" 48 ++ optionals (hostPlatform != buildPlatform && hostPlatform.libc == "glibc") [ 49 # TODO(19b98110126fde7cbb1127af7e3fe1568eacad3d): Needed for fstatfs() I 50 # don't know why it is not properly detected cross building with glibc. 51 "fu_cv_sys_stat_statfs2_bsize=yes" 52 ]; 53 54 55 buildInputs = [ gmp ] 56 ++ optional aclSupport acl 57 ++ optional attrSupport attr 58 ++ optionals hostPlatform.isCygwin [ autoreconfHook texinfo ] # due to patch 59 ++ optionals selinuxSupport [ libselinux libsepol ] 60 # TODO(@Ericson2314): Investigate whether Darwin could benefit too 61 ++ optional (hostPlatform != buildPlatform && hostPlatform.libc != "glibc") libiconv; 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 # With non-standard storeDir: https://github.com/NixOS/nix/issues/512 68 doCheck = hostPlatform == buildPlatform 69 && hostPlatform.libc == "glibc" 70 && builtins.storeDir == "/nix/store"; 71 72 # Prevents attempts of running 'help2man' on cross-built binaries. 73 PERL = if hostPlatform == buildPlatform then null else "missing"; 74 75 # Saw random failures like ‘help2man: can't get '--help' info from 76 # man/sha512sum.td/sha512sum’. 77 enableParallelBuilding = false; 78 79 NIX_LDFLAGS = optionalString selinuxSupport "-lsepol"; 80 FORCE_UNSAFE_CONFIGURE = optionalString hostPlatform.isSunOS "1"; 81 82 makeFlags = optionalString hostPlatform.isDarwin "CFLAGS=-D_FORTIFY_SOURCE=0"; 83 84 # Works around a bug with 8.26: 85 # Makefile:3440: *** Recursive variable 'INSTALL' references itself (eventually). Stop. 86 preInstall = optionalString (hostPlatform != buildPlatform) '' 87 sed -i Makefile -e 's|^INSTALL =.*|INSTALL = ${buildPackages.coreutils}/bin/install -c|' 88 ''; 89 90 postInstall = optionalString (hostPlatform != buildPlatform) '' 91 rm $out/share/man/man1/* 92 cp ${buildPackages.coreutils}/share/man/man1/* $out/share/man/man1 93 ''; 94 95 meta = { 96 homepage = http://www.gnu.org/software/coreutils/; 97 description = "The basic file, shell and text manipulation utilities of the GNU operating system"; 98 99 longDescription = '' 100 The GNU Core Utilities are the basic file, shell and text 101 manipulation utilities of the GNU operating system. These are 102 the core utilities which are expected to exist on every 103 operating system. 104 ''; 105 106 license = licenses.gpl3Plus; 107 108 platforms = platforms.all; 109 110 maintainers = [ maintainers.eelco ]; 111 }; 112 113}