You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/AutoBuild.jl
+56-36Lines changed: 56 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -987,6 +987,7 @@ function build_jll_package(src_name::String, build_version::VersionNumber, code_
987
987
mkpath(joinpath(code_dir, "src", "wrappers"))
988
988
989
989
platforms =keys(build_output_meta)
990
+
products_info = Dict{Any,Any}
990
991
for platform in platforms
991
992
if verbose
992
993
@info("Generating jll package for $(triplet(platform)) in $(code_dir)")
@@ -1223,44 +1224,63 @@ function build_jll_package(src_name::String, build_version::VersionNumber, code_
1223
1224
""")
1224
1225
end
1225
1226
1227
+
product_names(p::ExecutableProduct) = p.binnames
1228
+
product_names(p::FileProduct) = p.paths
1229
+
product_names(p::LibraryProduct) = p.libnames
1226
1230
# Add a README.md
1227
1231
open(joinpath(code_dir, "README.md"), "w") do io
1228
-
print(io, """
1229
-
# $(src_name)_jll.jl
1230
-
1231
-
This is an autogenerated package constructed using [`BinaryBuilder.jl`](https://github.com/JuliaPackaging/BinaryBuilder.jl).
1232
-
1233
-
## Usage
1234
-
1235
-
The code bindings within this package are autogenerated from the `Products` defined within the `build_tarballs.jl` file that generated this package. For example purposes, we will assume that the following products were defined:
1236
-
1237
-
```julia
1238
-
products = [
1239
-
FileProduct("src/data.txt", :data_txt),
1240
-
LibraryProduct("libdataproc", :libdataproc),
1241
-
ExecutableProduct("mungify", :mungify_exe)
1242
-
]
1243
-
```
1244
-
1245
-
With such products defined, this package will contain `data_txt`, `libdataproc` and `mungify_exe` symbols exported. For `FileProduct` variables, the exported value is a string pointing to the location of the file on-disk. For `LibraryProduct` variables, it is a string corresponding to the `SONAME` of the desired library (it will have already been `dlopen()`'ed, so typical `ccall()` usage applies), and for `ExecutableProduct` variables, the exported value is a function that can be called to set appropriate environment variables. Example:
1246
-
1247
-
```julia
1248
-
using $(src_name)_jll
1249
-
1250
-
# For file products, you can access its file location directly:
1251
-
data_lines = open(data_txt, "r") do io
1252
-
readlines(io)
1253
-
end
1254
-
1255
-
# For library products, you can use the exported variable name in `ccall()` invocations directly
# For executable products, you can use the exported variable name as a function that you can call
1259
-
mungify_exe() do mungify_exe_path
1260
-
run(`\$mungify_exe_path \$num_chars`)
1261
-
end
1262
-
```
1263
-
""")
1232
+
print(io,
1233
+
"""
1234
+
# $(src_name)_jll.jl
1235
+
1236
+
This is an autogenerated package constructed using [`BinaryBuilder.jl`](https://github.com/JuliaPackaging/BinaryBuilder.jl).
1237
+
1238
+
""",
1239
+
iszero(length(keys(products_info))) ?"":
1240
+
"""
1241
+
## Products
1242
+
1243
+
The code bindings within this package are autogenerated from the following `Products` defined within the `build_tarballs.jl` file that generated this package:
1244
+
1245
+
```julia
1246
+
products = [
1247
+
$(join(collect("$(typeof(p))($(product_names(p)), :$(variable_name(p)))"for (p, _) in products_info), ",\n"))
1248
+
]
1249
+
```
1250
+
1251
+
""",
1252
+
"""
1253
+
## Usage example
1254
+
1255
+
For example purposes, we will assume that the following products were defined in the imaginary package `Example_jll`:
1256
+
1257
+
```julia
1258
+
products = [
1259
+
FileProduct("src/data.txt", :data_txt),
1260
+
LibraryProduct("libdataproc", :libdataproc),
1261
+
ExecutableProduct("mungify", :mungify_exe)
1262
+
]
1263
+
```
1264
+
1265
+
With such products defined, `Example_jll` would contain `data_txt`, `libdataproc` and `mungify_exe` symbols exported. For `FileProduct` variables, the exported value is a string pointing to the location of the file on-disk. For `LibraryProduct` variables, it is a string corresponding to the `SONAME` of the desired library (it will have already been `dlopen()`'ed, so typical `ccall()` usage applies), and for `ExecutableProduct` variables, the exported value is a function that can be called to set appropriate environment variables. Example:
1266
+
1267
+
```julia
1268
+
using Example_jll
1269
+
1270
+
# For file products, you can access its file location directly:
1271
+
data_lines = open(data_txt, "r") do io
1272
+
readlines(io)
1273
+
end
1274
+
1275
+
# For library products, you can use the exported variable name in `ccall()` invocations directly
0 commit comments