tw4452852 / zbpf

Writing eBPF in Zig
https://tw4452852.github.io/zbpf/
GNU General Public License v3.0
108 stars 6 forks source link

Zig package #4

Closed kassane closed 1 year ago

kassane commented 1 year ago

The fork is the initial support base for zig developers, in addition to trying zig-pkg (MVP) v0.11.x-dev. Later it will be able to be linked into any zig project without depending on external tools (maybe porting to zig-build libelf-dev too)

Note: Theoretically it works similar to go mod or fetchContent (cmake).

cc: @anakryiko - If the original project can support the zig build-system, then just replace (kassane/libbpf -> libbpf/libbpf) the url + hash in the zon file of this binding. See: https://github.com/libbpf/libbpf/compare/master...kassane:libbpf:zig-pkg

More info about zig-pkg

anakryiko commented 1 year ago

@kassane sorry, can you tl;dr what's your ask w.r.t. libbpf and its support for zig's build system?

tw4452852 commented 1 year ago

Wow, that's amazing, I'm pleasure to use zig's builtin package manage if libbpf supports it.

kassane commented 1 year ago

@kassane sorry, can you tl;dr what's your ask w.r.t. libbpf and its support for zig's build system?

Yes! Would you accept to add to the zig-build project? (Avoiding libbpf parallel version). Unfortunately zig cc/zig c++ is quite complicated on conventional build-systems because of the space in the subcommand ' '. Besides, zig-build/zig-pkg is not restricted to ziglang projects.

anakryiko commented 1 year ago

Ah, sorry for misleading you. I assumed you'd like use to adjust libbpf's Makefile (or something about layout, etc) to make it easier to build libbpf with Zig-related infrastructure. Adding and maintaining parallel Zig build script for libbpf is not something I'd like to do, sorry. Hopefully it won't be too much trouble to maintain this on the side.

tw4452852 commented 1 year ago

Hi @kassane

I'm afraid we may hold this PR a while due to some fixup on vendored libbpf (https://github.com/tw4452852/zbpf/commit/bad505e019b61854a334a11e95275ba50f9fb688). Because it's Zig specific so I'm afraid it would not be accepted on upstream.

kassane commented 1 year ago

Ok.

The main purpose of this PR is to avoid static dependencies. But already aware of this possibility from the new zig version, you can find better use.

tw4452852 commented 8 months ago

Hi @kassane

As 0.1.0 is released, zbpf embraces Zig's package manager for the external dependencies. FYI.

kassane commented 8 months ago

As 0.1.0 is released, zbpf embraces Zig's package manager for the external dependencies. FYI.

@tw4452852, awesome. I will test it and give feedback.