@@ -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;
@@ -302,7 +310,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
302310 # Dependencies that must be downloaded
303311 dependencies,
304312 )
305- extra_kwargs = extract_kwargs (kwargs, (:lazy_artifacts , :init_block ))
313+ extra_kwargs = extract_kwargs (kwargs, (:lazy_artifacts , :init_block , :augment_platform_block ))
306314
307315 if meta_json_stream != = nothing
308316 # If they've asked for the JSON metadata, by all means, give it to them!
@@ -583,7 +591,8 @@ function get_meta_json(
583591 dependencies:: Vector{<:AbstractDependency} ;
584592 julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC,
585593 lazy_artifacts:: Bool = false ,
586- init_block:: String = " " )
594+ init_block:: String = " " ,
595+ augmented_platform_block:: String = " " )
587596
588597 dict = Dict (
589598 " name" => src_name,
@@ -595,6 +604,7 @@ function get_meta_json(
595604 " julia_compat" => julia_compat,
596605 " lazy_artifacts" => lazy_artifacts,
597606 " init_block" => init_block,
607+ " augmented_platform_block" => augmented_platform_block,
598608 )
599609 # Do not write the list of platforms when building only for `AnyPlatform`
600610 if platforms != [AnyPlatform ()]
@@ -1021,6 +1031,7 @@ function rebuild_jll_package(obj::Dict;
10211031 lazy_artifacts = lazy_artifacts,
10221032 julia_compat = get (obj, " julia_compat" , DEFAULT_JULIA_VERSION_SPEC),
10231033 init_block = get (obj, " init_block" , " " ),
1034+ augment_platform_block = get (obj, " augment_platform_block" , " " ),
10241035 from_scratch = from_scratch,
10251036 )
10261037end
@@ -1125,7 +1136,8 @@ function build_jll_package(src_name::String,
11251136 verbose:: Bool = false ,
11261137 julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC,
11271138 lazy_artifacts:: Bool = false ,
1128- init_block = " " )
1139+ init_block = " " ,
1140+ augment_platform_block = " " ,)
11291141 # Make way, for prince artifacti
11301142 mkpath (joinpath (code_dir, " src" , " wrappers" ))
11311143
@@ -1259,6 +1271,17 @@ function build_jll_package(src_name::String,
12591271 if lazy_artifacts
12601272 println (io, " using LazyArtifacts" )
12611273 end
1274+
1275+ if ! isempty (augment_platform_block)
1276+ print (io, """
1277+ $(augment_platform_block)
1278+ """ )
1279+ else
1280+ print (io, """
1281+ augment_platform(platform) = platform
1282+ """ )
1283+ end
1284+
12621285 print (io, """
12631286 import JLLWrappers
12641287
@@ -1434,7 +1457,7 @@ function build_project_dict(name, version, dependencies::Array{Dependency}, juli
14341457 " deps" => Dict {String,Any} (),
14351458 # We require at least Julia 1.3+, for Pkg.Artifacts support, but we only claim
14361459 # Julia 1.0+ by default so that empty JLLs can be installed on older versions.
1437- " compat" => Dict {String,Any} (" JLLWrappers" => " 1.2 .0" ,
1460+ " compat" => Dict {String,Any} (" JLLWrappers" => " 1.4 .0" ,
14381461 " julia" => " $(julia_compat) " )
14391462 )
14401463 for dep in dependencies
0 commit comments