Skip to content

Commit

Permalink
Merge pull request #112 from JuliaWeb/yyc/0.7
Browse files Browse the repository at this point in the history
Fix depwarns on 0.7
  • Loading branch information
yuyichao authored Sep 18, 2017
2 parents e1d243f + 90a7e22 commit 43e1a45
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
BinDeps
@osx Homebrew
Compat 0.9.5
Compat 0.27.0
22 changes: 12 additions & 10 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Compat

need_to_build_manually = true

function validate_mbed(name, handle)
Expand Down Expand Up @@ -29,7 +31,7 @@ if Libdl.dlopen_e("libmbedtls") != C_NULL &&
validate_mbed("", Libdl.dlopen_e("libmbedcrypto")) &&
get(ENV, "FORCE_BUILD", "") != "true"
println("Using system libraries...")
if !isfile("deps.jl") || readstring("deps.jl") != systemlibs
if !isfile("deps.jl") || read("deps.jl", String) != systemlibs
open("deps.jl", "w") do f
write(f, systemlibs)
end
Expand All @@ -44,7 +46,7 @@ if need_to_build_manually
println("Manual build...")
# If we somehow already have a deps from system-libraries, but are now manually building
# make sure we delete the old deps.jl
isfile("deps.jl") && readstring("deps.jl") == systemlibs && rm("deps.jl")
isfile("deps.jl") && read("deps.jl", String) == systemlibs && rm("deps.jl")

mbed = library_dependency("libmbedtls", aliases=["libmbedtls", "libmbedtls.2.1.1"])
mbed_crypto = library_dependency("libmbedcrypto", aliases=["libmbedcrypto", "libmbedcrypto.2.1.1"], validate=validate_mbed)
Expand All @@ -65,7 +67,7 @@ if need_to_build_manually
mbed_all, unpacked_dir="mbedtls-2.1.1",
SHA = srcsha)

if is_unix()
if Compat.Sys.isunix()
mbed_dir = joinpath(BinDeps.depsdir(mbed), "src", "mbedtls-2.1.1")
provides(BuildProcess,
(@build_steps begin
Expand All @@ -81,15 +83,15 @@ if need_to_build_manually
end), mbed_all, installed_libpath=joinpath(mbed_dir, "library"))
end

if is_apple()
if Compat.Sys.isapple()
if Pkg.installed("Homebrew") === nothing
error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
end
using Homebrew
provides(Homebrew.HB, "mbedtls", mbed_all)
error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
end
using Homebrew
provides(Homebrew.HB, "mbedtls", mbed_all)
end

if is_windows()
if Compat.Sys.iswindows()
unpacked_dir = Int==Int32 ? "usr/bin32" : "usr/bin64"
provides(
Binaries,
Expand All @@ -103,4 +105,4 @@ if need_to_build_manually
@BinDeps.install Dict("libmbedtls"=>"MBED_TLS",
"libmbedcrypto"=>"MBED_CRYPTO",
"libmbedx509"=>"MBED_X509")
end
end
2 changes: 1 addition & 1 deletion src/ctr_drbg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ end

const c_rng = Ref{Ptr{Void}}(C_NULL)
function __ctr_drbg__init__()
c_rng[] = cfunction(f_rng, Cint, (Ptr{Void}, Ptr{UInt8}, Csize_t))
c_rng[] = cfunction(f_rng, Cint, Tuple{Ptr{Void}, Ptr{UInt8}, Csize_t})
end
2 changes: 1 addition & 1 deletion src/entropy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ end

const c_entropy = Ref{Ptr{Void}}(C_NULL)
function __entropyinit__()
c_entropy[] = cfunction(jl_entropy, Cint, (Ptr{Void}, Ptr{Void}, Csize_t, Ptr{Void}))
c_entropy[] = cfunction(jl_entropy, Cint, Tuple{Ptr{Void}, Ptr{Void}, Csize_t, Ptr{Void}})
end

function gather(ctx::Entropy)
Expand Down
5 changes: 3 additions & 2 deletions src/rsa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ function mpi_import!(mpi::Ptr{mbedtls_mpi}, b::BigInt)
nbytes = div(size+8-1,8)
data = Vector{UInt8}(nbytes)
count = Ref{Csize_t}(0)
# TODO Replace `Any` with `Ref{BigInt}` when 0.6 support is dropped.
ccall((:__gmpz_export,:libgmp), Ptr{Void},
(Ptr{Void}, Ptr{Csize_t}, Cint, Csize_t, Cint, Csize_t, Ptr{BigInt}),
data, count, 1, 1, 1, 0, &b)
(Ptr{Void}, Ptr{Csize_t}, Cint, Csize_t, Cint, Csize_t, Any),
data, count, 1, 1, 1, 0, b)
@assert count[] == nbytes
# Import into mbedtls
@err_check ccall((:mbedtls_mpi_read_binary, MBED_CRYPTO), Cint,
Expand Down
7 changes: 3 additions & 4 deletions src/ssl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ const c_send = Ref{Ptr{Void}}(C_NULL)
const c_recv = Ref{Ptr{Void}}(C_NULL)
const c_dbg = Ref{Ptr{Void}}(C_NULL)
function __sslinit__()
c_send[] = cfunction(f_send, Cint, (Ptr{Void}, Ptr{UInt8}, Csize_t))
c_recv[] = cfunction(f_recv, Cint, (Ptr{Void}, Ptr{UInt8}, Csize_t))
c_dbg[] = cfunction(f_dbg, Void,
(Ptr{Void}, Cint, Ptr{UInt8}, Cint, Ptr{UInt8}))
c_send[] = cfunction(f_send, Cint, Tuple{Ptr{Void}, Ptr{UInt8}, Csize_t})
c_recv[] = cfunction(f_recv, Cint, Tuple{Ptr{Void}, Ptr{UInt8}, Csize_t})
c_dbg[] = cfunction(f_dbg, Void, Tuple{Ptr{Void}, Cint, Ptr{UInt8}, Cint, Ptr{UInt8}})
end

0 comments on commit 43e1a45

Please sign in to comment.