Skip to content

Commit

Permalink
Merge pull request #55 from JuliaStats/anj/binary
Browse files Browse the repository at this point in the history
Switch to BinaryProvider
  • Loading branch information
andreasnoack authored Jun 13, 2018
2 parents c649f42 + dc782ac commit f18fc9b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 46 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
julia 0.6
BinDeps 0.6.0
BinaryProvider 0.3.2
Compat 0.48.0
89 changes: 44 additions & 45 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
if Sys.KERNEL === :Darwin && (!success(`command -v xcode-select`) || isempty(readchomp(`xcode-select -p`)))
error("Building Rmath on macOS requires the Xcode command line tools to be installed.\n",
"You can install them from the command line using `xcode-select --install`.")
using BinaryProvider # requires BinaryProvider 0.3.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, String["libRmath"], :libRmath),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/staticfloat/RmathBuilder/releases/download/v0.2.0-1"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, :glibc) => ("$bin_prefix/libRmath.aarch64-linux-gnu.tar.gz", "53f070e19f2dc23c92a2e7ecaa4eb2d2d66d97e31cf9065f8ad93fb7f608254e"),
Linux(:aarch64, :musl) => ("$bin_prefix/libRmath.aarch64-linux-musl.tar.gz", "b5202bc8c8cd019b3139ab6c95a9e60a184752c641ef75bd705ea22fa1f496f2"),
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/libRmath.arm-linux-gnueabihf.tar.gz", "535d74c9664a1575d1e6c72f6384c6c5e330269a139f33cb57e8cb8b3fdf9e8d"),
Linux(:armv7l, :musl, :eabihf) => ("$bin_prefix/libRmath.arm-linux-musleabihf.tar.gz", "d1e8f042c3a1e108d4241e25979182bb75c58eff46367da795394098fb7fa6ea"),
Linux(:i686, :glibc) => ("$bin_prefix/libRmath.i686-linux-gnu.tar.gz", "8ac9512567749d44bd5804913c049f09b36a65afee29d1433b170864d803d940"),
Linux(:i686, :musl) => ("$bin_prefix/libRmath.i686-linux-musl.tar.gz", "c07ce055a0016184142c215880b79de58ec73ab613a6a1f5a96b9cd89994b7ea"),
Windows(:i686) => ("$bin_prefix/libRmath.i686-w64-mingw32.tar.gz", "713ad202e6aa97b60f4ae0d0c1aa51a463a831ddb84a8bc0284dbc5c206c82be"),
Linux(:powerpc64le, :glibc) => ("$bin_prefix/libRmath.powerpc64le-linux-gnu.tar.gz", "cfff5005be3c7c8fff68aa79d2b4730f77a5478d72d1237a6d99e5c8b54e12f4"),
MacOS(:x86_64) => ("$bin_prefix/libRmath.x86_64-apple-darwin14.tar.gz", "75b5ed2208676eb05576622baac2c4d70c3bb0588ad3d562938eeed9fee7aaa4"),
Linux(:x86_64, :glibc) => ("$bin_prefix/libRmath.x86_64-linux-gnu.tar.gz", "e690b50e77a1a501a7f5c25a19b345dddc5447dcfeeaee9f3ae36dfc3d8540f4"),
Linux(:x86_64, :musl) => ("$bin_prefix/libRmath.x86_64-linux-musl.tar.gz", "e70f991ac8c5eccd5f5f38e79200c8203e43393c2ef525f717578f03c1353fe7"),
FreeBSD(:x86_64) => ("$bin_prefix/libRmath.x86_64-unknown-freebsd11.1.tar.gz", "36ceb06979183c8d89fd32e551d5aae8f879300a8ecb89ab209e17765c9c1c75"),
Windows(:x86_64) => ("$bin_prefix/libRmath.x86_64-w64-mingw32.tar.gz", "12929d34ec0fd3e29c0633410c08396b21989513fcd4d28ed845c3cabf316a19"),
)

# Install unsatisfied or updated dependencies:
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
if haskey(download_info, platform_key())
url, tarball_hash = download_info[platform_key()]
if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix)
# Download and install binaries
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
end
elseif unsatisfied
# If we don't have a BinaryProvider-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 $(triplet(platform_key())) is not supported by this package!")
end

using BinDeps, Compat.Libdl

@BinDeps.setup

function validate_Rmath(name,handle)
f = Libdl.dlsym_e(handle, "unif_rand_ptr")
return f != C_NULL
end

libRmath = library_dependency("libRmathjulia", aliases=["libRmath-julia"], validate = validate_Rmath)
version = "0.2.0"
# Best practice to use a fixed version here, either a version number tag or a git sha
# Please don't download "latest master" because the version that works today might not work tomorrow

provides(Sources, URI("https://github.com/JuliaLang/Rmath-julia/archive/v$version.tar.gz"),
[libRmath], unpacked_dir="Rmath-julia-$version")

prefix = joinpath(BinDeps.depsdir(libRmath), "usr")
srcdir = joinpath(BinDeps.srcdir(libRmath), "Rmath-julia-$version")


provides(Binaries,
URI("https://github.com/JuliaLang/Rmath-julia/releases/download/v$version/libRmath-julia-win-$(Sys.ARCH)-v$version.zip"),
[libRmath], unpacked_dir=".",
SHA = Sys.ARCH == :i686 ? "955bc52329bb9240d71cf31e9eca3ece5ee4bca5d32605de68a6e10d9e91010e" :
"87e46273e503a9c5b65cf8d920006cb0771d24e38a1c2181e91c84a07cd27f58" ,
os = :Windows)



provides(SimpleBuild,
(@build_steps begin
GetSources(libRmath)
CreateDirectory(joinpath(prefix, "lib"))
@build_steps begin
ChangeDirectory(srcdir)
MAKE_CMD
`mv src/libRmath-julia.$(Libdl.dlext) "$prefix/lib"`
end
end), [libRmath], os = :Unix)

@BinDeps.install Dict(:libRmathjulia => :libRmath)
# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)

0 comments on commit f18fc9b

Please sign in to comment.