-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from stevengj/jq/bindeps2
Replace BinDeps w/ BinaryProvider
- Loading branch information
Showing
3 changed files
with
39 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
julia 0.6 | ||
Compat 0.53.0 | ||
BinDeps | ||
BinaryProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,37 @@ | ||
using BinDeps, Compat.Libdl | ||
using BinaryProvider | ||
|
||
vers = "20U1" | ||
# 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 = Product[ | ||
LibraryProduct(prefix, String["libbid"], :libbid), | ||
] | ||
|
||
url="https://bintray.com/artifact/download/julialang/generic/" | ||
tagfile = "installed_vers" | ||
target = "libbid$(Sys.WORD_SIZE).$(Libdl.dlext)" | ||
if !isfile(tagfile) || !isfile(target) || readchomp(tagfile) != "$vers:$(Sys.WORD_SIZE)" | ||
if Sys.KERNEL == :NT | ||
# binary for Windows was cross-compiled with mingw using: | ||
# 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 | ||
# 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 | ||
# with the makefile.shared file: | ||
# include makefile | ||
# libbid.dll: $(ALL_BID_OBJS) | ||
# $(CC) -shared -o $@ $(ALL_BID_OBJS) | ||
run(download_cmd(url*"libbid$(Sys.WORD_SIZE)-$vers.dll", target)) | ||
elseif Sys.KERNEL == :Darwin | ||
run(download_cmd(url*"libbid$(Sys.WORD_SIZE)-$vers.dylib", target)) | ||
# Download binaries from hosted location | ||
bin_prefix = "https://github.com/quinnj/DecFPBuilder/releases/download/v0.4" | ||
|
||
# Listing of files generated by BinaryBuilder: | ||
download_info = Dict( | ||
BinaryProvider.Linux(:i686, :glibc) => ("$bin_prefix/DecFP.i686-linux-gnu.tar.gz", "7a6f2460ffdf4f07a5b03246400a65f57f7d378490252af6b67f25da2df5b53d"), | ||
BinaryProvider.Windows(:i686) => ("$bin_prefix/DecFP.i686-w64-mingw32.tar.gz", "f7dbf57fce1450d1eaf891580491a1a982b8c3491b9e2aba7992d62da89d202d"), | ||
BinaryProvider.MacOS() => ("$bin_prefix/DecFP.x86_64-apple-darwin14.tar.gz", "b4fe9a370eb4b9bbe486c9a93a0aae0c1f1cca51e74d9b39bd7cdb0d9553e221"), | ||
BinaryProvider.Linux(:x86_64, :glibc) => ("$bin_prefix/DecFP.x86_64-linux-gnu.tar.gz", "ac336480e4c0200ff0d320e68f30feb40b2894105b5eaf49ae7b4ddf73078a67"), | ||
BinaryProvider.Windows(:x86_64) => ("$bin_prefix/DecFP.x86_64-w64-mingw32.tar.gz", "25eceff1f2b4d39042704f9a44a0295032d481d4240ec22e8000fc38ccf19be7"), | ||
) | ||
|
||
# First, check to see if we're all satisfied | ||
if any(!satisfied(p; verbose=verbose) for p in products) | ||
if haskey(download_info, platform_key()) | ||
# Download and install binaries | ||
url, tarball_hash = download_info[platform_key()] | ||
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose) | ||
else | ||
tarball = "IntelRDFPMathLib$vers.tar.gz" | ||
srcdir = "IntelRDFPMathLib$vers/LIBRARY" | ||
if !isfile(tarball) | ||
run(download_cmd(url*"$tarball", tarball)) | ||
end | ||
run(unpack_cmd(tarball, ".", ".gz", ".tar")) | ||
cd(srcdir) do | ||
println("COMPILING LIBBID...") | ||
open("makefile.shared", "w") do f | ||
println(f, "include makefile\n\n../../$target: \$(ALL_BID_OBJS)\n\t\$(CC) -shared -o \$@ \$(ALL_BID_OBJS)\n") | ||
end | ||
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`) | ||
end | ||
end | ||
open(tagfile, "w") do f | ||
println(f, "$vers:$(Sys.WORD_SIZE)") | ||
# 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 more even more ambitious here. | ||
error("Your platform $(Sys.MACHINE) is not supported by this package!") | ||
end | ||
end | ||
|
||
# Write out a deps.jl file that will contain mappings for our products | ||
write_deps_file(joinpath(@__DIR__, "deps.jl"), products) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters