nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 113 lines 3.6 kB view raw
1{ 2 lib, 3 fetchurl, 4 kaem, 5 tinycc, 6 gnumake, 7 gnupatch, 8}: 9let 10 inherit (import ./common.nix { inherit lib; }) meta; 11 pname = "bootstrap-coreutils"; 12 version = "5.0"; 13 14 src = fetchurl { 15 url = "mirror://gnu/coreutils/coreutils-${version}.tar.gz"; 16 sha256 = "10wq6k66i8adr4k08p0xmg87ff4ypiazvwzlmi7myib27xgffz62"; 17 }; 18 19 # Thanks to the live-bootstrap project! 20 # See https://github.com/fosslinux/live-bootstrap/blob/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0/coreutils-5.0.kaem 21 liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0"; 22 23 makefile = fetchurl { 24 url = "${liveBootstrap}/mk/main.mk"; 25 sha256 = "0njg4xccxfqrslrmlb8ls7h6hlnfmdx42nvxwmca8flvczwrplfd"; 26 }; 27 28 patches = [ 29 # modechange.h uses functions defined in sys/stat.h, so we need to move it to 30 # after sys/stat.h include. 31 (fetchurl { 32 url = "${liveBootstrap}/patches/modechange.patch"; 33 sha256 = "04xa4a5w2syjs3xs6qhh8kdzqavxnrxpxwyhc3qqykpk699p3ms5"; 34 }) 35 # mbstate_t is a struct that is required. However, it is not defined by mes libc. 36 (fetchurl { 37 url = "${liveBootstrap}/patches/mbstate.patch"; 38 sha256 = "0rz3c0sflgxjv445xs87b83i7gmjpl2l78jzp6nm3khdbpcc53vy"; 39 }) 40 # strcoll() does not exist in mes libc, change it to strcmp. 41 (fetchurl { 42 url = "${liveBootstrap}/patches/ls-strcmp.patch"; 43 sha256 = "0lx8rz4sxq3bvncbbr6jf0kyn5bqwlfv9gxyafp0541dld6l55p6"; 44 }) 45 # getdate.c is pre-compiled from getdate.y 46 # At this point we don't have bison yet and in any case getdate.y does not 47 # compile when generated with modern bison. 48 (fetchurl { 49 url = "${liveBootstrap}/patches/touch-getdate.patch"; 50 sha256 = "1xd3z57lvkj7r8vs5n0hb9cxzlyp58pji7d335snajbxzwy144ma"; 51 }) 52 # touch: add -h to change symlink timestamps, where supported 53 (fetchurl { 54 url = "${liveBootstrap}/patches/touch-dereference.patch"; 55 sha256 = "0wky5r3k028xwyf6g6ycwqxzc7cscgmbymncjg948vv4qxsxlfda"; 56 }) 57 # strcoll() does not exist in mes libc, change it to strcmp. 58 (fetchurl { 59 url = "${liveBootstrap}/patches/expr-strcmp.patch"; 60 sha256 = "19f31lfsm1iwqzvp2fyv97lmqg4730prfygz9zip58651jf739a9"; 61 }) 62 # strcoll() does not exist in mes libc, change it to strcmp. 63 # hard_LC_COLLATE is used but not declared when HAVE_SETLOCALE is unset. 64 (fetchurl { 65 url = "${liveBootstrap}/patches/sort-locale.patch"; 66 sha256 = "0bdch18mpyyxyl6gyqfs0wb4pap9flr11izqdyxccx1hhz0a2i6c"; 67 }) 68 # don't assume fopen cannot return stdin or stdout. 69 (fetchurl { 70 url = "${liveBootstrap}/patches/uniq-fopen.patch"; 71 sha256 = "0qs6shyxl9j4h34v5j5sgpxrr4gjfljd2hxzw416ghwc3xzv63fp"; 72 }) 73 ]; 74in 75kaem.runCommand "${pname}-${version}" 76 { 77 inherit pname version meta; 78 79 nativeBuildInputs = [ 80 tinycc.compiler 81 gnumake 82 gnupatch 83 ]; 84 } 85 '' 86 # Unpack 87 ungz --file ${src} --output coreutils.tar 88 untar --file coreutils.tar 89 rm coreutils.tar 90 cd coreutils-${version} 91 92 # Patch 93 ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} 94 95 # Configure 96 catm config.h 97 cp lib/fnmatch_.h lib/fnmatch.h 98 cp lib/ftw_.h lib/ftw.h 99 cp lib/search_.h lib/search.h 100 rm src/dircolors.h 101 102 # Build 103 make -f ${makefile} \ 104 CC="tcc -B ${tinycc.libs}/lib" \ 105 PREFIX=''${out} 106 107 # Check 108 ./src/echo "Hello coreutils!" 109 110 # Install 111 ./src/mkdir -p ''${out}/bin 112 make -f ${makefile} install PREFIX=''${out} 113 ''