···2233let
44 version = "weekly.2023.19";
55+ ptraceSubstitution = ''
66+ #include <sys/types.h>
77+ #include <sys/ptrace.h>
88+ '';
59 # Required for bootstrap.
66- vc = fetchFromGitHub {
77- owner = "vlang";
88- repo = "vc";
99- rev = "f7c2b5f2a0738d0d236161c9de9f31dd0280ac86";
1010- sha256 = "sha256-xU3TvyNgc0o4RCsHtoC6cZTNaue2yuAiolEOvP37TKA=";
1010+ vc = stdenv.mkDerivation {
1111+ pname = "v.c";
1212+ version = "unstable-2023-05-14";
1313+ src = fetchFromGitHub {
1414+ owner = "vlang";
1515+ repo = "vc";
1616+ rev = "f7c2b5f2a0738d0d236161c9de9f31dd0280ac86";
1717+ sha256 = "sha256-xU3TvyNgc0o4RCsHtoC6cZTNaue2yuAiolEOvP37TKA=";
1818+ };
1919+2020+ # patch the ptrace reference for darwin
2121+ installPhase = lib.optionalString stdenv.isDarwin ''
2222+ substituteInPlace v.c \
2323+ --replace "#include <sys/ptrace.h>" "${ptraceSubstitution}"
2424+ '' + ''
2525+ mkdir -p $out
2626+ cp v.c $out/
2727+ '';
1128 };
1229 # Required for vdoc.
1330 markdown = fetchFromGitHub {
···3855 ];
39564057 env.VC = vc;
4141- # libX11.dev and xorg.xorgproto are needed because of
4242- # builder error: Header file <X11/Xlib.h>, needed for module `clipboard.x11` was not found. Please install a package with the X11 development headers, for example: `apt-get install libx11-dev`.
4343- # libXau, libxcb, libXdmcp need to be static if you use static gcc otherwise
4444- # /nix/store/xnk2z26fqy86xahiz3q797dzqx96sidk-glibc-2.37-8/lib/libc.so.6: undefined reference to `_rtld_glob al_ro@GLIBC_PRIVATE'
4545- env.VFLAGS = "-cc ${pkgsStatic.gcc}/bin/gcc -no-retry-compilation -cflags -I${xorg.libX11.dev}/include -cflags -I${xorg.xorgproto}/include -ldflags -L${binaryen}/lib -ldflags -L${pkgsStatic.xorg.libX11}/lib -ldflags -L${pkgsStatic.xorg.libxcb}/lib -ldflags -lxcb -ldflags -L${pkgsStatic.xorg.libXau}/lib -ldflags -lXau -ldflags -L${pkgsStatic.xorg.libXdmcp}/lib -ldflags -lXdmcp";
5858+ env.VFLAGS = if stdenv.isDarwin then
5959+ # on darwin we need to add a manual link to libgc since it doesn't have a libgc.a
6060+ "-cg -cc ${pkgsStatic.clang}/bin/clang -no-retry-compilation -ldflags -L${pkgsStatic.boehmgc}/lib -ldflags -lgc -ldflags -L${binaryen}/lib"
6161+ else
6262+ # libX11.dev and xorg.xorgproto are needed because of
6363+ # builder error: Header file <X11/Xlib.h>, needed for module `clipboard.x11` was not found. Please install a package with the X11 development headers, for example: `apt-get install libx11-dev`.
6464+ # libXau, libxcb, libXdmcp need to be static if you use static gcc otherwise
6565+ # /nix/store/xnk2z26fqy86xahiz3q797dzqx96sidk-glibc-2.37-8/lib/libc.so.6: undefined reference to `_rtld_glob al_ro@GLIBC_PRIVATE'
6666+ "-cc ${pkgsStatic.gcc}/bin/gcc -no-retry-compilation -cflags -I${xorg.libX11.dev}/include -cflags -I${xorg.xorgproto}/include -ldflags -L${binaryen}/lib -ldflags -L${pkgsStatic.xorg.libX11}/lib -ldflags -L${pkgsStatic.xorg.libxcb}/lib -ldflags -lxcb -ldflags -L${pkgsStatic.xorg.libXau}/lib -ldflags -lXau -ldflags -L${pkgsStatic.xorg.libXdmcp}/lib -ldflags -lXdmcp";
46674768 preBuild = ''
4869 export HOME=$(mktemp -d)
···5172 # we don't use tcc at all since it fails on a missing libatomic
5273 ln -s ${pkgsStatic.tinycc}/bin/tcc ./thirdparty/tcc/tcc.exe
5374 cp -r ${pkgsStatic.boehmgc}/lib/* ./thirdparty/tcc/lib
7575+ '' + lib.optionalString stdenv.isDarwin ''
7676+ # this file isn't used by clang, but it's just to silence a warning
7777+ # the compiler complains on an empty file, so this makes it "close" to real
7878+ substituteInPlace vlib/builtin/builtin_d_gcboehm.c.v \
7979+ --replace "libgc.a" "libgc.la"
5480 '';
55815682 # vcreate_test.v requires git, so we must remove it when building the tools.