Skip to content
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

Idea: Use Zig as build system #17

Open
gregorni opened this issue Jun 3, 2024 · 2 comments
Open

Idea: Use Zig as build system #17

gregorni opened this issue Jun 3, 2024 · 2 comments

Comments

@gregorni
Copy link

gregorni commented Jun 3, 2024

Ziglang is a systems programming language that's still in development. It focuses on having good interoperability with C. One of the outstanding features of its compiler is the ability to compile C code: It can be used as a drop-in replacement for gcc or clang. It doesn't have any dependencies, and is very easy to install. It can also cross-compile C code to other operating systems and/or CPU architectures.

Is there an interest in using Zig as the suggested compiler for the project? While not yet considered stable, it is successfully used at and supported by Uber, Google and Cloudflare.

Using zig cc as a compiler could also open the door to potentially writing parts of the codebase in Zig, which is a bit more memory-safe than C.

Please don't take this as an attempt to enforce Zig upon everyone, I just think it could make for a nicer DX working on this project.

@gregorni
Copy link
Author

gregorni commented Jun 3, 2024

So I actually got this to work so far using the current build system. Essentially follow the build steps as explained in the README, but instead of make -j run make -j CC="zig cc". It actually builds and runs!

@Talinx
Copy link
Owner

Talinx commented Sep 4, 2024

jp2a can be build with every C compiler, including zig cc. Which compiler is used depends on the package maintainer of the distribution you use.

Switching to a modern language with memory safety features is a good idea. However switching jp2a all at once takes a lot of effort for little benefit.

I am open to contributions written in Zig.

For the time being I added a GitHub action job that builds jp2a with Zig and runs the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants