Skip to content

Commit bd35310

Browse files
committed
Add cross-platform support and regenerate bindings
1 parent 0495974 commit bd35310

31 files changed

+27220
-2171
lines changed

gen/configs/aarch64-linux-gnu.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/aarch64-linux-gnu.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/configs/aarch64-linux-musl.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/aarch64-linux-musl.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/armv7l-linux-gnueabihf.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/armv7l-linux-musleabihf.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/configs/i686-linux-gnu.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/i686-linux-gnu.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/configs/i686-linux-musl.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/i686-linux-musl.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/configs/i686-w64-mingw32.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/i686-w64-mingw32.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/powerpc64le-linux-gnu.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/x86_64-apple-darwin14.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/configs/x86_64-linux-gnu.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/x86_64-linux-gnu.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/configs/x86_64-linux-musl.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/x86_64-linux-musl.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/x86_64-unknown-freebsd11.1.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/configs/x86_64-w64-mingw32.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[general]
2+
library_name = "libcurl"
3+
output_file_path = "../src/wrappers/x86_64-w64-mingw32.jl"
4+
5+
use_julia_native_enum_type = true
6+
use_deterministic_symbol = true
7+
auto_mutability = true
8+
9+
printer_blacklist = [
10+
"CURL_SUFFIX_CURL_OFF_T",
11+
"CURL_SUFFIX_CURL_OFF_TU",
12+
"CURL_ZERO_TERMINATED",
13+
]
14+
15+
[codegen.macro]
16+
macro_mode = "basic"

gen/epilogue.jl

-16
This file was deleted.

gen/generate.jl

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
using Pkg
2+
using Pkg.Artifacts
13
using Clang.Generators
4+
using Clang.Generators.JLLEnvs
25
using LibCURL_jll
3-
using Pkg
46

57
cd(@__DIR__)
68

@@ -14,16 +16,25 @@ curl_h = joinpath(include_dir, "curl", "curl.h")
1416
# mprintf_h = joinpath(include_dir, "curl", "mprintf.h")
1517
# stdcheaders_h = joinpath(include_dir, "curl", "stdcheaders.h")
1618

17-
options = load_options(joinpath(@__DIR__, "generator.toml"))
19+
target = "aarch64-linux-gnu"
20+
for target in JLLEnvs.JLL_ENV_TRIPLES
21+
target == "aarch64-apple-darwin20" && continue
22+
23+
@info "processing $target"
24+
25+
options = load_options(joinpath(@__DIR__, "configs", "$target.toml"))
26+
27+
args = get_default_args(target)
28+
push!(args, "-I$include_dir")
29+
30+
# header_files = detect_headers(include_dir, args)
31+
header_files = [curl_h]
32+
33+
ctx = create_context(header_files, args, options)
34+
35+
build!(ctx)
36+
end
1837

19-
args = ["-I$include_dir"]
2038

21-
ctx = create_context([curl_h], args, options)
2239

23-
# real definitions are in prologue.jl
24-
@add_def socklen_t
25-
@add_def time_t
26-
@add_def fd_set
27-
@add_def sa_family_t
2840

29-
build!(ctx)

gen/generator.toml

-24
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
[general]
22
library_name = "libcurl"
33
output_file_path = "../src/LibCURL.jl"
4-
module_name = "LibCURL"
5-
export_symbol_prefixes = [
6-
"curl_",
7-
"CURLOPT_",
8-
"CURLFORM_",
9-
"CURLE_",
10-
"CURLINFO_",
11-
"CURLSSH_",
12-
"CURLAUTH_",
13-
"CURLM",
14-
"CURL"
15-
]
16-
prologue_file_path = "./prologue.jl"
17-
epilogue_file_path = "./epilogue.jl"
184

195
use_julia_native_enum_type = true
206
use_deterministic_symbol = true
@@ -25,16 +11,6 @@ printer_blacklist = [
2511
"CURL_ZERO_TERMINATED",
2612
]
2713

28-
definition_whitelist = [
29-
# "__darwin_time_t",
30-
# "time_t",
31-
# "__darwin_socklen_t",
32-
# "socklen_t",
33-
# "fd_set",
34-
# "sockaddr",
35-
# "sa_family_t",
36-
]
37-
3814
auto_mutability = true
3915

4016
[codegen.macro]

gen/prologue.jl

-33
This file was deleted.

0 commit comments

Comments
 (0)