-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add zig-build build style, river 0.1.0, rundird 0.2.0 #29288
Conversation
It would be nice if it could do cross :) |
blocked on #25004 ? hopefully, cross is not a blocker for initial packaging |
I don't think so. That PR is about cross compiling the compiler, not projects using zig... And the template here isn't trying to pass any targets or anything, so the fix might even be a simple one. |
oh woops, sorry This is what happens when you only look at the PR title. edit: maybe |
c4dca57
to
191fd5f
Compare
8544b34
to
09cc749
Compare
83dda10
to
fb852ac
Compare
2 of the patches have not yet been upstreamed, I'll be doing that shortly. As such, I'd like to hold off on merging this until they are upstreamed. |
706f9dc
to
9302c24
Compare
Do for all archs what I did for x86; and broken is checked during template parsing time, not during |
Thanks for the review @ericonr! I've gone ahead and done this "properly" by defining zig target and cpu variables in the This should be ready to merge from my point of view, assuming CI passes. |
if [ "$CROSS_BUILD" ]; then | ||
zig_target="${XBPS_CROSS_ZIG_TARGET}" | ||
zig_cpu="${XBPS_CROSS_ZIG_CPU}" | ||
else | ||
zig_target="${XBPS_ZIG_TARGET}" | ||
zig_cpu="${XBPS_ZIG_CPU}" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about an environment/build-style/
file that sets archs
for the supported archs? This way you don't have to detect if these are set before do_build
in order to trigger broken
(or maybe it's the best way, since it avoids duplicating the information?).
Overall looks really good, just want to be sure of the best way of signaling when zig is unsupported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that seems like it might be a good idea in general but I don't think we need that for zig. Zig is theoretically able to target all of xbps's targets and I've included exhaustive support for xbps's targets in this PR.
However, support for some of the less common architectures is of course not as good and attempting to actually compile code for them may fail due to issues in the compiler and/or std. This of course depends on the exact code being compiled as well though, especially when the issues are due to stdlib deficiencies which are often easy to add temporary downstream workarounds for as the language matures.
Just rebased onto master and fixed a typo in a comment that I just noticed. |
Zig 0.8.1 has been released with the the patches I landed to support sysroot-based cross compilation dynamically linking system libraries. Therefore we no longer need to patch zig to enable the zig-build build style and I've rebased this PR onto #32867. |
ab555a4
to
fbe6360
Compare
crt_dir=${XBPS_CROSS_BASE}/usr/lib | ||
msvc_lib_dir= | ||
kernel32_lib_dir= | ||
gcc_dir= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to query gcc_dir from GCC itself? Would it be worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the output of zig libc
, gcc_dir
is only needed when targeting haiku:
# The directory that contains `crtbeginS.o` and `crtendS.o`
# Only needed when targeting Haiku.
gcc_dir=
920fa2d
to
2602db1
Compare
@ericonr Thanks for the review! I've enabled sse2 on i686 and split the zig package fix into a separate commit, this should now be good to go afaik. |
Ok, tested both packages, seem to be working just fine. All that's missing is installing the example file and possibly a |
This commit backports one bug fix from the zig master branch which is critical for our use-case of building software for binary distribution.
We call this "zig-build" instead of just "zig" as this build-style relies on usage of the zig build system. In the future, other build systems such as meson may support zig code. Furthermore, the zig build system may be used to build C/C++ code as well, not just zig.
Excellent! Good call on including the example river init and rundird README.md, especially for rundird as I forgot that I never wrote a man page for that. Not that there's much that would go in a man page, the only important bit of end-user documentation is the PAM configuration. |
General
Have the results of the proposed changes been tested?
Closes #33060