|
3 | 3 | # environment variables must be updated to, etc...
|
4 | 4 | import Base: convert, joinpath, show
|
5 | 5 | using SHA, CodecZlib, TOML, LibGit2_jll
|
| 6 | +import Bzip2_jll, Gzip_jll, Tar_jll, XZ_jll, Zstd_jll |
| 7 | +using JLLWrappers: pathsep, LIBPATH_env |
6 | 8 |
|
7 | 9 | export Prefix, bindir, libdirs, includedir, logdir, temp_prefix, package
|
8 | 10 |
|
@@ -300,7 +302,34 @@ function setup(source::SetupSource{ArchiveSource}, targetdir, verbose; tar_flags
|
300 | 302 | if verbose
|
301 | 303 | @info "Extracting tarball $(basename(source.path))..."
|
302 | 304 | end
|
303 |
| - run(`tar -$(tar_flags) $(source.path)`) |
| 305 | + tar = Tar_jll.is_available() ? Tar_jll.tar() : `tar` |
| 306 | + # Add gzip, bzip2 & Co. to PATH. |
| 307 | + path = split(get(ENV, "PATH", ""), pathsep) |
| 308 | + libpath = split(get(ENV, LIBPATH_env, ""), pathsep) |
| 309 | + if Tar_jll.is_available() |
| 310 | + libpath = vcat(Tar_jll.LIBPATH_list, libpath) |
| 311 | + end |
| 312 | + if Bzip2_jll.is_available() |
| 313 | + path = vcat(joinpath(Bzip2_jll.artifact_dir, "bin"), path) |
| 314 | + libpath = vcat(Bzip2_jll.LIBPATH_list, libpath) |
| 315 | + end |
| 316 | + if Gzip_jll.is_available() |
| 317 | + path = vcat(dirname(Gzip_jll.gzip_path), path) |
| 318 | + libpath = vcat(Gzip_jll.LIBPATH_list, libpath) |
| 319 | + end |
| 320 | + if XZ_jll.is_available() |
| 321 | + path = vcat(dirname(XZ_jll.xz_path), path) |
| 322 | + libpath = vcat(XZ_jll.LIBPATH_list, libpath) |
| 323 | + end |
| 324 | + if Zstd_jll.is_available() |
| 325 | + path = vcat(dirname(Zstd_jll.zstd_path), path) |
| 326 | + libpath = vcat(XZ_jll.LIBPATH_list, libpath) |
| 327 | + end |
| 328 | + unique!(filter!(!isempty, path)) |
| 329 | + unique!(filter!(!isempty, libpath)) |
| 330 | + tar = addenv(tar, "PATH" => join(path, pathsep), LIBPATH_env => join(libpath, pathsep)) |
| 331 | + # Unpack the tarball |
| 332 | + run(`$(tar) -$(tar_flags) $(source.path)`) |
304 | 333 | elseif endswith(source.path, ".zip")
|
305 | 334 | if verbose
|
306 | 335 | @info "Extracting zipball $(basename(source.path))..."
|
|
0 commit comments