@@ -140,10 +140,18 @@ supported ones. A few additional keyword arguments are accept:
140140 package. This can for example be used to invoke an initialization API of a
141141 shared library.
142142
143+ * `augment_platform_block` may be set to a string containing Julia code; if
144+ present, this code will be inserted into the top-level of the
145+ generated JLL package. It must define a function `augment_platform` that takes
146+ as a single argument, the target platform and returns the target platform, with
147+ amended tags. This augmented platform will then be used by the JLL wrapper to select
148+ the artifact.
149+
143150!!! note
144151
145- The `init_block` keyword argument is experimental and may be removed
146- in a future version of this package. Please use it sparingly.
152+ The `init_block` and `augment_platform_block` keyword arguments are experimental
153+ and may be removed in a future version of this package. Please use it sparingly.
154+
147155"""
148156function build_tarballs (ARGS , src_name, src_version, sources, script,
149157 platforms, products, dependencies;
@@ -303,7 +311,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
303311 # Dependencies that must be downloaded
304312 dependencies,
305313 )
306- extra_kwargs = extract_kwargs (kwargs, (:lazy_artifacts , :init_block ))
314+ extra_kwargs = extract_kwargs (kwargs, (:lazy_artifacts , :init_block , :augment_platform_block ))
307315
308316 if meta_json_stream != = nothing
309317 # If they've asked for the JSON metadata, by all means, give it to them!
@@ -584,7 +592,8 @@ function get_meta_json(
584592 dependencies:: Vector{<:AbstractDependency} ;
585593 julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC,
586594 lazy_artifacts:: Bool = false ,
587- init_block:: String = " " )
595+ init_block:: String = " " ,
596+ augmented_platform_block:: String = " " )
588597
589598 dict = Dict (
590599 " name" => src_name,
@@ -596,6 +605,7 @@ function get_meta_json(
596605 " julia_compat" => julia_compat,
597606 " lazy_artifacts" => lazy_artifacts,
598607 " init_block" => init_block,
608+ " augmented_platform_block" => augmented_platform_block,
599609 )
600610 # Do not write the list of platforms when building only for `AnyPlatform`
601611 if platforms != [AnyPlatform ()]
@@ -1020,6 +1030,7 @@ function rebuild_jll_package(obj::Dict;
10201030 lazy_artifacts = lazy_artifacts,
10211031 julia_compat = get (obj, " julia_compat" , DEFAULT_JULIA_VERSION_SPEC),
10221032 init_block = get (obj, " init_block" , " " ),
1033+ augment_platform_block = get (obj, " augment_platform_block" , " " ),
10231034 from_scratch = from_scratch,
10241035 )
10251036end
@@ -1124,7 +1135,8 @@ function build_jll_package(src_name::String,
11241135 verbose:: Bool = false ,
11251136 julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC,
11261137 lazy_artifacts:: Bool = false ,
1127- init_block = " " )
1138+ init_block = " " ,
1139+ augment_platform_block = " " ,)
11281140 # Make way, for prince artifacti
11291141 mkpath (joinpath (code_dir, " src" , " wrappers" ))
11301142
@@ -1258,6 +1270,17 @@ function build_jll_package(src_name::String,
12581270 if lazy_artifacts
12591271 println (io, " using LazyArtifacts" )
12601272 end
1273+
1274+ if ! isempty (augment_platform_block)
1275+ print (io, """
1276+ $(augment_platform_block)
1277+ """ )
1278+ else
1279+ print (io, """
1280+ augment_platform(platform) = platform
1281+ """ )
1282+ end
1283+
12611284 print (io, """
12621285 import JLLWrappers
12631286
@@ -1430,7 +1453,7 @@ function build_project_dict(name, version, dependencies::Array{Dependency}, juli
14301453 " deps" => Dict {String,Any} (),
14311454 # We require at least Julia 1.3+, for Pkg.Artifacts support, but we only claim
14321455 # Julia 1.0+ by default so that empty JLLs can be installed on older versions.
1433- " compat" => Dict {String,Any} (" JLLWrappers" => " 1.2 .0" ,
1456+ " compat" => Dict {String,Any} (" JLLWrappers" => " 1.4 .0" ,
14341457 " julia" => " $(julia_compat) " )
14351458 )
14361459 for dep in dependencies
0 commit comments