|
1 | | -using BinDeps, Compat.Libdl |
| 1 | +using BinaryProvider |
2 | 2 |
|
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 | +] |
4 | 9 |
|
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.2" |
| 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", "d68af77c023250bf078f03b6ef9185643f0356bf56067b4f7824436f2d48c009"), |
| 16 | + BinaryProvider.Windows(:i686) => ("$bin_prefix/DecFP.i686-w64-mingw32.tar.gz", "714e7e675624bd141b8b2756c9eb75f560181d09c1c5517e7f6d72b1760cb8c1"), |
| 17 | + BinaryProvider.MacOS() => ("$bin_prefix/DecFP.x86_64-apple-darwin14.tar.gz", "c0aec2856ec01058592d43b05356b16e29e2809d34cba7d62713ec6870617e39"), |
| 18 | + BinaryProvider.Linux(:x86_64, :glibc) => ("$bin_prefix/DecFP.x86_64-linux-gnu.tar.gz", "291be1fce79d1bab7707ed90089634ba384590aecfdb82dc98cd4a09db550248"), |
| 19 | + BinaryProvider.Windows(:x86_64) => ("$bin_prefix/DecFP.x86_64-w64-mingw32.tar.gz", "9837259110f747c517b2b5066e81e3ef9d2e09aa4a35b2c7efe8e959a8aa73a4"), |
| 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) |
20 | 28 | 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!") |
37 | 33 | end |
38 | 34 | 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) |
0 commit comments