|
1 |
| -using BinDeps |
2 |
| -using Compat |
3 |
| - |
4 |
| -@BinDeps.setup |
5 |
| - |
6 |
| -ecos = library_dependency("ecos", aliases=["libecos"]) |
7 |
| - |
8 |
| -if Compat.Sys.isapple() |
9 |
| - using Homebrew |
10 |
| - provides( Homebrew.HB, "ecos", ecos, os = :Darwin ) |
| 1 | +using BinaryProvider # requires BinaryProvider 0.3.0 or later |
| 2 | + |
| 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 = [ |
| 7 | + LibraryProduct(prefix, String["libecos"], :ecos), |
| 8 | +] |
| 9 | + |
| 10 | +# Download binaries from hosted location |
| 11 | +bin_prefix = "https://github.com/juan-pablo-vielma/ECOSBuilder/releases/download/v2.0.5-beta" |
| 12 | + |
| 13 | +# Listing of files generated by BinaryBuilder: |
| 14 | +download_info = Dict( |
| 15 | + Linux(:aarch64, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.aarch64-linux-gnu.tar.gz", "9e6279a971889df14eaa384c8138136c5918e1a3a97e913d1a23fb3e80d711a6"), |
| 16 | + Linux(:aarch64, :musl) => ("$bin_prefix/ECOSBuilder.v2.0.5.aarch64-linux-musl.tar.gz", "afeb89f158dbcb506230e35e13ad63ab374a35f8b4ebe3ff4d1c604acb98e79f"), |
| 17 | + Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/ECOSBuilder.v2.0.5.arm-linux-gnueabihf.tar.gz", "2fd091c5581156acc1a135d7ad969563f4a356b2631b3d2f2e215c114960c98b"), |
| 18 | + Linux(:armv7l, :musl, :eabihf) => ("$bin_prefix/ECOSBuilder.v2.0.5.arm-linux-musleabihf.tar.gz", "776ceedd12467a761354e73641dba4c0e0b34df9e5635360880e0d7f4c347c64"), |
| 19 | + Linux(:i686, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.i686-linux-gnu.tar.gz", "2b622c881c0c0cb9a12f514a211512b8a0c2404c6e35f4817e0c590095a759aa"), |
| 20 | + Linux(:i686, :musl) => ("$bin_prefix/ECOSBuilder.v2.0.5.i686-linux-musl.tar.gz", "0318aafa7457e0d1cb9a85e0938498457341d0050036ac24ab05b8f2d0ea7d4f"), |
| 21 | + Windows(:i686) => ("$bin_prefix/ECOSBuilder.v2.0.5.i686-w64-mingw32.tar.gz", "2c5fba5caed62b5edc1199ebd62e702212197b916f6bab8f7ba30c2c16326117"), |
| 22 | + Linux(:powerpc64le, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.powerpc64le-linux-gnu.tar.gz", "9d75f00a0bd9ba2aa917f073cb9544f4fb74f0cd711eeb5b06ab13efe70cf16a"), |
| 23 | + MacOS(:x86_64) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-apple-darwin14.tar.gz", "617f20ee41dbbd34dd7f8cb4c8c5f84bf5e52646886880679d8c116de418fd29"), |
| 24 | + Linux(:x86_64, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-linux-gnu.tar.gz", "69ea265aab6701b9ce2b9c3b6d574bd88f1fd4640527a8d106385359abe88021"), |
| 25 | + Linux(:x86_64, :musl) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-linux-musl.tar.gz", "52f6c0f3742e316eb15d5180cfa41c6a7985104745f7ede0bf0577087af97384"), |
| 26 | + FreeBSD(:x86_64) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-unknown-freebsd11.1.tar.gz", "52f2167039d40115a92f428c81e81b3de000cece3756ea9bfcf12c07ef6bd9bc"), |
| 27 | + Windows(:x86_64) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-w64-mingw32.tar.gz", "f38e30147d12bb06eab3517c314444ffaedf13f252947cb458bd34cddb73e481"), |
| 28 | +) |
| 29 | + |
| 30 | +# Install unsatisfied or updated dependencies: |
| 31 | +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) |
| 32 | +if haskey(download_info, platform_key()) |
| 33 | + url, tarball_hash = download_info[platform_key()] |
| 34 | + # Check if this build.jl is providing new versions of the binaries, and |
| 35 | + # if so, ovewrite the current binaries even if they were installed by the user |
| 36 | + if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix) |
| 37 | + # Download and install binaries |
| 38 | + install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose) |
| 39 | + end |
| 40 | +elseif unsatisfied |
| 41 | + # If we don't have a BinaryProvider-compatible .tar.gz to download, complain. |
| 42 | + # Alternatively, you could attempt to install from a separate provider, |
| 43 | + # build from source or something even more ambitious here. |
| 44 | + error("Your platform $(triplet(platform_key())) is not supported by this package!") |
11 | 45 | end
|
12 | 46 |
|
13 |
| -version = "2.0.5" |
14 |
| -win_version = "2.0.2" |
15 |
| -provides(Sources, URI("https://github.com/ifa-ethz/ecos/archive/v$version.tar.gz"), |
16 |
| - [ecos], os = :Unix, unpacked_dir="ecos-$version") |
17 |
| - |
18 |
| -prefix = joinpath(BinDeps.depsdir(ecos),"usr") |
19 |
| -srcdir = joinpath(BinDeps.depsdir(ecos),"src","ecos-$version") |
20 |
| - |
21 |
| -provides(Binaries, URI("https://cache.julialang.org/https://bintray.com/artifact/download/tkelman/generic/ecos-$win_version.7z"), |
22 |
| - [ecos], unpacked_dir="usr/bin$(Sys.WORD_SIZE)", os = :Windows, |
23 |
| - SHA="b90254220a9a63cba08700f3664519d360f45d363454e5c107e6f30e144a60a1") |
24 |
| - |
25 |
| -# We'll keep this around for emergencies, but OSX users should be able to use Homebrew |
26 |
| -provides(SimpleBuild, |
27 |
| - (@build_steps begin |
28 |
| - GetSources(ecos) |
29 |
| - CreateDirectory(joinpath(prefix,"lib")) |
30 |
| - FileRule(joinpath(prefix,"lib","libecos.dylib"),@build_steps begin |
31 |
| - ChangeDirectory(srcdir) |
32 |
| - `make shared` |
33 |
| - `mv libecos.dylib $prefix/lib` |
34 |
| - end) |
35 |
| - end),[ecos], os = :Darwin) |
36 |
| - |
37 |
| -provides(SimpleBuild, |
38 |
| - (@build_steps begin |
39 |
| - GetSources(ecos) |
40 |
| - CreateDirectory(joinpath(prefix,"lib")) |
41 |
| - FileRule(joinpath(prefix,"lib","libecos.so"),@build_steps begin |
42 |
| - ChangeDirectory(srcdir) |
43 |
| - `make shared` |
44 |
| - `mv libecos.so $prefix/lib` |
45 |
| - end) |
46 |
| - end),[ecos], os = :Unix) |
47 |
| - |
48 |
| -@BinDeps.install Dict(:ecos => :ecos) |
| 47 | +# Write out a deps.jl file that will contain mappings for our products |
| 48 | +write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose) |
0 commit comments