Port over vezel/libffi zig package - #1
Merged
Conversation
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
Member
Author
Collaborator
|
Hi @Techatrix, thanks for the patch. One thing, I will merge this and point a on top. It is ok for you? I was long wanting to separate the master and |
Collaborator
|
Also thanks for the patch, this repo was in need of a little housekeeping |
Member
Author
|
You can also keep a single branch and check whether diff --git a/build.zig b/build.zig
index e393ccd..b101896 100644
--- a/build.zig
+++ b/build.zig
@@ -209,8 +209,11 @@ pub fn build(b: *std.Build) !void {
inline for (.{ "include", "src", b.pathJoin(&.{ "src", arch_name }) }) |inc|
mod.addIncludePath(upstream.path(inc));
- const double_size = t.cTypeByteSize(.double);
- const long_double_size = t.cTypeByteSize(.longdouble);
+ // the `is_c_byte_size_optional` check can be removed when targetting 0.17.0+
+ comptime std.debug.assert((std.SemanticVersion.parse(manifest.minimum_zig_version) catch unreachable).minor < 17);
+ const is_c_byte_size_optional = @typeInfo(@typeInfo(@TypeOf(std.Target.cTypeBitSize)).@"fn".return_type.?) == .optional;
+ const double_size = if (is_c_byte_size_optional) t.cTypeByteSize(.double).? else t.cTypeByteSize(.double);
+ const long_double_size = if (is_c_byte_size_optional) t.cTypeByteSize(.longdouble).? else t.cTypeByteSize(.longdouble);
const long_double_variant = switch (t.os.tag) {
.freebsd, .netbsd, .openbsd => t.cpu.arch == .powerpc, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ports over https://codeberg.org/vezel/libffi which is also packages libffi for Zig. It has been maintained by alexrp, a ZSF core team member which as has extensive knowledge in compilation target support. Unfortunately, this fork is no longer maintained so I'm hoping to revive it in the allyourcodebase organization.
I have tested this port with https://github.com/allyourcodebase/tracy which depends on https://github.com/allyourcodebase/wayland and therefore libffi.