Skip to content

Commit 652678c

Browse files
authored
Merge pull request #63 from stevengj/jq/bindeps2
Replace BinDeps w/ BinaryProvider
2 parents 90def97 + e43d494 commit 652678c

File tree

3 files changed

+39
-35
lines changed

3 files changed

+39
-35
lines changed

Diff for: REQUIRE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
julia 0.6
22
Compat 0.53.0
3-
BinDeps
3+
BinaryProvider

Diff for: deps/build.jl

+32-33
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
1-
using BinDeps, Compat.Libdl
1+
using BinaryProvider
22

3-
vers = "20U1"
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 = Product[
7+
LibraryProduct(prefix, String["libbid"], :libbid),
8+
]
49

5-
url="https://bintray.com/artifact/download/julialang/generic/"
6-
tagfile = "installed_vers"
7-
target = "libbid$(Sys.WORD_SIZE).$(Libdl.dlext)"
8-
if !isfile(tagfile) || !isfile(target) || readchomp(tagfile) != "$vers:$(Sys.WORD_SIZE)"
9-
if Sys.KERNEL == :NT
10-
# binary for Windows was cross-compiled with mingw using:
11-
# 32-bit: CC_NAME_INDEX=3 CC_INDEX=3 _HOST_OS=Windows_NT _HOST_ARCH=x86 _NUM_CPUS=1 CC=i686-w64-mingw32-gcc CFLAGS_OPT="-O2 -DBID_THREAD= -DBID_MS_FLAGS" CALL_BY_REF=0 GLOBAL_RND=1 GLOBAL_FLAGS=1 UNCHANGED_BINARY_FLAGS=1
12-
# 64-bit: CC_NAME_INDEX=3 CC_INDEX=3 _HOST_OS=Windows_NT _HOST_ARCH=x86_64 _NUM_CPUS=1 CC=x86_64-w64-mingw32-gcc CFLAGS_OPT="-O2 -DBID_THREAD= -DBID_MS_FLAGS" CALL_BY_REF=0 GLOBAL_RND=1 GLOBAL_FLAGS=1 UNCHANGED_BINARY_FLAGS=1
13-
# with the makefile.shared file:
14-
# include makefile
15-
# libbid.dll: $(ALL_BID_OBJS)
16-
# $(CC) -shared -o $@ $(ALL_BID_OBJS)
17-
run(download_cmd(url*"libbid$(Sys.WORD_SIZE)-$vers.dll", target))
18-
elseif Sys.KERNEL == :Darwin
19-
run(download_cmd(url*"libbid$(Sys.WORD_SIZE)-$vers.dylib", target))
10+
# Download binaries from hosted location
11+
bin_prefix = "https://github.com/quinnj/DecFPBuilder/releases/download/v0.4"
12+
13+
# Listing of files generated by BinaryBuilder:
14+
download_info = Dict(
15+
BinaryProvider.Linux(:i686, :glibc) => ("$bin_prefix/DecFP.i686-linux-gnu.tar.gz", "7a6f2460ffdf4f07a5b03246400a65f57f7d378490252af6b67f25da2df5b53d"),
16+
BinaryProvider.Windows(:i686) => ("$bin_prefix/DecFP.i686-w64-mingw32.tar.gz", "f7dbf57fce1450d1eaf891580491a1a982b8c3491b9e2aba7992d62da89d202d"),
17+
BinaryProvider.MacOS() => ("$bin_prefix/DecFP.x86_64-apple-darwin14.tar.gz", "b4fe9a370eb4b9bbe486c9a93a0aae0c1f1cca51e74d9b39bd7cdb0d9553e221"),
18+
BinaryProvider.Linux(:x86_64, :glibc) => ("$bin_prefix/DecFP.x86_64-linux-gnu.tar.gz", "ac336480e4c0200ff0d320e68f30feb40b2894105b5eaf49ae7b4ddf73078a67"),
19+
BinaryProvider.Windows(:x86_64) => ("$bin_prefix/DecFP.x86_64-w64-mingw32.tar.gz", "25eceff1f2b4d39042704f9a44a0295032d481d4240ec22e8000fc38ccf19be7"),
20+
)
21+
22+
# First, check to see if we're all satisfied
23+
if any(!satisfied(p; verbose=verbose) for p in products)
24+
if haskey(download_info, platform_key())
25+
# Download and install binaries
26+
url, tarball_hash = download_info[platform_key()]
27+
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
2028
else
21-
tarball = "IntelRDFPMathLib$vers.tar.gz"
22-
srcdir = "IntelRDFPMathLib$vers/LIBRARY"
23-
if !isfile(tarball)
24-
run(download_cmd(url*"$tarball", tarball))
25-
end
26-
run(unpack_cmd(tarball, ".", ".gz", ".tar"))
27-
cd(srcdir) do
28-
println("COMPILING LIBBID...")
29-
open("makefile.shared", "w") do f
30-
println(f, "include makefile\n\n../../$target: \$(ALL_BID_OBJS)\n\t\$(CC) -shared -o \$@ \$(ALL_BID_OBJS)\n")
31-
end
32-
run(`make -f makefile.shared CC=gcc CFLAGS_OPT="-O2 -fPIC" CALL_BY_REF=0 GLOBAL_RND=1 GLOBAL_FLAGS=1 UNCHANGED_BINARY_FLAGS=1 ../../$target`)
33-
end
34-
end
35-
open(tagfile, "w") do f
36-
println(f, "$vers:$(Sys.WORD_SIZE)")
29+
# If we don't have a BinaryProvider-compatible .tar.gz to download, complain.
30+
# Alternatively, you could attempt to install from a separate provider,
31+
# build from source or something more even more ambitious here.
32+
error("Your platform $(Sys.MACHINE) is not supported by this package!")
3733
end
3834
end
35+
36+
# Write out a deps.jl file that will contain mappings for our products
37+
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)

Diff for: src/DecFP.jl

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ end
2222

2323
export Dec32, Dec64, Dec128, @d_str, @d32_str, @d64_str, @d128_str
2424

25-
const libbid = joinpath(dirname(@__FILE__), "..", "deps", "libbid$(Sys.WORD_SIZE)")
25+
# Load libbid from our deps.jl
26+
const depsjl_path = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")
27+
if !isfile(depsjl_path)
28+
error("DecFP not installed properly, run Pkg.build(\"DecFP\"), restart Julia and try again")
29+
end
30+
include(depsjl_path)
2631

2732
const _buffer = fill(0x00, 1024)
2833

0 commit comments

Comments
 (0)