Skip to content

Commit 9a79943

Browse files
committed
use .pkg dir
1 parent 8cc78cc commit 9a79943

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

src/AutoBuild.jl

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,36 @@ function build_jll_package(src_name::String,
12601260
end
12611261
end
12621262

1263+
if !isempty(augment_platform_block)
1264+
pkg_dir = joinpath(code_dir, ".pkg")
1265+
!ispath(pkg_dir) && mkdir(pkg_dir)
1266+
open(joinpath(pkg_dir, "platform_augmentation.jl"), "w") do io
1267+
println(io, """
1268+
$(augment_platform_block)
1269+
""")
1270+
end
1271+
1272+
open(joinpath(pkg_dir, "select_artifact.jl"), "w") do io
1273+
println(io, """
1274+
using TOML, Artifacts, Base.BinaryPlatforms
1275+
include("./platform_augmentation.jl")
1276+
artifacts_toml = joinpath(dirname(@__DIR__), "Artifacts.toml")
1277+
1278+
# Get "target triplet" from ARGS, if given (defaulting to the host triplet otherwise)
1279+
target_triplet = get(ARGS, 1, Base.BinaryPlatforms.host_triplet())
1280+
1281+
# Augment this platform object with any special tags we require
1282+
platform = augment_platform!(HostPlatform(parse(Platform, target_triplet)))
1283+
1284+
# Select all downloadable artifacts that match that platform
1285+
artifacts = select_downloadable_artifacts(artifacts_toml; platform)
1286+
1287+
#Output the result to `stdout` as a TOML dictionary
1288+
TOML.print(stdout, artifacts)
1289+
""")
1290+
end
1291+
end
1292+
12631293
# Generate target-demuxing main source file.
12641294
open(joinpath(code_dir, "src", "$(src_name)_jll.jl"), "w") do io
12651295
print(io, """
@@ -1274,11 +1304,7 @@ function build_jll_package(src_name::String,
12741304

12751305
if !isempty(augment_platform_block)
12761306
print(io, """
1277-
$(augment_platform_block)
1278-
""")
1279-
else
1280-
print(io, """
1281-
augment_platform(platform) = platform
1307+
include(joinpath("..", ".pkg", "platform_augmentation.jl"))
12821308
""")
12831309
end
12841310

0 commit comments

Comments
 (0)