Skip to content

Commit

Permalink
Simplify build.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Jun 25, 2019
1 parent d1222a0 commit e6f8179
Showing 1 changed file with 12 additions and 55 deletions.
67 changes: 12 additions & 55 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,25 @@ using BinaryProvider # requires BinaryProvider 0.5.0 or later
# 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, ["libcurl"], :libcurl),
]
products = LibraryProduct[]

# Install BinaryBuilder dependencies
gh = "https://github.com"
dependencies = [
"$gh/JuliaWeb/MbedTLSBuilder/releases/download/v0.20.0/build_MbedTLS.v2.6.1.jl",
"$gh/bicycle1885/ZlibBuilder/releases/download/v1.0.4/build_Zlib.v1.2.11.jl",
"https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.4/build_Zlib.v1.2.11.jl",
"https://github.com/JuliaWeb/MbedTLSBuilder/releases/download/v0.20.0/build_MbedTLS.v2.6.1.jl",
"https://github.com/JuliaWeb/LibCURLBuilder/releases/download/v0.5.1/build_LibCURL.v7.64.1.jl",
]

for url in dependencies
build_file = joinpath(@__DIR__, basename(url))
if !isfile(build_file)
download(url, build_file)
end
end
for dependency in dependencies
file = joinpath(@__DIR__, basename(dependency))
isfile(file) || download(dependency, file)

# Execute the build scripts for the dependencies in an isolated module to avoid overwriting
# any variables/constants here
for url in dependencies
build_file = joinpath(@__DIR__, basename(url))
m = @eval module $(gensym()); include($build_file); end
# Build the dependencies
# Note: It is a bit faster to run the build in an anonymous module instead of starting a new
# julia process
m = @eval module Anon end
m.include(file)
append!(products, m.products)
end

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaWeb/LibCURLBuilder/releases/download/v0.5.1"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/LibCURL.v7.64.1.aarch64-linux-gnu.tar.gz", "c4d7ef4c0598d7e482db5757694b8b708bb73c8294586b74491eb6389131383f"),
Linux(:aarch64, libc=:musl) => ("$bin_prefix/LibCURL.v7.64.1.aarch64-linux-musl.tar.gz", "9bea71981b8b66f3f715160b8c10532ad169b2e3b3b75285aff7bbecc22d3381"),
Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/LibCURL.v7.64.1.arm-linux-gnueabihf.tar.gz", "b66e5adbf32f1e815b50f3c965a641a7cfbae1fd5e54facec3674ab6112f20aa"),
Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/LibCURL.v7.64.1.arm-linux-musleabihf.tar.gz", "0d386cf1f5bdb1999ab9dbdb591e86a4d4506998a40bd43b8258a361bbd150da"),
Linux(:i686, libc=:glibc) => ("$bin_prefix/LibCURL.v7.64.1.i686-linux-gnu.tar.gz", "033155190c155272beb6f14fc276930039e31a8518b326abaa2c523ae42860de"),
Linux(:i686, libc=:musl) => ("$bin_prefix/LibCURL.v7.64.1.i686-linux-musl.tar.gz", "a20451821e56c34815b6ce86cf30819b97cbe52a573b4e2711cae5db8a27d1fc"),
Windows(:i686) => ("$bin_prefix/LibCURL.v7.64.1.i686-w64-mingw32.tar.gz", "209883e6a4a31edb4c962346cf48d456306f769bb1afc69277471432b3895942"),
Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/LibCURL.v7.64.1.powerpc64le-linux-gnu.tar.gz", "52ca1f6b63d0859457b0a1e8edcbd5f0de970490fe60279d437eb9a6b119acb4"),
MacOS(:x86_64) => ("$bin_prefix/LibCURL.v7.64.1.x86_64-apple-darwin14.tar.gz", "b46ca5addcb23b4cc83dc9a15e0f7726d7f28bb31732e2efaa54a6d72e22226c"),
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/LibCURL.v7.64.1.x86_64-linux-gnu.tar.gz", "437a712b9c11d3e008420d338faf2154858378c772520e9911cba1c101b6f074"),
Linux(:x86_64, libc=:musl) => ("$bin_prefix/LibCURL.v7.64.1.x86_64-linux-musl.tar.gz", "ddec81444228cbcdd8f4f5ce4e86410bb0496d7946a4efed4e5b8118162a6cdd"),
FreeBSD(:x86_64) => ("$bin_prefix/LibCURL.v7.64.1.x86_64-unknown-freebsd11.1.tar.gz", "d79f0d372d1317faa11c73ae27323dde8d7c164fbc12726b6d74f73e78e38342"),
Windows(:x86_64) => ("$bin_prefix/LibCURL.v7.64.1.x86_64-w64-mingw32.tar.gz", "eec601ac5ae1e2aadf6c861ba196e4acc706dae15f05d54b88724ea3043bdc50"),
)

# 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.
error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!")
end

# 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)

0 comments on commit e6f8179

Please sign in to comment.