Skip to content

Commit

Permalink
Merge pull request #42 from iht/fix_julia1_0
Browse files Browse the repository at this point in the history
Mostly fix Julia 1.0 compatibility
  • Loading branch information
omus authored Aug 13, 2018
2 parents 94c22f4 + 9796c14 commit e9a6322
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/*.tar.gz
/tmp
/dist
/deps/build.log

/julia
/julia-*
Expand Down
19 changes: 11 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ os:
- linux
- osx
julia:
- 0.4
- 0.5
- 0.6
- 0.7
- 1.0
- nightly
notifications:
email: false
sudo: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd())'
- julia -e 'Pkg.test("LibCURL", coverage=true)'
# script:
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
# - julia -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("LibCURL"); Pkg.test("LibCURL"; coverage=true)'
after_success:
- julia -e 'cd(Pkg.dir("LibCURL")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
- |
julia -e '
VERSION >= v"0.7.0-DEV.3656" && using Pkg
VERSION >= v"0.7.0-DEV.5183" || cd(Pkg.dir("LibCURL"))
Pkg.add("Coverage"); using Coverage
Codecov.submit(process_folder())'

4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.4
julia 0.6
BinDeps
Compat 0.8
Compat 0.41
@windows WinRPM
33 changes: 13 additions & 20 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.6
- julia_version: 0.7
- julia_version: 1.0
- julia_version: latest

platform:
- x86 # 32-bit
- x64 # 64-bit

branches:
only:
Expand All @@ -21,19 +21,12 @@ notifications:
on_build_status_changed: false

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

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

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"LibCURL\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
4 changes: 2 additions & 2 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using BinDeps
import Compat: is_windows
import Compat: Sys

@BinDeps.setup

if is_windows()
if Sys.iswindows()
# note that there is a 32-bit version of libcurl.dll
# included with Git, which will not work with 64 bit Julia

Expand Down
24 changes: 15 additions & 9 deletions src/LibCURL.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
isdefined(Base, :__precompile__) && __precompile__()
VERSION < v"0.7.0-beta2.199" && __precompile__()

module LibCURL

import Compat: is_windows
import Compat: Sys, Cvoid

const time_t = Int
const size_t = Csize_t
Expand All @@ -11,25 +11,31 @@ const curl_off_t = Int64
include("lC_exports_h.jl")
include("lC_common_h.jl")

const libcurl = if is_windows()
Pkg.dir("WinRPM","deps","usr","$(Sys.ARCH)-w64-mingw32","sys-root","mingw","bin","libcurl-4")
const libcurl = if Sys.iswindows()
dir = if VERSION >= v"0.7"
import WinRPM
joinpath(dirname(pathof(WinRPM)), "..")
else
Pkg.dir("WinRPM")
end
joinpath(dir,"deps","usr","$(Base.Sys.ARCH)-w64-mingw32","sys-root","mingw","bin","libcurl-4")
else
"libcurl"
end

include("lC_curl_h.jl")

curl_easy_setopt(handle, opt, ptrval::Array) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Void}), handle, opt, pointer(ptrval))
curl_easy_setopt(handle, opt, ptrval::Array) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Cvoid}), handle, opt, pointer(ptrval))
curl_easy_setopt(handle, opt, ptrval::Integer) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Clong), handle, opt, ptrval)
curl_easy_setopt{T}(handle, opt, ptrval::Ptr{T}) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{T}), handle, opt, ptrval)
curl_easy_setopt(handle, opt, ptrval::Ptr{T}) where {T} = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{T}), handle, opt, ptrval)
curl_easy_setopt(handle, opt, ptrval::AbstractString) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{UInt8}), handle, opt, ptrval)

curl_multi_setopt(handle, opt, ptrval::Array) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{Void}), handle, opt, pointer(ptrval))
curl_multi_setopt(handle, opt, ptrval::Array) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{Cvoid}), handle, opt, pointer(ptrval))
curl_multi_setopt(handle, opt, ptrval::Integer) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Clong), handle, opt, ptrval)
curl_multi_setopt{T}(handle, opt, ptrval::Ptr{T}) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{T}), handle, opt, ptrval)
curl_multi_setopt(handle, opt, ptrval::Ptr{T}) where {T} = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{T}), handle, opt, ptrval)
curl_multi_setopt(handle, opt, ptrval::AbstractString) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{UInt8}), handle, opt, ptrval)

curl_easy_getinfo(handle, opt, ptrval::Array) = ccall((:curl_easy_getinfo, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Void}), handle, opt, pointer(ptrval))
curl_easy_getinfo(handle, opt, ptrval::Array) = ccall((:curl_easy_getinfo, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Cvoid}), handle, opt, pointer(ptrval))
curl_easy_getinfo(handle, opt, ptrval::AbstractString) = ccall((:curl_easy_getinfo, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{UInt8}), handle, opt, ptrval)

include("lC_defines_h.jl")
Expand Down
86 changes: 43 additions & 43 deletions src/lC_common_h.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ end

@ctypedef CURL Union{}
@ctypedef curl_socket_t Int32
type curl_httppost
next::Ptr{Void}
mutable struct curl_httppost
next::Ptr{Cvoid}
name::Ptr{UInt8}
namelength::Int32
contents::Ptr{UInt8}
contentslength::Int32
buffer::Ptr{UInt8}
bufferlength::Int32
contenttype::Ptr{UInt8}
contentheader::Ptr{Void}
more::Ptr{Void}
contentheader::Ptr{Cvoid}
more::Ptr{Cvoid}
flags::Int32
showfilename::Ptr{UInt8}
userp::Ptr{Void}
userp::Ptr{Cvoid}
end
@ctypedef curl_progress_callback Ptr{Void}
@ctypedef curl_write_callback Ptr{Void}
@ctypedef curl_progress_callback Ptr{Cvoid}
@ctypedef curl_write_callback Ptr{Cvoid}
# enum curlfiletype
const CURLFILETYPE_FILE = 0
const CURLFILETYPE_DIRECTORY = 1
Expand All @@ -42,7 +42,7 @@ const CURLFILETYPE_DOOR = 7
const CURLFILETYPE_UNKNOWN = 8
# end
@ctypedef curlfiletype Int32
type curl_fileinfo
mutable struct curl_fileinfo
filename::Ptr{UInt8}
filetype::curlfiletype
time::time_t
Expand All @@ -51,32 +51,32 @@ type curl_fileinfo
gid::Int32
size::curl_off_t
hardlinks::Int32
strings::Void
strings::Cvoid
flags::UInt32
b_data::Ptr{UInt8}
b_size::size_t
b_used::size_t
end
@ctypedef curl_chunk_bgn_callback Ptr{Void}
@ctypedef curl_chunk_end_callback Ptr{Void}
@ctypedef curl_fnmatch_callback Ptr{Void}
@ctypedef curl_seek_callback Ptr{Void}
@ctypedef curl_read_callback Ptr{Void}
@ctypedef curl_chunk_bgn_callback Ptr{Cvoid}
@ctypedef curl_chunk_end_callback Ptr{Cvoid}
@ctypedef curl_fnmatch_callback Ptr{Cvoid}
@ctypedef curl_seek_callback Ptr{Cvoid}
@ctypedef curl_read_callback Ptr{Cvoid}
# enum curlsocktype
const CURLSOCKTYPE_IPCXN = 0
const CURLSOCKTYPE_LAST = 1
# end
@ctypedef curlsocktype Int32
@ctypedef curl_sockopt_callback Ptr{Void}
type curl_sockaddr
@ctypedef curl_sockopt_callback Ptr{Cvoid}
mutable struct curl_sockaddr
family::Int32
socktype::Int32
protocol::Int32
addrlen::UInt32
addr::Void
addr::Cvoid
end
@ctypedef curl_opensocket_callback Ptr{Void}
@ctypedef curl_closesocket_callback Ptr{Void}
@ctypedef curl_opensocket_callback Ptr{Cvoid}
@ctypedef curl_closesocket_callback Ptr{Cvoid}
# enum curlioerr
const CURLIOE_OK = 0
const CURLIOE_UNKNOWNCMD = 1
Expand All @@ -90,12 +90,12 @@ const CURLIOCMD_RESTARTREAD = 1
const CURLIOCMD_LAST = 2
# end
@ctypedef curliocmd Int32
@ctypedef curl_ioctl_callback Ptr{Void}
@ctypedef curl_malloc_callback Ptr{Void}
@ctypedef curl_free_callback Ptr{Void}
@ctypedef curl_realloc_callback Ptr{Void}
@ctypedef curl_strdup_callback Ptr{Void}
@ctypedef curl_calloc_callback Ptr{Void}
@ctypedef curl_ioctl_callback Ptr{Cvoid}
@ctypedef curl_malloc_callback Ptr{Cvoid}
@ctypedef curl_free_callback Ptr{Cvoid}
@ctypedef curl_realloc_callback Ptr{Cvoid}
@ctypedef curl_strdup_callback Ptr{Cvoid}
@ctypedef curl_calloc_callback Ptr{Cvoid}
# enum curl_infotype
const CURLINFO_TEXT = 0
const CURLINFO_HEADER_IN = 1
Expand All @@ -107,7 +107,7 @@ const CURLINFO_SSL_DATA_OUT = 6
const CURLINFO_END = 7
# end
@ctypedef curl_infotype Int32
@ctypedef curl_debug_callback Ptr{Void}
@ctypedef curl_debug_callback Ptr{Cvoid}
# enum CURLcode
const CURLE_OK = 0
const CURLE_UNSUPPORTED_PROTOCOL = 1
Expand Down Expand Up @@ -201,8 +201,8 @@ const CURLE_CHUNK_FAILED = 88
const CURL_LAST = 89
# end
@ctypedef CURLcode Int32
@ctypedef curl_conv_callback Ptr{Void}
@ctypedef curl_ssl_ctx_callback Ptr{Void}
@ctypedef curl_conv_callback Ptr{Cvoid}
@ctypedef curl_ssl_ctx_callback Ptr{Cvoid}
# enum curl_proxytype
const CURLPROXY_HTTP = 0
const CURLPROXY_HTTP_1_0 = 1
Expand All @@ -212,7 +212,7 @@ const CURLPROXY_SOCKS4A = 6
const CURLPROXY_SOCKS5_HOSTNAME = 7
# end
@ctypedef curl_proxytype Int32
type curl_khkey
mutable struct curl_khkey
key::Ptr{UInt8}
len::size_t
keytype::Int32
Expand All @@ -230,7 +230,7 @@ const CURLKHMATCH_MISMATCH = 1
const CURLKHMATCH_MISSING = 2
const CURLKHMATCH_LAST = 3
# end
@ctypedef curl_sshkeycallback Ptr{Void}
@ctypedef curl_sshkeycallback Ptr{Cvoid}
# enum curl_usessl
const CURLUSESSL_NONE = 0
const CURLUSESSL_TRY = 1
Expand Down Expand Up @@ -520,7 +520,7 @@ const CURLFORM_STREAM = 19
const CURLFORM_LASTENTRY = 20
# end
@ctypedef CURLformoption Int32
type curl_forms
mutable struct curl_forms
option::CURLformoption
value::Ptr{UInt8}
end
Expand All @@ -536,14 +536,14 @@ const CURL_FORMADD_DISABLED = 7
const CURL_FORMADD_LAST = 8
# end
@ctypedef CURLFORMcode Int32
@ctypedef curl_formget_callback Ptr{Void}
type curl_slist
@ctypedef curl_formget_callback Ptr{Cvoid}
mutable struct curl_slist
data::Ptr{UInt8}
next::Ptr{Void}
next::Ptr{Cvoid}
end
type curl_certinfo
mutable struct curl_certinfo
num_of_certs::Int32
certinfo::Ptr{Ptr{Void}}
certinfo::Ptr{Ptr{Cvoid}}
end
# enum CURLINFO
const CURLINFO_NONE = 0
Expand Down Expand Up @@ -619,8 +619,8 @@ const CURL_LOCK_ACCESS_SINGLE = 2
const CURL_LOCK_ACCESS_LAST = 3
# end
@ctypedef curl_lock_access Int32
@ctypedef curl_lock_function Ptr{Void}
@ctypedef curl_unlock_function Ptr{Void}
@ctypedef curl_lock_function Ptr{Cvoid}
@ctypedef curl_unlock_function Ptr{Cvoid}
@ctypedef CURLSH Union{}
# enum CURLSHcode
const CURLSHE_OK = 0
Expand Down Expand Up @@ -650,7 +650,7 @@ const CURLVERSION_FOURTH = 3
const CURLVERSION_LAST = 4
# end
@ctypedef CURLversion Int32
type curl_version_info_data
mutable struct curl_version_info_data
age::CURLversion
version::Ptr{UInt8}
version_num::UInt32
Expand Down Expand Up @@ -685,13 +685,13 @@ const CURLMSG_DONE = 1
const CURLMSG_LAST = 2
# end
@ctypedef CURLMSG Int32
type CURLMsg
mutable struct CURLMsg
msg::CURLMSG
easy_handle::Ptr{CURL}
data::Void
data::Cvoid
end
@ctypedef curl_socket_callback Ptr{Void}
@ctypedef curl_multi_timer_callback Ptr{Void}
@ctypedef curl_socket_callback Ptr{Cvoid}
@ctypedef curl_multi_timer_callback Ptr{Cvoid}
# enum CURLMoption
const CURLMOPT_SOCKETFUNCTION = 20001
const CURLMOPT_SOCKETDATA = 10002
Expand Down
Loading

0 comments on commit e9a6322

Please sign in to comment.