Skip to content

Commit 269b08a

Browse files
authored
Use ZstdBuilder and drop Julia 0.6 (#9)
1 parent 535c4b2 commit 269b08a

File tree

7 files changed

+75
-84
lines changed

7 files changed

+75
-84
lines changed

.travis.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
# Documentation: http://docs.travis-ci.com/user/languages/julia/
1+
# Documentation: https://docs.travis-ci.com/user/languages/julia/
22
language: julia
33
os:
44
- linux
55
- osx
66
julia:
7-
- 0.6
7+
- 0.7
88
- nightly
99
matrix:
1010
allow_failures:
1111
- julia: nightly
1212
notifications:
1313
email: false
14-
# uncomment the following lines to override the default test script
15-
#script:
16-
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
17-
# - julia -e 'Pkg.clone(pwd()); Pkg.build("CodecZstd"); Pkg.test("CodecZstd"; coverage=true)'
1814
after_success:
19-
# push coverage results to Codecov
20-
- julia -e 'cd(Pkg.dir("CodecZstd")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
15+
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'

REQUIRE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
julia 0.6
2-
BinDeps
3-
TranscodingStreams 0.3
1+
julia 0.7
2+
BinaryProvider 0.4
3+
TranscodingStreams 0.6

appveyor.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
environment:
22
matrix:
3+
- julia_version: 0.7
4+
# - julia_version: 1
5+
- julia_version: nightly
6+
7+
platform:
8+
# - x86 # 32-bit
9+
- x64 # 64-bit
10+
11+
matrix:
12+
allow_failures:
13+
- julia_version: latest
314

4-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
5-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
6-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
7-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
815
branches:
916
only:
1017
- master
@@ -17,19 +24,12 @@ notifications:
1724
on_build_status_changed: false
1825

1926
install:
20-
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
21-
# Download most recent Julia Windows binary
22-
- ps: (new-object net.webclient).DownloadFile(
23-
$env:JULIA_URL,
24-
"C:\projects\julia-binary.exe")
25-
# Run installer silently, output to C:\projects\julia
26-
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
27+
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
2728

2829
build_script:
29-
# Need to convert from shallow to complete for Pkg.clone to work
30-
- IF EXIST .git\shallow (git fetch --unshallow)
31-
- C:\projects\julia\bin\julia -e "versioninfo();
32-
Pkg.clone(pwd(), \"CodecZstd\"); Pkg.build(\"CodecZstd\")"
30+
- echo "%JL_BUILD_SCRIPT%"
31+
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
3332

3433
test_script:
35-
- C:\projects\julia\bin\julia -e "Pkg.test(\"CodecZstd\")"
34+
- echo "%JL_TEST_SCRIPT%"
35+
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

deps/build.jl

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
1-
using BinDeps
1+
using BinaryProvider # requires BinaryProvider 0.3.0 or later
22

3-
BinDeps.@setup
3+
# Parse some basic command-line arguments
4+
const verbose = "--verbose" in ARGS
5+
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
6+
products = [
7+
LibraryProduct(prefix, ["libzstd"], :libzstd),
8+
]
49

5-
libzstd = library_dependency("libzstd")
6-
version = "1.3.4"
7-
source = "https://github.com/facebook/zstd/archive/v$(version).tar.gz"
10+
# Download binaries from hosted location
11+
bin_prefix = "https://github.com/bicycle1885/ZstdBuilder/releases/download/v1.0.0"
812

9-
prefix = joinpath(dirname(@__FILE__), "usr")
10-
provides(Sources, URI(source), libzstd, unpacked_dir="zstd-$(version)")
11-
provides(
12-
SimpleBuild,
13-
(@build_steps begin
14-
GetSources(libzstd)
15-
@build_steps begin
16-
ChangeDirectory(joinpath(BinDeps.depsdir(libzstd), "src", "zstd-$(version)"))
17-
MakeTargets(["PREFIX=$(prefix)", "install"])
18-
end
19-
end), libzstd)
13+
# Listing of files generated by BinaryBuilder:
14+
download_info = Dict(
15+
Linux(:aarch64, :glibc) => ("$bin_prefix/ZstdBuilder.v1.3.5.aarch64-linux-gnu.tar.gz", "97e67a71dc1b7a65229e5bec76fd088c77333943cf9724d4f3855229563de7f9"),
16+
Linux(:aarch64, :musl) => ("$bin_prefix/ZstdBuilder.v1.3.5.aarch64-linux-musl.tar.gz", "ad601bba5ec35ae04ebb540ef397a8ab29fe09f7a3b6310bcf0ad90b5c05c3bf"),
17+
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/ZstdBuilder.v1.3.5.arm-linux-gnueabihf.tar.gz", "9add827c7b4ad838081da79bde9813b11e5276780b590960cb457781feace7e2"),
18+
Linux(:armv7l, :musl, :eabihf) => ("$bin_prefix/ZstdBuilder.v1.3.5.arm-linux-musleabihf.tar.gz", "2005bfa5cace0136d54aa613bb6391c4f0f634b1b443a4744bd6f9e31968b9fc"),
19+
Linux(:i686, :glibc) => ("$bin_prefix/ZstdBuilder.v1.3.5.i686-linux-gnu.tar.gz", "96b6184006afa2368f3670953b222a26fb4a65ac8934eb5c12890c7394cd1203"),
20+
Linux(:i686, :musl) => ("$bin_prefix/ZstdBuilder.v1.3.5.i686-linux-musl.tar.gz", "39e681a87cc6483bca042ac1ce3b04de894368a19dfd16a95ce26e6d5f3c37e3"),
21+
Linux(:powerpc64le, :glibc) => ("$bin_prefix/ZstdBuilder.v1.3.5.powerpc64le-linux-gnu.tar.gz", "3b39026efa4cff3cb1c6ac286f7ae4d359d134f741cc9dfd5543df904ae1875d"),
22+
MacOS(:x86_64) => ("$bin_prefix/ZstdBuilder.v1.3.5.x86_64-apple-darwin14.tar.gz", "43c7ded749de65bc422a99b890e493cddfa46d4b2415b9da09a504624dc7b904"),
23+
Linux(:x86_64, :glibc) => ("$bin_prefix/ZstdBuilder.v1.3.5.x86_64-linux-gnu.tar.gz", "197bce9aae1403445ef6af443adf71461f7f5e6c451efc192be0b4280675c47e"),
24+
Linux(:x86_64, :musl) => ("$bin_prefix/ZstdBuilder.v1.3.5.x86_64-linux-musl.tar.gz", "771cdb081f306f5e2e54b07478d68785f59c6970b77eabd454058a94ba2f67de"),
25+
FreeBSD(:x86_64) => ("$bin_prefix/ZstdBuilder.v1.3.5.x86_64-unknown-freebsd11.1.tar.gz", "1316f654b6f74551968988db423568268a76a76d9b1f98d2aa12f561fa2bc0d1"),
26+
Windows(:x86_64) => ("$bin_prefix/ZstdBuilder.v1.3.5.x86_64-w64-mingw32.tar.gz", "0967ebac58666f24dc3e0edcb07c29b27960a0d4af67591c10f374f65231e003"),
27+
)
2028

21-
@BinDeps.install Dict(:libzstd=>:libzstd)
29+
# Install unsatisfied or updated dependencies:
30+
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
31+
if haskey(download_info, platform_key())
32+
url, tarball_hash = download_info[platform_key()]
33+
if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix)
34+
# Download and install binaries
35+
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
36+
end
37+
elseif unsatisfied
38+
# If we don't have a BinaryProvider-compatible .tar.gz to download, complain.
39+
# Alternatively, you could attempt to install from a separate provider,
40+
# build from source or something even more ambitious here.
41+
error("Your platform $(triplet(platform_key())) is not supported by this package!")
42+
end
43+
44+
# Write out a deps.jl file that will contain mappings for our products
45+
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)

src/CodecZstd.jl

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
__precompile__()
2-
31
module CodecZstd
42

53
export
@@ -14,30 +12,19 @@ import TranscodingStreams:
1412
Memory,
1513
Error,
1614
initialize,
17-
finalize
18-
19-
# TODO: This method will be added in the next version of TranscodingStreams.jl.
20-
function splitkwargs(kwargs, keys)
21-
hits = []
22-
others = []
23-
for kwarg in kwargs
24-
push!(kwarg[1] keys ? hits : others, kwarg)
25-
end
26-
return hits, others
27-
end
15+
finalize,
16+
splitkwargs
2817

29-
if VERSION < v"0.7-"
30-
const Cvoid = Void
18+
using Libdl
19+
const libzpath = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")
20+
if !isfile(libzpath)
21+
error("CodecZlib.jl is not installed properly, run Pkg.build(\"CodecZlib\") and restart Julia.")
3122
end
23+
include(libzpath)
24+
check_deps()
3225

3326
include("libzstd.jl")
3427
include("compression.jl")
3528
include("decompression.jl")
3629

37-
# Deprecations
38-
@deprecate ZstdCompression ZstdCompressor
39-
@deprecate ZstdCompressionStream ZstdCompressorStream
40-
@deprecate ZstdDecompression ZstdDecompressor
41-
@deprecate ZstdDecompressionStream ZstdDecompressorStream
42-
4330
end # module

src/libzstd.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Low-level Interfaces
22
# ====================
33

4-
# load libzstd
5-
include("../deps/deps.jl")
6-
74
function iserror(code::Csize_t)
85
return ccall((:ZSTD_isError, libzstd), Cuint, (Csize_t,), code) != 0
96
end

test/runtests.jl

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
using CodecZstd
2-
import TranscodingStreams
3-
if VERSION < v"0.7-"
4-
using Base.Test
5-
else
6-
using Test
7-
end
2+
using TranscodingStreams
3+
using Test
84

95
@testset "Zstd Codec" begin
106
codec = ZstdCompressor()
117
@test codec isa ZstdCompressor
12-
if VERSION < v"0.7-"
13-
@test ismatch(r"^CodecZstd.ZstdCompressor\(level=\d+\)$", sprint(show, codec))
14-
else
15-
@test occursin(r"^ZstdCompressor\(level=\d+\)$", sprint(show, codec))
16-
end
8+
@test occursin(r"^ZstdCompressor\(level=\d+\)$", sprint(show, codec))
179
@test CodecZstd.initialize(codec) === nothing
1810
@test CodecZstd.finalize(codec) === nothing
1911

2012
codec = ZstdDecompressor()
2113
@test codec isa ZstdDecompressor
22-
if VERSION < v"0.7-"
23-
@test ismatch(r"^CodecZstd.ZstdDecompressor\(\)$", sprint(show, codec))
24-
else
25-
@test occursin(r"^ZstdDecompressor\(\)$", sprint(show, codec))
26-
end
14+
@test occursin(r"^ZstdDecompressor\(\)$", sprint(show, codec))
2715
@test CodecZstd.initialize(codec) === nothing
2816
@test CodecZstd.finalize(codec) === nothing
2917

0 commit comments

Comments
 (0)