1
- using Compat
2
- using Compat. Sys: isapple, islinux, iswindows
1
+ using BinaryProvider # requires BinaryProvider 0.3.0 or later
2
+ if VERSION < v " 0.7.0-DEV.1760"
3
+ # No need to build or download anything; openspecfun is part of Julia
4
+ else
5
+ const forcecompile = get (ENV , " JULIA_SPECIALFUNCTIONS_BUILD_SOURCE" , " false" ) == " true"
3
6
4
- if VERSION >= v " 0.7.0-DEV.3382"
5
- using Libdl
6
- end
7
+ # Parse some basic command-line arguments
8
+ const verbose = " --verbose" in ARGS
9
+ const prefix = Prefix (get ([a for a in ARGS if a != " --verbos" ], 1 , joinpath (@__DIR__ , " usr" )))
10
+ products = [
11
+ LibraryProduct (prefix, String[" libopenspecfun" ], :openspecfun ),
12
+ ]
7
13
8
- did_setup = false
14
+ # Download binaries from hosted location
15
+ bin_prefix = " https://github.com/JuliaMath/OpenspecfunBuilder/releases/download/v0.5.3-1"
9
16
10
- if VERSION < v " 0.7.0-DEV.1760"
11
- # No need to build or download anything; openspecfun is part of Julia
12
- elseif get (ENV , " JULIA_SPECIALFUNCTIONS_BUILD_SOURCE" , " false" ) == " true"
13
- # Allow a fast-path for building from source
14
- info (" Building openspecfun from source by request" )
15
- include (" scratch.jl" )
16
- elseif isapple () || iswindows ()
17
- # Windows and macOS can always use our binaries, and we have no binaries
18
- # for other non-Linux systems (e.g. BSDs)
19
- include (" binaries.jl" )
20
- elseif ! islinux ()
21
- include (" scratch.jl" )
22
- else # linux
23
- # Determine the glibc version. If the check fails, we know we're on a non-glibc
24
- # system, which means we can't use the binaries and need to build from source.
25
- # The glibc version used by the binaries is 2.6, so we need at least that.
26
- libc_ptr = ccall (:jl_dlopen , Ptr{Cvoid}, (Ptr{Cvoid}, UInt32), C_NULL , 0 )
27
- glibc_ptr = Libdl. dlsym_e (libc_ptr, :gnu_get_libc_version )
28
- if glibc_ptr == C_NULL
17
+ # Listing of files generated by BinaryBuilder:
18
+ download_info = Dict (
19
+ Linux (:aarch64 , :glibc ) => (" $bin_prefix /libopenspecfun.aarch64-linux-gnu.tar.gz" , " 513cd981b1465b92942955369a41c8b65ce6e39ea15d39dda40aa0ecce348581" ),
20
+ Linux (:aarch64 , :musl ) => (" $bin_prefix /libopenspecfun.aarch64-linux-musl.tar.gz" , " 11928ed68eaa3a97d2f59be36d21cff5a8e83decfbbef7b6422775735684abf8" ),
21
+ Linux (:armv7l , :glibc , :eabihf ) => (" $bin_prefix /libopenspecfun.arm-linux-gnueabihf.tar.gz" , " 5bc5f2f57b4faaed1124b59dd565f67164390ea668d0a35cc58e5dbb7256b883" ),
22
+ Linux (:armv7l , :musl , :eabihf ) => (" $bin_prefix /libopenspecfun.arm-linux-musleabihf.tar.gz" , " 5d396b66de7200248ecb156e7926d2460b5e06800202a3e181d778665aa8c4cc" ),
23
+ Linux (:i686 , :glibc ) => (" $bin_prefix /libopenspecfun.i686-linux-gnu.tar.gz" , " e407cab2ceac07680031a710b371e72d0f8ddb95a165969f78a1726e1aa3754e" ),
24
+ Linux (:i686 , :musl ) => (" $bin_prefix /libopenspecfun.i686-linux-musl.tar.gz" , " 87f7419160c299f74c8cd8ef01102adde151824cda569ce5abef3b651ea6fb8e" ),
25
+ Windows (:i686 ) => (" $bin_prefix /libopenspecfun.i686-w64-mingw32.tar.gz" , " 308efa58c6af46eba2ef3a0a93c029dad8f203b84de2f1fee463ea61ac505935" ),
26
+ Linux (:powerpc64le , :glibc ) => (" $bin_prefix /libopenspecfun.powerpc64le-linux-gnu.tar.gz" , " 6360c407784151e469735018ad01959dba0ebfbb48537bc1ed3b078be1cd2b18" ),
27
+ MacOS (:x86_64 ) => (" $bin_prefix /libopenspecfun.x86_64-apple-darwin14.tar.gz" , " 88712e1a5faa31c633172716f0b27a749c018dc90eb012aa7f457e88a91a8838" ),
28
+ Linux (:x86_64 , :glibc ) => (" $bin_prefix /libopenspecfun.x86_64-linux-gnu.tar.gz" , " e1e8c04b164de3cd39dde3ad0a20ee87b7ca393cf41345c5f0db270fd680bed0" ),
29
+ Linux (:x86_64 , :musl ) => (" $bin_prefix /libopenspecfun.x86_64-linux-musl.tar.gz" , " 9b9d12e36226689ced304cdbdbf0041982a9c9a4ddd4a62fdd3b43b39f541a47" ),
30
+ FreeBSD (:x86_64 ) => (" $bin_prefix /libopenspecfun.x86_64-unknown-freebsd11.1.tar.gz" , " 9e1c31bf28dee3ac42d9d1f045a4abfcbd98edee3dc645858f6a70b32896022b" ),
31
+ Windows (:x86_64 ) => (" $bin_prefix /libopenspecfun.x86_64-w64-mingw32.tar.gz" , " 05ff98c239f34efe514922301f9d15d1081c8e26851ace91731db468b15f5b40" ),
32
+ )
33
+
34
+ # Install unsatisfied or updated dependencies:
35
+ unsatisfied = any (! satisfied (p; verbose= verbose) for p in products)
36
+ if haskey (download_info, platform_key ()) && ! forcecompile
37
+ url, tarball_hash = download_info[platform_key ()]
38
+ if ! isinstalled (url, tarball_hash; prefix= prefix)
39
+ # Download and install binaries
40
+ install (url, tarball_hash; prefix= prefix, force= true , verbose= verbose)
41
+ unsatisfied = any (! satisfied (p; verbose= verbose) for p in products)
42
+ end
43
+ end
44
+
45
+ if unsatisfied || forcecompile
29
46
include (" scratch.jl" )
30
47
else
31
- glibc_vers = unsafe_string (ccall (glibc_ptr, Ptr{UInt8}, ()))
32
- if isempty (glibc_vers) || VersionNumber (glibc_vers) < v " 2.6.0"
33
- include (" scratch.jl" )
34
- else
35
- include (" binaries.jl" )
36
- end
48
+ # Write out a deps.jl file that will contain mappings for our products
49
+ write_deps_file (joinpath (@__DIR__ , " deps.jl" ), products)
37
50
end
38
- end
51
+ end
0 commit comments