-
Notifications
You must be signed in to change notification settings - Fork 24
fix illegal instructions on Windows #43
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
Changes from all commits
57d6042
4841794
4e98a87
6ddbcc6
f038421
d1f6843
58f3e6f
90ec2a0
077ec3a
b14947c
aaf0a45
3e4f91b
ff6a8c9
3a5c64f
7328a1f
630c71a
274036d
039f624
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,10 +14,13 @@ run: | |
| zig build run-multi -freference-trace $(ARGS) | ||
| zig build run-header -freference-trace $(ARGS) | ||
|
|
||
| fix: | ||
| zig fmt . | ||
|
|
||
| lint: | ||
| zig fmt --check . | ||
|
|
||
| test: lint | ||
| test: | ||
|
Comment on lines
20
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| zig build test $(ARGS) | ||
|
|
||
| docs: | ||
|
|
@@ -30,4 +33,4 @@ clean: | |
| serve: | ||
| cd server && go run main.go | ||
|
|
||
| .PHONY: run lint test docs clean serve | ||
| .PHONY: run fix lint test docs clean serve | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ Zig bindings for [[https://curl.haxx.se/libcurl/][libcurl]], a free and easy-to- | |
| The vendored libraries consist of: | ||
| | Library | Version | | ||
| |---------+---------| | ||
| | libcurl | [[https://github.com/curl/curl/tree/curl-8_8_0][8.8.0]] | | ||
| | libcurl | [[https://github.com/curl/curl/tree/curl-8_18_0][8.18.0]] | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The curl version |
||
| | zlib | [[https://github.com/madler/zlib/tree/v1.3.1][1.3.1]] | | ||
| | mbedtls | [[https://github.com/Mbed-TLS/mbedtls/tree/v3.6.0][3.6.0]] | | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,10 +11,10 @@ | |
| "LICENSE", | ||
| }, | ||
| .dependencies = .{ | ||
| // https://github.com/curl/curl/releases/tag/curl-8_18_0 | ||
| .curl = .{ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update here directly |
||
| // https://github.com/curl/curl/releases/tag/curl-8_8_0 | ||
| .url = "https://github.com/curl/curl/releases/download/curl-8_8_0/curl-8.8.0.tar.gz", | ||
| .hash = "N-V-__8AAHipPQF9UuLPiaV1CtJzZIxvTN61tMGdFx8LGjIV", | ||
| .url = "https://github.com/curl/curl/releases/download/curl-8_18_0/curl-8.18.0.tar.gz", | ||
| .hash = "N-V-__8AALp9QAGn6CCHZ6fK_FfMyGtG824LSHYHHasM3w-y", | ||
|
MrScriptX marked this conversation as resolved.
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The specified curl version For example, for version 8.9.0, the URL would be: You will need to update the hash accordingly. |
||
| .lazy = true, | ||
| }, | ||
| // https://github.com/madler/zlib/releases/tag/v1.3.1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,16 +200,56 @@ pub fn create(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.bui | |
| lib.root_module.addCMacro("USE_THREADS_POSIX", "1"); | ||
| lib.root_module.addCMacro("USE_UNIX_SOCKETS", "1"); | ||
| lib.root_module.addCMacro("_FILE_OFFSET_BITS", "64"); | ||
|
|
||
| const system_name = getCurlOS(target) orelse blk: { | ||
| const arch = @tagName(target.result.cpu.arch); | ||
| const os = @tagName(target.result.os.tag); | ||
| break :blk std.fmt.allocPrint(b.allocator, "{s}-pc-{s}", .{ arch, os }) catch unreachable; | ||
| }; | ||
| const curl_os = std.fmt.allocPrint(b.allocator, "\"{s}\"", .{system_name}) catch unreachable; | ||
| lib.root_module.addCMacro("CURL_OS", curl_os); | ||
|
|
||
| return lib; | ||
| } | ||
|
|
||
| // define CURL_OS based on target platform | ||
| // current unsupported platform : Itanium, RiscOS, OS/400 | ||
| fn getCurlOS(target: std.Build.ResolvedTarget) ?[]const u8 { | ||
| switch (target.result.os.tag) { | ||
|
MrScriptX marked this conversation as resolved.
|
||
| .windows => { | ||
| switch (target.result.cpu.arch) { | ||
| .x86 => return "i386-pc-win32", | ||
| .x86_64 => return "x86_64-pc-win32", | ||
| .thumb => return "thumbv7a-pc-win32", | ||
| .aarch64 => return "aarch64-pc-win32", | ||
| else => return "unknown-pc-win32", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| }, | ||
|
jiacai2050 marked this conversation as resolved.
|
||
| .linux => { | ||
| switch (target.result.cpu.arch) { | ||
| .x86_64 => return "x86_64-pc-linux-gnu", | ||
| .aarch64 => return "aarch64-pc-linux-gnu", | ||
| else => return "Linux", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| }, | ||
| .macos => return "mac", | ||
| .freebsd => return "freebsd", | ||
| else => { | ||
| return null; | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| const srcs = &.{ | ||
| "lib/cw-pause.c", | ||
| "lib/curlx/winapi.c", | ||
| "lib/curlx/strerr.c", | ||
| "lib/cookie.c", | ||
| "lib/http_chunks.c", | ||
| "lib/escape.c", | ||
| "lib/version_win32.c", | ||
| "lib/curlx/version_win32.c", | ||
| "lib/url.c", | ||
| "lib/base64.c", | ||
| "lib/curlx/base64.c", | ||
| "lib/mqtt.c", | ||
| "lib/setopt.c", | ||
| "lib/telnet.c", | ||
|
|
@@ -229,57 +269,63 @@ const srcs = &.{ | |
| "lib/bufref.c", | ||
| "lib/slist.c", | ||
| "lib/curl_trc.c", | ||
| "lib/ratelimit.c", | ||
| "lib/strequal.c", | ||
| "lib/vtls/rustls.c", | ||
| "lib/vtls/mbedtls.c", | ||
| "lib/vtls/wolfssl.c", | ||
| "lib/vtls/schannel.c", | ||
| "lib/vtls/gtls.c", | ||
| "lib/vtls/sectransp.c", | ||
| "lib/vtls/vtls.c", | ||
| "lib/vtls/mbedtls_threadlock.c", | ||
| "lib/vtls/schannel_verify.c", | ||
| "lib/vtls/hostcheck.c", | ||
| "lib/vtls/bearssl.c", | ||
| "lib/vtls/openssl.c", | ||
| "lib/vtls/x509asn1.c", | ||
| "lib/vtls/keylog.c", | ||
| "lib/vtls/vtls_scache.c", | ||
| "lib/cshutdn.c", | ||
| "lib/multi_ev.c", | ||
| "lib/curlx/wait.c", | ||
| "lib/uint-spbset.c", | ||
| "lib/uint-bset.c", | ||
| "lib/file.c", | ||
| "lib/socks_gssapi.c", | ||
| "lib/select.c", | ||
| "lib/socketpair.c", | ||
| "lib/curl_memrchr.c", | ||
| "lib/cfilters.c", | ||
| "lib/strtok.c", | ||
| "lib/cf-ip-happy.c", | ||
| "lib/multi_ntfy.c", | ||
| "lib/uint-table.c", | ||
| "lib/curlx/strparse.c", | ||
| "lib/version.c", | ||
| "lib/fopen.c", | ||
| "lib/curlx/fopen.c", | ||
| "lib/curl_fopen.c", | ||
| "lib/http_aws_sigv4.c", | ||
| "lib/mprintf.c", | ||
| "lib/curl_path.c", | ||
| "lib/parsedate.c", | ||
| "lib/rename.c", | ||
| "lib/ftplistparser.c", | ||
| "lib/content_encoding.c", | ||
| "lib/mime.c", | ||
| "lib/rand.c", | ||
| "lib/curl_des.c", | ||
| "lib/curl_ntlm_core.c", | ||
| "lib/pop3.c", | ||
| "lib/curl_sspi.c", | ||
| "lib/smb.c", | ||
| "lib/conncache.c", | ||
| "lib/inet_pton.c", | ||
| "lib/curlx/inet_pton.c", | ||
| "lib/if2ip.c", | ||
| "lib/openldap.c", | ||
| "lib/http_digest.c", | ||
| "lib/cf-h1-proxy.c", | ||
| "lib/asyn-thread.c", | ||
| "lib/asyn-ares.c", | ||
| "lib/asyn-thrdd.c", | ||
|
MrScriptX marked this conversation as resolved.
|
||
| "lib/strerror.c", | ||
| "lib/ftp.c", | ||
| "lib/strdup.c", | ||
| "lib/curlx/strcopy.c", | ||
| "lib/memdebug.c", | ||
| "lib/speedcheck.c", | ||
| "lib/vquic/curl_ngtcp2.c", | ||
| "lib/vquic/curl_msh3.c", | ||
| "lib/vquic/vquic.c", | ||
| "lib/vquic/curl_quiche.c", | ||
| "lib/getinfo.c", | ||
|
|
@@ -303,41 +349,37 @@ const srcs = &.{ | |
| "lib/hostip4.c", | ||
| "lib/curl_rtmp.c", | ||
| "lib/amigaos.c", | ||
| "lib/share.c", | ||
| "lib/warnless.c", | ||
| "lib/hostsyn.c", | ||
| "lib/curl_share.c", | ||
| "lib/curlx/warnless.c", | ||
| "lib/md5.c", | ||
| "lib/strtoofft.c", | ||
| "lib/altsvc.c", | ||
| "lib/formdata.c", | ||
| "lib/dynbuf.c", | ||
| "lib/curlx/dynbuf.c", | ||
| "lib/curl_addrinfo.c", | ||
| "lib/hostasyn.c", | ||
| "lib/doh.c", | ||
| "lib/request.c", | ||
| "lib/cw-out.c", | ||
| "lib/curl_sha512_256.c", | ||
| "lib/vtls/cipher_suite.c", | ||
| "lib/easygetopt.c", | ||
| "lib/ldap.c", | ||
| "lib/nonblock.c", | ||
| "lib/curlx/nonblock.c", | ||
| "lib/idn.c", | ||
| "lib/pingpong.c", | ||
| "lib/imap.c", | ||
| "lib/vssh/libssh.c", | ||
| "lib/vssh/wolfssh.c", | ||
| "lib/vssh/libssh2.c", | ||
| "lib/vssh/vssh.c", | ||
| "lib/splay.c", | ||
| "lib/krb5.c", | ||
| "lib/progress.c", | ||
| "lib/cf-haproxy.c", | ||
| "lib/easyoptions.c", | ||
| "lib/curl_range.c", | ||
| "lib/curl_endian.c", | ||
| "lib/http_proxy.c", | ||
| "lib/inet_ntop.c", | ||
| "lib/timeval.c", | ||
| "lib/asyn-ares.c", | ||
| "lib/curlx/inet_ntop.c", | ||
| "lib/curlx/timeval.c", | ||
| "lib/asyn-base.c", | ||
| "lib/rtsp.c", | ||
| "lib/sha256.c", | ||
| "lib/curl_threads.c", | ||
|
|
@@ -355,19 +397,18 @@ const srcs = &.{ | |
| "lib/psl.c", | ||
| "lib/ws.c", | ||
| "lib/hostip6.c", | ||
| "lib/curl_multibyte.c", | ||
| "lib/curlx/multibyte.c", | ||
| "lib/netrc.c", | ||
| "lib/llist.c", | ||
| "lib/urlapi.c", | ||
| "lib/strcase.c", | ||
| "lib/sendf.c", | ||
| "lib/timediff.c", | ||
| "lib/curlx/timediff.c", | ||
| "lib/http.c", | ||
| "lib/cf-h2-proxy.c", | ||
| "lib/socks.c", | ||
| "lib/http_negotiate.c", | ||
| "lib/transfer.c", | ||
| "lib/c-hyper.c", | ||
| "lib/hmac.c", | ||
| "lib/fileinfo.c", | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,11 +77,11 @@ pub const NonCopyingData = struct { | |
| return to_read; | ||
| } | ||
|
|
||
| pub fn seek(user_data: ?*anyopaque, offset: c_long, origin: c_int) callconv(.c) c_int { | ||
| var source: *DataWithOffset = @ptrCast(@alignCast(user_data orelse return c.CURL_READFUNC_ABORT)); | ||
| pub fn seek(user_data: ?*anyopaque, offset: c.curl_off_t, origin: c_int) callconv(.c) c_int { | ||
| var source: *DataWithOffset = @ptrCast(@alignCast(user_data orelse return c.CURL_SEEKFUNC_FAIL)); | ||
|
Comment on lines
+80
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While changing On line 84: The cast of To prevent this, c.SEEK_CUR => offset + @as(c.curl_off_t, @intCast(source.offset)),Since line 84 is not in the diff, I cannot provide a direct suggestion, but I strongly recommend applying this fix to prevent potential issues with large data slices. |
||
| const new_pos = switch (origin) { | ||
| c.SEEK_SET => offset, | ||
| c.SEEK_CUR => offset + @as(c_long, @intCast(source.offset)), | ||
| c.SEEK_CUR => offset + @as(c.curl_off_t, @intCast(source.offset)), | ||
| else => return c.CURL_SEEKFUNC_FAIL, | ||
| }; | ||
| if (new_pos < 0) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.