···23let
4 version = "weekly.2023.19";
00005 # Required for bootstrap.
6- vc = fetchFromGitHub {
7- owner = "vlang";
8- repo = "vc";
9- rev = "f7c2b5f2a0738d0d236161c9de9f31dd0280ac86";
10- sha256 = "sha256-xU3TvyNgc0o4RCsHtoC6cZTNaue2yuAiolEOvP37TKA=";
000000000000011 };
12 # Required for vdoc.
13 markdown = fetchFromGitHub {
···38 ];
3940 env.VC = vc;
41- # libX11.dev and xorg.xorgproto are needed because of
42- # 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`.
43- # libXau, libxcb, libXdmcp need to be static if you use static gcc otherwise
44- # /nix/store/xnk2z26fqy86xahiz3q797dzqx96sidk-glibc-2.37-8/lib/libc.so.6: undefined reference to `_rtld_glob al_ro@GLIBC_PRIVATE'
45- 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";
00004647 preBuild = ''
48 export HOME=$(mktemp -d)
···51 # we don't use tcc at all since it fails on a missing libatomic
52 ln -s ${pkgsStatic.tinycc}/bin/tcc ./thirdparty/tcc/tcc.exe
53 cp -r ${pkgsStatic.boehmgc}/lib/* ./thirdparty/tcc/lib
0000054 '';
5556 # vcreate_test.v requires git, so we must remove it when building the tools.
···23let
4 version = "weekly.2023.19";
5+ ptraceSubstitution = ''
6+ #include <sys/types.h>
7+ #include <sys/ptrace.h>
8+ '';
9 # Required for bootstrap.
10+ vc = stdenv.mkDerivation {
11+ pname = "v.c";
12+ version = "unstable-2023-05-14";
13+ src = fetchFromGitHub {
14+ owner = "vlang";
15+ repo = "vc";
16+ rev = "f7c2b5f2a0738d0d236161c9de9f31dd0280ac86";
17+ sha256 = "sha256-xU3TvyNgc0o4RCsHtoC6cZTNaue2yuAiolEOvP37TKA=";
18+ };
19+20+ # patch the ptrace reference for darwin
21+ installPhase = lib.optionalString stdenv.isDarwin ''
22+ substituteInPlace v.c \
23+ --replace "#include <sys/ptrace.h>" "${ptraceSubstitution}"
24+ '' + ''
25+ mkdir -p $out
26+ cp v.c $out/
27+ '';
28 };
29 # Required for vdoc.
30 markdown = fetchFromGitHub {
···55 ];
5657 env.VC = vc;
58+ env.VFLAGS = if stdenv.isDarwin then
59+ # on darwin we need to add a manual link to libgc since it doesn't have a libgc.a
60+ "-cg -cc ${pkgsStatic.clang}/bin/clang -no-retry-compilation -ldflags -L${pkgsStatic.boehmgc}/lib -ldflags -lgc -ldflags -L${binaryen}/lib"
61+ else
62+ # libX11.dev and xorg.xorgproto are needed because of
63+ # 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`.
64+ # libXau, libxcb, libXdmcp need to be static if you use static gcc otherwise
65+ # /nix/store/xnk2z26fqy86xahiz3q797dzqx96sidk-glibc-2.37-8/lib/libc.so.6: undefined reference to `_rtld_glob al_ro@GLIBC_PRIVATE'
66+ "-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";
6768 preBuild = ''
69 export HOME=$(mktemp -d)
···72 # we don't use tcc at all since it fails on a missing libatomic
73 ln -s ${pkgsStatic.tinycc}/bin/tcc ./thirdparty/tcc/tcc.exe
74 cp -r ${pkgsStatic.boehmgc}/lib/* ./thirdparty/tcc/lib
75+ '' + lib.optionalString stdenv.isDarwin ''
76+ # this file isn't used by clang, but it's just to silence a warning
77+ # the compiler complains on an empty file, so this makes it "close" to real
78+ substituteInPlace vlib/builtin/builtin_d_gcboehm.c.v \
79+ --replace "libgc.a" "libgc.la"
80 '';
8182 # vcreate_test.v requires git, so we must remove it when building the tools.