1
- using BinaryBuilderBase: get_concrete_platform
1
+ using BinaryBuilderBase: get_concrete_platform, destdir
2
2
3
3
include (" hints.jl" )
4
4
5
+ # Add new method to `get_concrete_platform`: this is a common pattern throughout
6
+ # this file.
7
+ BinaryBuilderBase. get_concrete_platform (platform:: AbstractPlatform , state:: WizardState ) =
8
+ get_concrete_platform (platform;
9
+ preferred_gcc_version = state. preferred_gcc_version,
10
+ preferred_llvm_version = state. preferred_llvm_version,
11
+ compilers = state. compilers)
12
+
5
13
# When rerunning the script generated during the wizard we want to fail on error
6
14
# and automatically install license at the end.
7
15
full_wizard_script (state:: WizardState ) =
@@ -17,10 +25,11 @@ function step4(state::WizardState, ur::Runner, platform::AbstractPlatform,
17
25
build_path:: AbstractString , prefix:: Prefix )
18
26
printstyled (state. outs, " \t\t\t # Step 4: Select build products\n\n " , bold= true )
19
27
28
+ concrete_platform = get_concrete_platform (platform, state)
20
29
# Collect all executable/library files, explicitly exclude everything that is
21
30
# a symlink to the artifacts directory, as usual.
22
- destdir = joinpath (prefix, " destdir " )
23
- files = filter (f -> startswith (f, destdir ), collapse_symlinks (collect_files (destdir )))
31
+ destdir_path = destdir (prefix, concrete_platform )
32
+ files = filter (f -> startswith (f, destdir_path ), collapse_symlinks (collect_files (destdir_path )))
24
33
files = filter_object_files (files)
25
34
26
35
# Check if we can load them as an object file
@@ -31,7 +40,7 @@ function step4(state::WizardState, ur::Runner, platform::AbstractPlatform,
31
40
end
32
41
33
42
# Strip out the prefix from filenames
34
- state. files = map (file-> replace (file, " $(destdir ) /" => " " ), files)
43
+ state. files = map (file-> replace (file, " $(destdir_path ) /" => " " ), files)
35
44
state. file_kinds = map (files) do f
36
45
readmeta (f) do oh
37
46
if isexecutable (oh)
@@ -63,10 +72,7 @@ function step4(state::WizardState, ur::Runner, platform::AbstractPlatform,
63
72
64
73
if choice == 1
65
74
# Link dependencies into the prefix again
66
- concrete_platform = get_concrete_platform (platform;
67
- preferred_gcc_version = state. preferred_gcc_version,
68
- preferred_llvm_version = state. preferred_llvm_version,
69
- compilers = state. compilers)
75
+ concrete_platform = get_concrete_platform (platform, state)
70
76
artifact_paths = setup_dependencies (prefix, getpkg .(state. dependencies), concrete_platform)
71
77
return step3_interactive (state, prefix, platform, ur, build_path, artifact_paths)
72
78
elseif choice == 2
@@ -214,10 +220,7 @@ function bb_add(client, state::WizardState, prefix::Prefix, platform::AbstractPl
214
220
new_dep = Dependency (jll)
215
221
try
216
222
# This will redo some work, but that may be ok
217
- concrete_platform = get_concrete_platform (platform;
218
- preferred_gcc_version = state. preferred_gcc_version,
219
- preferred_llvm_version = state. preferred_llvm_version,
220
- compilers = state. compilers)
223
+ concrete_platform = get_concrete_platform (platform, state)
221
224
# Clear out the prefix artifacts directory in case this change caused
222
225
# any previous dependencies to change
223
226
let artifacts_dir = joinpath (prefix, " artifacts" )
@@ -408,7 +411,8 @@ function step3_interactive(state::WizardState, prefix::Prefix,
408
411
cleanup_dependencies (prefix, artifact_paths)
409
412
state. step = :step3_retry
410
413
else
411
- step3_audit (state, platform, joinpath (prefix, " destdir" ))
414
+ concrete_platform = get_concrete_platform (platform, state)
415
+ step3_audit (state, platform, destdir (prefix, concrete_platform))
412
416
# Unsymlink all the deps from the dest_prefix before moving to the next step
413
417
cleanup_dependencies (prefix, artifact_paths)
414
418
return step4 (state, ur, platform, build_path, prefix)
@@ -429,11 +433,8 @@ function step3_retry(state::WizardState)
429
433
430
434
build_path = tempname ()
431
435
mkpath (build_path)
432
- prefix = setup_workspace (build_path, vcat (state. source_files, state. patches); verbose= false )
433
- concrete_platform = get_concrete_platform (platform;
434
- preferred_gcc_version = state. preferred_gcc_version,
435
- preferred_llvm_version = state. preferred_llvm_version,
436
- compilers = state. compilers)
436
+ concrete_platform = get_concrete_platform (platform, state)
437
+ prefix = setup_workspace (build_path, vcat (state. source_files, state. patches), concrete_platform; verbose= false )
437
438
artifact_paths = setup_dependencies (prefix, getpkg .(state. dependencies), concrete_platform)
438
439
439
440
ur = preferred_runner ()(
@@ -448,7 +449,7 @@ function step3_retry(state::WizardState)
448
449
with_logfile (joinpath (build_path, " out.log" )) do io
449
450
run (ur, ` /bin/bash -c $(full_wizard_script (state)) ` , io; verbose= true , tee_stream= state. outs)
450
451
end
451
- step3_audit (state, platform, joinpath (prefix, " destdir " ))
452
+ step3_audit (state, platform, destdir (prefix, concrete_platform ))
452
453
# Unsymlink all the deps from the dest_prefix before moving to the next step
453
454
cleanup_dependencies (prefix, artifact_paths)
454
455
@@ -514,15 +515,13 @@ function step34(state::WizardState)
514
515
build_path = tempname ()
515
516
mkpath (build_path)
516
517
state. history = " "
518
+ concrete_platform = get_concrete_platform (platform, state)
517
519
prefix = setup_workspace (
518
520
build_path,
519
- vcat (state. source_files, state. patches);
521
+ vcat (state. source_files, state. patches),
522
+ concrete_platform;
520
523
verbose= false
521
524
)
522
- concrete_platform = get_concrete_platform (platform;
523
- preferred_gcc_version = state. preferred_gcc_version,
524
- preferred_llvm_version = state. preferred_llvm_version,
525
- compilers = state. compilers)
526
525
artifact_paths = setup_dependencies (prefix, getpkg .(state. dependencies), concrete_platform; verbose= true )
527
526
528
527
provide_hints (state, joinpath (prefix, " srcdir" ))
@@ -564,13 +563,10 @@ function step5_internal(state::WizardState, platform::AbstractPlatform)
564
563
prefix_artifacts = Dict {Prefix,Vector{String}} ()
565
564
while ! ok
566
565
cd (build_path) do
567
- prefix = setup_workspace (build_path, vcat (state. source_files, state. patches); verbose= true )
566
+ concrete_platform = get_concrete_platform (platform, state)
567
+ prefix = setup_workspace (build_path, vcat (state. source_files, state. patches), concrete_platform; verbose= true )
568
568
# Clean up artifacts in case there are some
569
569
cleanup_dependencies (prefix, get (prefix_artifacts, prefix, String[]))
570
- concrete_platform = get_concrete_platform (platform;
571
- preferred_gcc_version = state. preferred_gcc_version,
572
- preferred_llvm_version = state. preferred_llvm_version,
573
- compilers = state. compilers)
574
570
artifact_paths = setup_dependencies (prefix, getpkg .(state. dependencies), concrete_platform; verbose= true )
575
571
# Record newly added artifacts for this prefix
576
572
prefix_artifacts[prefix] = artifact_paths
@@ -597,7 +593,7 @@ function step5_internal(state::WizardState, platform::AbstractPlatform)
597
593
msg = " The build script failed (see above).\n "
598
594
println (state. outs, msg)
599
595
else
600
- audit (Prefix (joinpath (prefix, " destdir " )); io= state. outs,
596
+ audit (Prefix (destdir (prefix, concrete_platform )); io= state. outs,
601
597
platform= platform, verbose= true , autofix= true , require_license= true )
602
598
603
599
ok = isempty (match_files (state, prefix, platform, state. files))
@@ -638,17 +634,15 @@ function step5_internal(state::WizardState, platform::AbstractPlatform)
638
634
elseif choice == 2
639
635
rm (build_path; force= true , recursive= true )
640
636
mkpath (build_path)
637
+ concrete_platform = get_concrete_platform (platform, state)
641
638
prefix = setup_workspace (
642
639
build_path,
643
- vcat (state. source_files, state. patches);
640
+ vcat (state. source_files, state. patches),
641
+ concrete_platform;
644
642
verbose= true ,
645
643
)
646
644
# Clean up artifacts in case there are some
647
645
cleanup_dependencies (prefix, get (prefix_artifacts, prefix, String[]))
648
- concrete_platform = get_concrete_platform (platform;
649
- preferred_gcc_version = state. preferred_gcc_version,
650
- preferred_llvm_version = state. preferred_llvm_version,
651
- compilers = state. compilers)
652
646
artifact_paths = setup_dependencies (prefix, getpkg .(state. dependencies), platform; verbose= true )
653
647
# Record newly added artifacts for this prefix
654
648
prefix_artifacts[prefix] = artifact_paths
@@ -775,15 +769,13 @@ function step5c(state::WizardState)
775
769
mkpath (build_path)
776
770
local ok = true
777
771
772
+ concrete_platform = get_concrete_platform (platform, state)
778
773
prefix = setup_workspace (
779
774
build_path,
780
- vcat (state. source_files, state. patches);
775
+ vcat (state. source_files, state. patches),
776
+ concrete_platform;
781
777
verbose= false ,
782
778
)
783
- concrete_platform = get_concrete_platform (platform;
784
- preferred_gcc_version = state. preferred_gcc_version,
785
- preferred_llvm_version = state. preferred_llvm_version,
786
- compilers = state. compilers)
787
779
artifact_paths = setup_dependencies (prefix, getpkg .(state. dependencies), concrete_platform; verbose= false )
788
780
ur = preferred_runner ()(
789
781
prefix. path;
@@ -799,7 +791,7 @@ function step5c(state::WizardState)
799
791
end
800
792
801
793
if ok
802
- audit (Prefix (joinpath (prefix, " destdir " ));
794
+ audit (Prefix (destdir (prefix, concrete_platform ));
803
795
io= state. outs,
804
796
platform= platform,
805
797
verbose= false ,
0 commit comments