@@ -13,6 +13,7 @@ julia_cmd = `$(Base.julia_cmd()) --startup-file=no --history-file=no`
13
13
cpu_target = get (ENV , " JULIA_CPU_TARGET" , nothing )
14
14
julia_cmd_target = ` $(Base. julia_cmd (;cpu_target)) --startup-file=no --history-file=no`
15
15
output_type = nothing # exe, sharedlib, sysimage
16
+ abi_export_file = nothing
16
17
outname = nothing
17
18
file = nothing
18
19
add_ccallables = false
@@ -25,6 +26,7 @@ if help !== nothing
25
26
"""
26
27
Usage: julia juliac.jl [--output-exe | --output-lib | --output-sysimage] <name> [options] <file.jl>
27
28
--experimental --trim=<no,safe,unsafe,unsafe-warn> Only output code statically determined to be reachable
29
+ --export-abi <file> Emit type / function information for the ABI (in JSON format)
28
30
--compile-ccallable Include all methods marked `@ccallable` in output
29
31
--relative-rpath Configure the library / executable to lookup all required libraries in an adjacent "julia/" folder
30
32
--verbose Request verbose output
@@ -96,6 +98,10 @@ let i = 1
96
98
i == length (ARGS ) && error (" Output specifier requires an argument" )
97
99
global outname = ARGS [i+ 1 ]
98
100
i += 1
101
+ elseif arg == " --export-abi"
102
+ i == length (ARGS ) && error (" Output specifier requires an argument" )
103
+ global abi_export_file = ARGS [i+ 1 ]
104
+ i += 1
99
105
elseif arg == " --compile-ccallable"
100
106
global add_ccallables = true
101
107
elseif arg == " --verbose"
@@ -168,7 +174,11 @@ function compile_products(enable_trim::Bool)
168
174
end
169
175
170
176
# Compile the Julia code
171
- cmd = addenv (` $julia_cmd_target --project=$(Base. active_project ()) --output-o $img_path --output-incremental=no $strip_args $julia_args $(joinpath (@__DIR__ ," juliac-buildscript.jl" )) $absfile $output_type $add_ccallables ` , " OPENBLAS_NUM_THREADS" => 1 , " JULIA_NUM_THREADS" => 1 )
177
+ args = String[absfile, output_type, string (add_ccallables)]
178
+ if abi_export_file != = nothing
179
+ push! (args, abi_export_file)
180
+ end
181
+ cmd = addenv (` $julia_cmd_target --project=$(Base. active_project ()) --output-o $img_path --output-incremental=no $strip_args $julia_args $(joinpath (@__DIR__ ," juliac-buildscript.jl" )) $(args) ` , " OPENBLAS_NUM_THREADS" => 1 , " JULIA_NUM_THREADS" => 1 )
172
182
verbose && println (" Running: $cmd " )
173
183
if ! success (pipeline (cmd; stdout , stderr ))
174
184
println (stderr , " \n Failed to compile $file " )
0 commit comments