query
On this page

writeCBin

pkgs.writeCBin

Docs pulled from | This Revision | about 1 hour ago


TODO: add to writers? pkgs/build-support/writers


Noogle detected

Implementation

The following is the current implementation of this function.

writeCBin = pname: code:
    runCommandCC pname
      {
        inherit pname code;
        executable = true;
        passAsFile = [ "code" ];
        # Pointless to do this on a remote machine.
        preferLocalBuild = true;
        allowSubstitutes = false;
        meta = {
          mainProgram = pname;
        };
      }
      ''
        n=$out/bin/${pname}
        mkdir -p "$(dirname "$n")"
        mv "$codePath" code.c
        $CC -x c code.c -o "$n"
      '';