-
Notifications
You must be signed in to change notification settings - Fork 406
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
Provide build.zig for building libgc? #557
Comments
At this moment, I don't see the benefits over cmake, and it looks to be not among popular build systems. |
I understand, and probably even agree :) Maintaining yet another build thingy obviously takes time and effort! |
For anyone surfing by and having an interest in this, I maintain a fork of bdwgc with a build.zig. It is primarily catering to the needs of the Acton language, so I haven't gone out of my way to support all features or all platforms, rather keeping it simple. However, if anyone is lacking anything, I'm happy to add and so perhaps over time it can mature to be rather complete. |
On behalf of @plajjan (copied from #588): |
Haha, yes, I meant to include the link. Thanks Ivan :) |
Okay, I think it would be OK to add some minimalist version of the build.zig. Could you please modify the build.zig and zig-build.yml like this:
|
Okay, sure! I can modify the current build.zig I have. I would like to keep the current functionality though, like building static lib and musl support, since that's what I use in Acton and I'd prefer not to diverge. Hope that's ok. Zig's build system have undergone massive changes. A lot of it landed in zig 0.11 but there were some smaller changes that are in 0.12. Lately, the rate of changes has dropped drastically as it approaches a more stable design, so 0.12 will probably be a good release once it's out. Until then we have the choice of either going with a nightly release or go back to 0.11. I would hate going with 0.11 since it means a different and older API for the build system. I think we should try and target the "final version" which a 0.12 nightly is closer to (maybe we're at the final version now!). Zig is young and immature, with a large portion of users being on some nightly version, so I think we need to also take this into when making our choice! We could of course also wait until zig 0.12 is out... |
|
Please do not align with Makefile.direct. |
@ivmai ok, will align on Cmake! I've actually already seen discrepancies between Makefile.direct and Cmake and have chosen to align on cmake :) Can you shed some light on the following code: ...
# Thread support detection.
if (CMAKE_USE_PTHREADS_INIT)
set(SRC ${SRC} gc_dlopen.c pthread_start.c pthread_support.c)
if (CYGWIN OR WIN32)
set(SRC ${SRC} win32_threads.c)
else()
if (APPLE)
set(SRC ${SRC} darwin_stop_world.c)
else()
set(SRC ${SRC} pthread_stop_world.c)
endif()
endif()
... I wonder about this line, shouldn't it be conditioned on being on a posix system / not on windows?
|
No, e.g. MSVC + libpthreads-w32 needs at least 2 of these files. |
Also, update .gitignore if needed (so that zig output and intermediate artifacts not seen by git status). |
The PR is #598 |
Some resources about zig (tip for me): |
Solved in PR #598 |
@plajjan I'd like to thank you for your contribution! Zig build looks cool:) |
@ivmai you're welcome, glad to see stuff merged.. and yes, I think it is quite cool, it's quite enjoyable to work with :) |
I've been using zig in some projects and I think it's really nice. One of the things it offers is a build system, replacing Make, CMake and similar. In fact, one of Zigs goals is to offer a better build system not just for Zig projects but for C projects and they aspire to do a better job than all the other systems out there. I think they do or at the very least that they are on a trajectory to.
https://ziglang.org/learn/overview/#zig-build-system
I've recently started switching over the Acton project to use Zigs build system in various places (building Acton itself but also later, since Acton is a language that generates C, it uses zigs build system to produce the final .o, .a and executables). As part of this, I've looked at using zig to build libgc. One of the things it unlocks is easily being able to cross-compile:
My hacked up build.zig is catering towards the needs of Acton. I wonder, would there be an interest in having and maintaining a build.zig in the bdwgc repo itself? I could probably make an initial proposal at least :)
The text was updated successfully, but these errors were encountered: