lol
at master 63 lines 1.7 kB view raw
1{ 2 lib, 3 kaem, 4 ln-boot, 5 mes, 6 mes-libc, 7}: 8let 9 pname = "mes-libc"; 10 inherit (mes.compiler) version; 11 12 sources = (import ./sources.nix).x86.linux.gcc; 13 inherit (sources) libtcc1_SOURCES libc_gnu_SOURCES; 14 15 # Concatenate all source files into a convenient bundle 16 # "gcc" variants of source files (eg. "lib/linux/x86-mes-gcc") can also be 17 # compiled by tinycc 18 # 19 # Passing this many arguments is too much for kaem so we need to split 20 # the operation in two 21 firstLibc = lib.take 100 libc_gnu_SOURCES; 22 lastLibc = lib.drop 100 libc_gnu_SOURCES; 23in 24kaem.runCommand "${pname}-${version}" 25 { 26 inherit pname version; 27 28 nativeBuildInputs = [ ln-boot ]; 29 30 passthru.CFLAGS = "-DHAVE_CONFIG_H=1 -I${mes-libc}/include -I${mes-libc}/include/linux/x86"; 31 32 meta = with lib; { 33 description = "Mes C Library"; 34 homepage = "https://www.gnu.org/software/mes"; 35 license = licenses.gpl3Plus; 36 teams = [ teams.minimal-bootstrap ]; 37 platforms = [ "i686-linux" ]; 38 }; 39 } 40 '' 41 cd ${mes.srcPrefix} 42 43 # mescc compiled libc.a 44 mkdir -p ''${out}/lib/x86-mes 45 46 # libc.c 47 catm ''${TMPDIR}/first.c ${lib.concatStringsSep " " firstLibc} 48 catm ''${out}/lib/libc.c ''${TMPDIR}/first.c ${lib.concatStringsSep " " lastLibc} 49 50 # crt{1,n,i}.c 51 cp lib/linux/x86-mes-gcc/crt1.c ''${out}/lib 52 cp lib/linux/x86-mes-gcc/crtn.c ''${out}/lib 53 cp lib/linux/x86-mes-gcc/crti.c ''${out}/lib 54 55 # libtcc1.c 56 catm ''${out}/lib/libtcc1.c ${lib.concatStringsSep " " libtcc1_SOURCES} 57 58 # getopt.c 59 cp lib/posix/getopt.c ''${out}/lib/libgetopt.c 60 61 # Install headers 62 ln -s ${mes.srcPrefix}/include ''${out}/include 63 ''