From 00210d2bdc6109e5472528c694ff9732530dc469 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Wed, 11 Mar 2020 14:33:36 -0700 Subject: [PATCH] Upgrade to Julia 1.3+, use artifacts (#49) * Upgrade to Julia 1.3+, use artifacts This makes use of the new Artifacts system within Julia 1.3+. This doesn't really change any core functionality, but it will benefit from the installation improvements we are making to artifacts and binary packages in general. * Update testing versions --- .travis.yml | 3 +- Project.toml | 8 ++--- appveyor.yml | 3 +- deps/build.jl | 94 ------------------------------------------------ src/CodecZlib.jl | 9 +---- 5 files changed, 6 insertions(+), 111 deletions(-) delete mode 100644 deps/build.jl diff --git a/.travis.yml b/.travis.yml index 3b700ab..ab7895f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ os: - osx - windows julia: - - 1.0 - - 1.1 + - 1.3 - nightly matrix: allow_failures: diff --git a/Project.toml b/Project.toml index 67e899a..8395d7c 100644 --- a/Project.toml +++ b/Project.toml @@ -2,17 +2,15 @@ name = "CodecZlib" uuid = "944b1d66-785c-5afd-91f1-9de20f533193" license = "MIT" authors = ["Kenta Sato "] -version = "0.6.0" +version = "0.7.0" [deps] -BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232" -Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" +Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a" [compat] -BinaryProvider = "0.5" TranscodingStreams = "0.9" -julia = "1" +julia = "1.3" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/appveyor.yml b/appveyor.yml index 4eeb818..87394eb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,6 @@ environment: matrix: - - julia_version: 1.0 - - julia_version: 1.1 + - julia_version: 1.3 - julia_version: latest platform: diff --git a/deps/build.jl b/deps/build.jl deleted file mode 100644 index 7c188ca..0000000 --- a/deps/build.jl +++ /dev/null @@ -1,94 +0,0 @@ -using BinaryProvider # requires BinaryProvider 0.5.0 or later -using Libdl - -# Parse some basic command-line arguments -const verbose = "--verbose" in ARGS -const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) -products = [ - LibraryProduct(prefix, ["libz"], :libz), -] - -# Download binaries from hosted location -bin_prefix = "https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.4" - -# Listing of files generated by BinaryBuilder: -download_info = Dict( - Linux(:aarch64, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-gnu.tar.gz", "3431c1a7d937cbad379ae5fe78c11dd0d425a6bce02b12c9d7c89e0a3173af97"), - Linux(:aarch64, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-musl.tar.gz", "7f89328d100f16ab75d37759cdb4df98d8f5b192146eacbe23fa859c6d7bca09"), - Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz", "04abd9100d2d24a56e50d536679c2df317d6c344b3ae06feb77681533377652f"), - Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-musleabihf.tar.gz", "fd4fd26462039de7135b5ad09f0c86ec441afd9bb7feb2689f705bc9b087931f"), - Linux(:i686, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-gnu.tar.gz", "41495344e20619158a05561db8a7ccb9c57192dc5038744419bb9bd58eba7b7a"), - Linux(:i686, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-musl.tar.gz", "c5d101f21c440156fdc8616bbe9f13f437dfed634cb17dbc65ed83c6b180533c"), - Windows(:i686) => ("$bin_prefix/Zlib.v1.2.11.i686-w64-mingw32.tar.gz", "84d4d5037459ec706029c78a94c98b07760943662a4adbe21cd3d353ac3a0484"), - Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.powerpc64le-linux-gnu.tar.gz", "c485627191c75411eaa66088427813a182c7ca0549f0dc21971c9452c45d8167"), - MacOS(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-apple-darwin14.tar.gz", "a28fb652f94f1b1548197a3b3c9a71ec56fa50bb7d39454c5e12320335d30934"), - Linux(:x86_64, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz", "1c3b1c8520713f98d3f605ee1ca5e2e3656d92ddb6441abeeeff0ae12a11a620"), - Linux(:x86_64, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-musl.tar.gz", "17da1e44f7a815f5dc6eb66e3c7df8c80846c67d5212148a33fb68ea677e38dc"), - FreeBSD(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-unknown-freebsd11.1.tar.gz", "87522b29c8dfb7681209fea541dcc09bd5863f55df9cb1de1645ec8484aad7b8"), - Windows(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz", "13934d974c5b1fd99897897b9af4ef7cce1025a1cdf1a57f14a9dd8e0258508a"), -) - -# 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" - for d = [srcdir, libdir] - isdir(d) && rm(d, force=true, recursive=true) - mkpath(d) - end - download("https://zlib.net/$(z).tar.gz", joinpath(srcdir, "$(z).tar.gz")) - cd(srcdir) do - run(`tar xzf $(z).tar.gz`) - end - cd(joinpath(srcdir, z)) do - run(`./configure --prefix=.`) - make = Sys.isbsd() && !Sys.isapple() ? `gmake` : `make` - run(`$make -j$(Sys.CPU_THREADS)`) - end - libz = nothing - for f in readdir(joinpath(srcdir, z)) - if f == "libz." * Libdl.dlext - libz = joinpath(srcdir, z, f) - break - end - end - libz === nothing && error("zlib was unable to build properly") - open(joinpath(@__DIR__, "deps.jl"), "w") do io - println(io, """ - function check_deps() - ptr = Libdl.dlopen_e("$libz") - loaded = ptr != C_NULL - Libdl.dlclose(ptr) - if !loaded - error("Unable to load zlib from $libz. Please rerun " * - "`Pkg.build(\\"CodecZlib\\")` and restart Julia.") - end - end - const libz = "$libz" - """) - end -end - -# 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() -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 - install(dl_info...; prefix=prefix, force=true, verbose=verbose) - end - - # Write out a deps.jl file that will contain mappings for our products - write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) -end diff --git a/src/CodecZlib.jl b/src/CodecZlib.jl index 6c43238..ca7a779 100644 --- a/src/CodecZlib.jl +++ b/src/CodecZlib.jl @@ -27,14 +27,7 @@ import TranscodingStreams: initialize, finalize, splitkwargs -using Libdl - -const libzpath = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl") -if !isfile(libzpath) - error("CodecZlib.jl is not installed properly, run Pkg.build(\"CodecZlib\") and restart Julia.") -end -include(libzpath) -check_deps() +using Zlib_jll include("libz.jl") include("compression.jl")