1212 binary_name = " cmake"
1313end
1414
15+ function probe_symlink_creation (dest:: AbstractString )
16+ while ! isdir (dest)
17+ dest = dirname (dest)
18+ end
19+
20+ # Build arbitrary (non-existent) file path name
21+ link_path = joinpath (dest, " binaryprovider_symlink_test" )
22+ while ispath (link_path)
23+ link_path *= " 1"
24+ end
25+
26+ try
27+ symlink (" foo" , link_path)
28+ return true
29+ catch e
30+ if isa (e, Base. IOError)
31+ return false
32+ end
33+ rethrow (e)
34+ finally
35+ rm (link_path; force= true )
36+ end
37+ end
38+
1539function install_binaries (file_base, file_ext, binary_dir)
1640 filename = " $(file_base) .$(file_ext) "
1741 url = " $(base_url) /$(filename) "
1842 binary_path = joinpath (basedir, " downloads" , file_base, binary_dir)
43+ copyderef = get (ENV , " BINARYPROVIDER_COPYDEREF" , " " ) == " true" || ! probe_symlink_creation (binary_path)
1944
2045 @static if Sys. iswindows ()
2146 install_step = () -> begin
@@ -28,8 +53,14 @@ function install_binaries(file_base, file_ext, binary_dir)
2853 else
2954 install_step = () -> begin
3055 for file in readdir (binary_path)
31- symlink (joinpath (binary_path, file),
56+ if ! copyderef
57+ symlink (joinpath (binary_path, file),
3258 joinpath (prefix, " bin" , file))
59+ else
60+ cp (joinpath (binary_path, file),
61+ joinpath (prefix, " bin" , file);
62+ force= true )
63+ end
3364 end
3465 end
3566 end
0 commit comments