Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve build logic to identify when to build from source
This ensures that: * We don't build or download anything unnecessarily on 0.6 * We can build from source upon request * We don't use binaries for non-glibc Linux * We don't use binaries for Linux with prehistoric glibc
- Loading branch information
Showing
4 changed files
with
96 additions
and
44 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using BinDeps, Compat | ||
using BinDeps: libdir | ||
|
||
modified_defaults = false | ||
if !in(BinDeps.Binaries, BinDeps.defaults) | ||
unshift!(BinDeps.defaults, BinDeps.Binaries) | ||
modified_defaults = true | ||
end | ||
|
||
BinDeps.@setup | ||
did_setup = true | ||
|
||
const OSF_VERS = v"0.5.3" | ||
|
||
openspecfun = library_dependency("libopenspecfun") | ||
|
||
const URL = "https://github.com/ararslan/openspecfun-builder/releases/download/v$OSF_VERS" * | ||
"/libopenspecfun-$OSF_VERS" | ||
|
||
const DOWNLOADS = Dict( | ||
"Linux-x86_64" => ("$URL-linux-x86_64.tar.gz", | ||
"d70a2a391915f64f44da21915bf93ce08d054127028088addca36e16ac53bcb1"), | ||
"Linux-i686" => ("$URL-linux-i686.tar.gz", | ||
"e5418b170b537af2f7f1f1d06eee9be01555404f5d22a47e18bc06a540321478"), | ||
"Darwin-x86_64" => ("$URL-osx-x86_64.tar.gz", | ||
"e57f5f84439757a2fd1d3821a6e19a3fa69b5b1e181cc40fec0d1652fbb9efdc"), | ||
"Windows-x86_64" => ("$URL-win-x86_64.zip", | ||
"7a5f7be4ed46d7f9d6d18a599157075512c50a372da2b2908079a3dcab9a0f25"), | ||
"Windows-i686" => ("$URL-win-i686.zip", | ||
"2f63a08d80e67964e2c368367f4caef7039080828e217d288669416cd46f4584"), | ||
) | ||
|
||
const SYSTEM = string(BinDeps.OSNAME, '-', Sys.ARCH) | ||
|
||
if haskey(DOWNLOADS, SYSTEM) | ||
url, sha = DOWNLOADS[SYSTEM] | ||
provides(Binaries, URI(url), openspecfun, SHA=sha, os=BinDeps.OSNAME, | ||
unpacked_dir=joinpath("usr", "lib"), installed_libpath=libdir(openspecfun)) | ||
else | ||
info("No precompiled binaries found for your system. Building from scratch...") | ||
include("scratch.jl") | ||
end | ||
|
||
BinDeps.@install Dict(:libopenspecfun => :openspecfun) | ||
|
||
if modified_defaults | ||
shift!(BinDeps.defaults) | ||
end |
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,47 +1,33 @@ | ||
using BinDeps, Compat | ||
using BinDeps: libdir, srcdir, includedir, depsdir, builddir | ||
using Compat | ||
using Compat.Sys: isapple, islinux, iswindows | ||
using Base.Libdl: dlopen_e, dlsym_e | ||
|
||
modified_defaults = false | ||
if !in(BinDeps.Binaries, BinDeps.defaults) | ||
unshift!(BinDeps.defaults, BinDeps.Binaries) | ||
modified_defaults = true | ||
end | ||
|
||
BinDeps.@setup | ||
|
||
const OSF_VERS = v"0.5.3" | ||
|
||
openspecfun = library_dependency("libopenspecfun") | ||
|
||
const URL = "https://github.com/ararslan/openspecfun-builder/releases/download/v$OSF_VERS" * | ||
"/libopenspecfun-$OSF_VERS" | ||
|
||
const DOWNLOADS = Dict( | ||
"Linux-x86_64" => ("$URL-linux-x86_64.tar.gz", | ||
"d70a2a391915f64f44da21915bf93ce08d054127028088addca36e16ac53bcb1"), | ||
"Linux-i686" => ("$URL-linux-i686.tar.gz", | ||
"e5418b170b537af2f7f1f1d06eee9be01555404f5d22a47e18bc06a540321478"), | ||
"Darwin-x86_64" => ("$URL-osx-x86_64.tar.gz", | ||
"e57f5f84439757a2fd1d3821a6e19a3fa69b5b1e181cc40fec0d1652fbb9efdc"), | ||
"Windows-x86_64" => ("$URL-win-x86_64.zip", | ||
"7a5f7be4ed46d7f9d6d18a599157075512c50a372da2b2908079a3dcab9a0f25"), | ||
"Windows-i686" => ("$URL-win-i686.zip", | ||
"2f63a08d80e67964e2c368367f4caef7039080828e217d288669416cd46f4584"), | ||
) | ||
did_setup = false | ||
|
||
const SYSTEM = string(BinDeps.OSNAME, '-', Sys.ARCH) | ||
|
||
if haskey(DOWNLOADS, SYSTEM) | ||
url, sha = DOWNLOADS[SYSTEM] | ||
provides(Binaries, URI(url), openspecfun, SHA=sha, os=BinDeps.OSNAME, | ||
unpacked_dir=joinpath("usr", "lib"), installed_libpath=libdir(openspecfun)) | ||
else | ||
info("No precompiled binaries found for your system. Building from scratch...") | ||
if VERSION < v"0.7.0-DEV.1760" | ||
# No need to build or download anything; openspecfun is part of Julia | ||
elseif get(ENV, "JULIA_SPECIALFUNCTIONS_BUILD_SOURCE", "false") == "true" | ||
# Allow a fast-path for building from source | ||
info("Building openspecfun from source by request") | ||
include("scratch.jl") | ||
end | ||
|
||
BinDeps.@install Dict(:libopenspecfun => :openspecfun) | ||
|
||
if modified_defaults | ||
shift!(BinDeps.defaults) | ||
elseif isapple() || iswindows() | ||
# Windows and macOS can always use our binaries, and we have no binaries | ||
# for other non-Linux systems (e.g. BSDs) | ||
include("binaries.jl") | ||
elseif !islinux() | ||
include("scratch.jl") | ||
else # linux | ||
# Determine the glibc version. If the check fails, we know we're on a non-glibc | ||
# system, which means we can't use the binaries and need to build from source. | ||
# The glibc version used by the binaries is 2.6, so we need at least that. | ||
if dlsym_e(dlopen_e("libc"), :gnu_get_libc_version) == C_NULL | ||
include("scratch.jl") | ||
else | ||
libc_vers = unsafe_string(ccall(:gnu_get_libc_version, Ptr{UInt8}, ())) | ||
if isempty(libc_vers) || VersionNumber(libc_vers) < v"2.6.0" | ||
include("scratch.jl") | ||
else | ||
include("binaries.jl") | ||
end | ||
end | ||
end |
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
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