10 pname = "bootstrap-coreutils";
14 url = "mirror://gnu/coreutils/coreutils-${version}.tar.gz";
15 sha256 = "10wq6k66i8adr4k08p0xmg87ff4ypiazvwzlmi7myib27xgffz62";
18 # Thanks to the live-bootstrap project!
19 # See https://github.com/fosslinux/live-bootstrap/blob/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0/coreutils-5.0.kaem
20 liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0";
23 url = "${liveBootstrap}/mk/main.mk";
24 sha256 = "0njg4xccxfqrslrmlb8ls7h6hlnfmdx42nvxwmca8flvczwrplfd";
28 # modechange.h uses functions defined in sys/stat.h, so we need to move it to
29 # after sys/stat.h include.
31 url = "${liveBootstrap}/patches/modechange.patch";
32 sha256 = "04xa4a5w2syjs3xs6qhh8kdzqavxnrxpxwyhc3qqykpk699p3ms5";
34 # mbstate_t is a struct that is required. However, it is not defined by mes libc.
36 url = "${liveBootstrap}/patches/mbstate.patch";
37 sha256 = "0rz3c0sflgxjv445xs87b83i7gmjpl2l78jzp6nm3khdbpcc53vy";
39 # strcoll() does not exist in mes libc, change it to strcmp.
41 url = "${liveBootstrap}/patches/ls-strcmp.patch";
42 sha256 = "0lx8rz4sxq3bvncbbr6jf0kyn5bqwlfv9gxyafp0541dld6l55p6";
44 # getdate.c is pre-compiled from getdate.y
45 # At this point we don't have bison yet and in any case getdate.y does not
46 # compile when generated with modern bison.
48 url = "${liveBootstrap}/patches/touch-getdate.patch";
49 sha256 = "1xd3z57lvkj7r8vs5n0hb9cxzlyp58pji7d335snajbxzwy144ma";
51 # touch: add -h to change symlink timestamps, where supported
53 url = "${liveBootstrap}/patches/touch-dereference.patch";
54 sha256 = "0wky5r3k028xwyf6g6ycwqxzc7cscgmbymncjg948vv4qxsxlfda";
56 # strcoll() does not exist in mes libc, change it to strcmp.
58 url = "${liveBootstrap}/patches/expr-strcmp.patch";
59 sha256 = "19f31lfsm1iwqzvp2fyv97lmqg4730prfygz9zip58651jf739a9";
61 # strcoll() does not exist in mes libc, change it to strcmp.
62 # hard_LC_COLLATE is used but not declared when HAVE_SETLOCALE is unset.
64 url = "${liveBootstrap}/patches/sort-locale.patch";
65 sha256 = "0bdch18mpyyxyl6gyqfs0wb4pap9flr11izqdyxccx1hhz0a2i6c";
67 # don't assume fopen cannot return stdin or stdout.
69 url = "${liveBootstrap}/patches/uniq-fopen.patch";
70 sha256 = "0qs6shyxl9j4h34v5j5sgpxrr4gjfljd2hxzw416ghwc3xzv63fp";
74 kaem.runCommand "${pname}-${version}"
76 inherit pname version;
85 description = "GNU Core Utilities";
86 homepage = "https://www.gnu.org/software/coreutils";
87 license = licenses.gpl3Plus;
88 maintainers = teams.minimal-bootstrap.members;
89 platforms = platforms.unix;
94 ungz --file ${src} --output coreutils.tar
95 untar --file coreutils.tar
97 cd coreutils-${version}
100 ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches}
104 cp lib/fnmatch_.h lib/fnmatch.h
105 cp lib/ftw_.h lib/ftw.h
106 cp lib/search_.h lib/search.h
110 make -f ${makefile} \
111 CC="tcc -B ${tinycc.libs}/lib" \
115 ./src/echo "Hello coreutils!"
118 ./src/mkdir -p ''${out}/bin
119 make -f ${makefile} install PREFIX=''${out}