diff --git a/REQUIRE b/REQUIRE index 5dda0e9..71f59fe 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,3 @@ julia 0.7 -BinaryProvider 0.3 +BinaryProvider 0.5 TranscodingStreams 0.6 diff --git a/deps/build.jl b/deps/build.jl index 0ae0e4f..4a0b606 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,4 +1,5 @@ -using BinaryProvider # requires BinaryProvider 0.3.0 or later +using BinaryProvider # requires BinaryProvider 0.5.0 or later +using Libdl # Parse some basic command-line arguments const verbose = "--verbose" in ARGS @@ -8,28 +9,29 @@ products = [ ] # Download binaries from hosted location -bin_prefix = "https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.2" +bin_prefix = "https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.3" # Listing of files generated by BinaryBuilder: download_info = Dict( - Linux(:aarch64, :glibc) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-gnu.tar.gz", "66e6b2414a4fc9a5b8392b70efef9c4d163fad5159270c78e0740eebec95a415"), - Linux(:aarch64, :musl) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-musl.tar.gz", "2445bd730e8f7c9dcaaace86b15244549d8630f4d78ce4c4df3fb693adde1333"), - Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz", "d6417bffeacdc542a0b35407e1d8cf7a85d8c9d695868c7770df57fe556c5a6f"), - Linux(:armv7l, :musl, :eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-musleabihf.tar.gz", "0ec51f27db2a7dc3c8056b18a99776ccc7459e6e5127cf82efeca770945d68b6"), - Linux(:i686, :glibc) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-gnu.tar.gz", "1d2bba7f971ab3576d84ce5094cc8e0849d6c7552182146454d90cae1714a542"), - Linux(:i686, :musl) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-musl.tar.gz", "06a77d15bb8ea3db8f7c45b06cf9b2b6944804147ef5ac5de11527a2badca886"), - Windows(:i686) => ("$bin_prefix/Zlib.v1.2.11.i686-w64-mingw32.tar.gz", "db1063328e9f2a961977f870e1954a977f86066f2aa0922ccba6e559aee22484"), - Linux(:powerpc64le, :glibc) => ("$bin_prefix/Zlib.v1.2.11.powerpc64le-linux-gnu.tar.gz", "13bc52cec6a5f40ef81ecb5120b123c6f63508e1b999c76b48ccf27a7029a1bd"), - MacOS(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-apple-darwin14.tar.gz", "deb72ecf071dc410870d9df75f3dbeef00c084394e1fc8e8631f5928ead3b87b"), - Linux(:x86_64, :glibc) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz", "26f8ddebd91628ca5c08310ec3ed6d7ebef1598ccabc34e5e4d495c6b21d89d0"), - Linux(:x86_64, :musl) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-musl.tar.gz", "e826ceffc841d2abf67854ce9ed739ae2d32d1b5acc46df6233b8fd1b549cc12"), - FreeBSD(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-unknown-freebsd11.1.tar.gz", "223f1f7886e45f2b1af889d5045402cbc0c22175515e593fead19099e5378741"), - Windows(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz", "016d0ad7dedea4aed59059ba0cf5776ca6955ebcdec262035391ec717e9b67df"), + Linux(:aarch64, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-gnu.tar.gz", "72aa633f5291d3a514f615b68f9a0550d66310d9563bb3fa72c8b5bd8ea4d58d"), + Linux(:aarch64, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-musl.tar.gz", "041932deac67883e7ee07feb243fcfaa0a9a52e6e6112fe0c6425e1c4094f0fc"), + Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz", "f50e80b44ba8fd20e9a59d51e96b783066414e4ef7c51ebad4308be89611fa2d"), + Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-musleabihf.tar.gz", "842a2485d10fc98589db0b6c9fa5d2b8919ecdda1a125b6313aa2c1ef787887d"), + Linux(:i686, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-gnu.tar.gz", "c2ca5c65343f96b329654f7785cfa7a17fb603541cf7f5e19c3ba4d77ce42cf3"), + Linux(:i686, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-musl.tar.gz", "0d86ffc9e2021112371a7efb646804bf3f51d798f89234e9e3c5809068e8facc"), + Windows(:i686) => ("$bin_prefix/Zlib.v1.2.11.i686-w64-mingw32.tar.gz", "fa43ec42f5d6521f806aaa594f5438eb81fa8f1e841542e0a5808446890b80e6"), + Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.powerpc64le-linux-gnu.tar.gz", "937b115771c60310497a3d00d0f888944b4582b1a1e67658f445432da1cefbcb"), + MacOS(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-apple-darwin14.tar.gz", "777ace94953082dfbfdc4bbc0d7217eb16f868bca0cc6c26f1cf5652c318ae04"), + Linux(:x86_64, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz", "3c1259cd136a53c11d21980f41581ae4d9db226dca0beb9c7effa501b93de1e1"), + Linux(:x86_64, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-musl.tar.gz", "fd3e452718763857b8fe5e600e1f426ed86dc1b47b1e186991e22ad7c33d0f92"), + FreeBSD(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-unknown-freebsd11.1.tar.gz", "2e7248503c96ad7d49ba62f94b5a9813f216d07a66d953b55719f8c1adca2864"), + Windows(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz", "b2a642c6ecc3f20ccc7357d91d39029a15cf3e1a38c639a339330231fd8b7601"), ) # A simple source build fallback for platforms not supported by BinaryBuilder # Assumes that tar, GNU make, and a C compiler are available function sourcebuild() + @info "Trying to install zlib from the source code." srcdir = joinpath(@__DIR__, "src") libdir = joinpath(@__DIR__, "lib") z = "zlib-1.2.11" @@ -43,18 +45,17 @@ function sourcebuild() end cd(joinpath(srcdir, z)) do run(`./configure --prefix=.`) - make = Sys.isbsd() ? `gmake` : `make` - run(`$make -j$(Sys.CPU_CORES)`) + make = Sys.isbsd() && !Sys.isapple() ? `gmake` : `make` + run(`$make -j$(Sys.CPU_THREADS)`) end - found = false + libz = nothing for f in readdir(joinpath(srcdir, z)) - if startswith(f, "libz." * Libdl.dlext) - found = true - cp(joinpath(srcdir, z, f), joinpath(libdir, f), force=true) + if f == "libz." * Libdl.dlext + libz = joinpath(srcdir, z, f) + break end end - found || error("zlib was unable to build properly") - libz = joinpath(libdir, "libz." * Libdl.dlext) + libz === nothing && error("zlib was unable to build properly") open(joinpath(@__DIR__, "deps.jl"), "w") do io println(io, """ function check_deps() @@ -71,24 +72,23 @@ function sourcebuild() end end -dobuild = try - key = platform_key() # This can error on older BinaryProvider versions (<=0.2.5) - isdefined(BinaryProvider, :UnknownPlatform) && key == UnknownPlatform() -catch - true -end - -if dobuild +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +dl_info = choose_download(download_info, platform_key_abi()) +if dl_info === nothing && unsatisfied + # If we don't have a compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something even more ambitious here. + @warn "ZlibBuilder provides no prebuilt binary for your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\")." sourcebuild() -elseif any(!satisfied(p; verbose=verbose) for p in products) - # Check to see if we're all satisfied - if haskey(download_info, platform_key()) +else + # If we have a download, and we are unsatisfied (or the version we're + # trying to install is not itself installed) then load it up! + if unsatisfied || !isinstalled(dl_info...; prefix=prefix) # Download and install binaries - url, tarball_hash = download_info[platform_key()] - install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose) + install(dl_info...; prefix=prefix, force=true, verbose=verbose) end -end -# Write out a deps.jl file that will contain mappings for our products -# This is already done if we've built from source -dobuild || write_deps_file(joinpath(@__DIR__, "deps.jl"), products) + # Write out a deps.jl file that will contain mappings for our products + write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) +end