if VERSION >= v"1.3" && !haskey(ENV, "JULIA_CBC_LIBRARY_PATH")
    exit()  # Use Cbc_jll instead.
end

using BinaryProvider # requires BinaryProvider 0.3.0 or later

# 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 = [
    LibraryProduct(prefix, ["libCbcSolver"], :libcbcsolver),
    LibraryProduct(prefix, ["libCbc"], :libCbc),
]

## START-VERSION-UPDATE-BLOCK
# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaBinaryWrappers/Cbc_jll.jl/releases/download/Cbc-v2.10.3+3"
# Listing of files generated by BinaryBuilder:
download_info = Dict(
    Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-gnu-libgfortran3-cxx03.tar.gz", "9993d0480527baa39c83bb0cc81e891f5ef999217c01a0a7618253eb0c5f4430"),
    Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-gnu-libgfortran3-cxx11.tar.gz", "519fec1e69b74f1f700b6ca0cf1784fd92890e39b5f62bb42517a388046e8598"),
    Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-gnu-libgfortran4-cxx03.tar.gz", "afd4911e2b2b7271c05ac21405e0b422a00edcab625b058e85b218bbcdd48c35"),
    Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-gnu-libgfortran4-cxx11.tar.gz", "4e6010e93ebcc4bdc08ed65c94f75ed7d7990d46feb6aaa1a1d58f3b036a116d"),
    Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-gnu-libgfortran5-cxx03.tar.gz", "f3e8d51def4545bafeb4b15b9fae8bb5267026c7fdedd561b776cc8c98bb6ad6"),
    Linux(:aarch64, libc=:glibc, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-gnu-libgfortran5-cxx11.tar.gz", "f451bf8ccc77b34a8f494da64811af0f4ae00fd10e79d215e17c0037b14c5c49"),
    Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-musl-libgfortran3-cxx03.tar.gz", "a41c7961aa99a233d6779ad4ae5e9955f9d407f0b5c109c86a03d7e9d4ab724b"),
    Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-musl-libgfortran3-cxx11.tar.gz", "a54ed0ef44b2758dc087ef6444db37826be39a1bf608c7545599f85f8d2dab77"),
    Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-musl-libgfortran4-cxx03.tar.gz", "fa343ee27ac7a583aed4c9b63ea7bfaa564d4150ec5ded153d2d191338af7512"),
    Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-musl-libgfortran4-cxx11.tar.gz", "4d79c86e4870c36886a61ed48da7bd38d100473800d358f6db4d9551cfdb3fb0"),
    Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-musl-libgfortran5-cxx03.tar.gz", "16d4cc7c2e6d2dd54ed85b54416f7a50d331cc3bbc2cd72c116c871db6ba82a4"),
    Linux(:aarch64, libc=:musl, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.aarch64-linux-musl-libgfortran5-cxx11.tar.gz", "b441a8a6597304604715891088d615b9c8b44cbd454a7657a55a2ef68ee8e6f3"),
    Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-gnueabihf-libgfortran3-cxx03.tar.gz", "fe220a8ed47c26f6da3e765d252e07f96fff131b2b44d0d54f61b20b2d0984e0"),
    Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-gnueabihf-libgfortran3-cxx11.tar.gz", "3b7715877e07b9ed3d481989d37851f35fdea28372600f7c38a9b29b1f59c6a5"),
    Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-gnueabihf-libgfortran4-cxx03.tar.gz", "2bdfd75e483df6fcfa1431402d54e8a6927a94b3ed34c5145ba32702fed234ad"),
    Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-gnueabihf-libgfortran4-cxx11.tar.gz", "15ed9a74917673e3613c0230759227ba00555c083d13c9475b932b8ff0d41bda"),
    Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-gnueabihf-libgfortran5-cxx03.tar.gz", "3007bca5c492aa78a228f762e5ae2b0b01b85cecfeb79cb8301f961bf0142528"),
    Linux(:armv7l, libc=:glibc, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-gnueabihf-libgfortran5-cxx11.tar.gz", "d6673ccc34c017d1854b248a3508ef6bc01c096c1c5fcb9f0923e814ef66841f"),
    Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-musleabihf-libgfortran3-cxx03.tar.gz", "f6b7a800f226e90b16f9b60750ea5ab9591707e5022f64241a3f10916da28a40"),
    Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-musleabihf-libgfortran3-cxx11.tar.gz", "dba027aa3795bc05086c18d9cca61f25a72d4714cc080da3174ca6ff57e2fdfc"),
    Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-musleabihf-libgfortran4-cxx03.tar.gz", "c956b6311fe88cb210ee6accb017765cae2bdbadd541f153e0d18c045a4391bb"),
    Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-musleabihf-libgfortran4-cxx11.tar.gz", "d436e027db81669bfb30c919c88877c893190f62b3f80986a2c5d827d97aa759"),
    Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-musleabihf-libgfortran5-cxx03.tar.gz", "850070d2c0b1ff5a00d327c98e8391c56b7135b8f9e3a9ea93cc325e0ad31bc1"),
    Linux(:armv7l, libc=:musl, call_abi=:eabihf, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.armv7l-linux-musleabihf-libgfortran5-cxx11.tar.gz", "8818fbcb71d29826c2567414292792073c43bf61d942c5474271015fb7529ce9"),
    Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-gnu-libgfortran3-cxx03.tar.gz", "7c490f60c12e5ecb63fdc0239375b27fa0f67af4350ccbfa37aa2b7456f14b65"),
    Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-gnu-libgfortran3-cxx11.tar.gz", "25ebbf011b74f8212408abc1ef81364741fb8b06ad5265d83c956b5f5d951f6b"),
    Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-gnu-libgfortran4-cxx03.tar.gz", "b59f3855562278db9fec46c664a13926048ae4c8b2c96a1cc0b2d13f402aaca5"),
    Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-gnu-libgfortran4-cxx11.tar.gz", "19f8bc8bbf18855e031812393f1754ecde2709c867a60d39431962bc701f172a"),
    Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-gnu-libgfortran5-cxx03.tar.gz", "eae4234c625cdea9965ccefda39be6c404c9ce08205715a58dd6a9215bd19e9c"),
    Linux(:i686, libc=:glibc, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-gnu-libgfortran5-cxx11.tar.gz", "b0344c003b4c125c17adcba9d6422ba98435cc59f8899c73229aca4828451510"),
    Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-musl-libgfortran3-cxx03.tar.gz", "32a553bddc233640738060db86eb8f70f2f5fb5ab9528443dd192a6f46245cbe"),
    Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-musl-libgfortran3-cxx11.tar.gz", "4a9d91184bcbdd8866b977e343e667c4c97d1917219b5a856aa812416d4d31e4"),
    Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-musl-libgfortran4-cxx03.tar.gz", "7a1197aed7983fd35728019a0848cc88ac2853a55ee66d63662fd114a6f92707"),
    Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-musl-libgfortran4-cxx11.tar.gz", "cf7c121b3587c15c341018435bcf9837ad064999c94aa363feb4ee705805db0f"),
    Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-musl-libgfortran5-cxx03.tar.gz", "3136effb3a6d7c5540dd6e8c08dcfd3107876152287ae28495266f921fd52fc0"),
    Linux(:i686, libc=:musl, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-linux-musl-libgfortran5-cxx11.tar.gz", "7a5d86231e0632db5bb9a2b5e640b481a8724993e6d1188bee6c17f1aa945251"),
    Windows(:i686, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-w64-mingw32-libgfortran3-cxx03.tar.gz", "7b9edb5ae152ec2d13c1cd134240f57ff22037e8d97660c694a7563503a28a9e"),
    Windows(:i686, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-w64-mingw32-libgfortran3-cxx11.tar.gz", "c1df3b74ec7581099c91c72650b64710a0eb1b80c08bbce399a2422a9a437663"),
    Windows(:i686, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-w64-mingw32-libgfortran4-cxx03.tar.gz", "dfd74135a506c935d15e3fa3d385cb67909116cb2bae7d0c3c8759cd82d7e253"),
    Windows(:i686, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-w64-mingw32-libgfortran4-cxx11.tar.gz", "af9e1fbe8551c3ce64bab87b4a7eb24fd34734b16e0162526210217f6ed6ca0d"),
    Windows(:i686, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.i686-w64-mingw32-libgfortran5-cxx03.tar.gz", "ae3acb2281aadfab1a98e576431be461c2bfc9f7f6f30429602b124d3236c566"),
    Windows(:i686, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.i686-w64-mingw32-libgfortran5-cxx11.tar.gz", "37575ad61b0f6011ba9f278a0873b7114c72bf04ef6a25b45e93c8698af10eac"),
    MacOS(:x86_64, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-apple-darwin14-libgfortran3-cxx03.tar.gz", "8caf7f626903b215cd5017576b91794518b78f23707d71b18c8a3e09b5955bfa"),
    MacOS(:x86_64, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-apple-darwin14-libgfortran3-cxx11.tar.gz", "130640305462f015f53fbd19df145036978325e51afe33fc4aacb24018b3e67b"),
    MacOS(:x86_64, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-apple-darwin14-libgfortran4-cxx03.tar.gz", "8b8b963ffb6f807e971d13f9642217cf8acea66351c91fc201761da99c5937de"),
    MacOS(:x86_64, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-apple-darwin14-libgfortran4-cxx11.tar.gz", "541a82ec36fb37960cb69e96f39b3990b891d69d82c0bfec73ad11813f42e513"),
    MacOS(:x86_64, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-apple-darwin14-libgfortran5-cxx03.tar.gz", "4077078028e54d5676166f3df0f6a8b84932a485616ac70471c0ed8c1add0fe9"),
    MacOS(:x86_64, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-apple-darwin14-libgfortran5-cxx11.tar.gz", "0609b9f97b2d18201fa8b5a16fdb68bcb205f3d7ca7fabd80ca1713ff33f42e5"),
    Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-gnu-libgfortran3-cxx03.tar.gz", "ec3e297558d34ca965f890f87149781654a03d3661a6b706f1797f63dd0a8972"),
    Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-gnu-libgfortran3-cxx11.tar.gz", "98a9993f322960636d49acc8e2efe725ca3d2bd9c859a63ef8ee1fe41bdfd95f"),
    Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-gnu-libgfortran4-cxx03.tar.gz", "5941f82ddfff5434b4a8073a5aa22f516fa7ee7bf6ba12086dd04ef7c0002b78"),
    Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-gnu-libgfortran4-cxx11.tar.gz", "e93a7b1cfe402d203ecfe778197e0eca5c7b65c4e9cfda79fd0f7b9e809bcdc3"),
    Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-gnu-libgfortran5-cxx03.tar.gz", "0d195469189549016e4327e2bfda45f94475dfd7556c53f993840afe1972530b"),
    Linux(:x86_64, libc=:glibc, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-gnu-libgfortran5-cxx11.tar.gz", "d107978527ac8bc2b8f805d24fc0d057200f9de4fe4ffc5a2fd6a39af556c6f6"),
    Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-musl-libgfortran3-cxx03.tar.gz", "f82ce68ee9c90d56c9d86f75e95a45507cb0d94dea8c104260c7c841d252dd9d"),
    Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-musl-libgfortran3-cxx11.tar.gz", "377360fdf5f9db1b1b87aad3e2016532e4d04148e441d7106b95c8469b81f902"),
    Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-musl-libgfortran4-cxx03.tar.gz", "210fd8b6e217cb40c245b059a2034817407441c7cdf6d799bec57510f74ade5e"),
    Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-musl-libgfortran4-cxx11.tar.gz", "fcf9dd22539205e5f7836b4dd5ff7ca6280d1461fb42343a36beef58adb8ea59"),
    Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-musl-libgfortran5-cxx03.tar.gz", "929c0f39c1949a9cc1b9414036c97458820b63d304e4dd6dd9791fdef86b428b"),
    Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-linux-musl-libgfortran5-cxx11.tar.gz", "8f10d8fbc6dcbcd415420813942f782288523f10f9346d87d69cdbf87aeefc43"),
    Windows(:x86_64, compiler_abi=CompilerABI(:gcc4, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-w64-mingw32-libgfortran3-cxx03.tar.gz", "1331d7685eaa775e6b1006eb7130104c34c5179111c3a739c3720a282c90c762"),
    Windows(:x86_64, compiler_abi=CompilerABI(:gcc4, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-w64-mingw32-libgfortran3-cxx11.tar.gz", "5fd902eb049490fe6ec260761aa4599d372b94629a20e88ce3e4db8f81032ad8"),
    Windows(:x86_64, compiler_abi=CompilerABI(:gcc7, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-w64-mingw32-libgfortran4-cxx03.tar.gz", "a7948eb3b1b0ac8565d80eeec9f1be4b22d5efdf04f6a9b4568a098969db3dce"),
    Windows(:x86_64, compiler_abi=CompilerABI(:gcc7, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-w64-mingw32-libgfortran4-cxx11.tar.gz", "aafc41743c6d631b5f1863dd9f2f2d1f21b13464fc02736a33040a171c94d44a"),
    Windows(:x86_64, compiler_abi=CompilerABI(:gcc8, :cxx03)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-w64-mingw32-libgfortran5-cxx03.tar.gz", "a77665065620b11c36f621e4f5a2aa6211843ccceb010ae4fdb33b7a084604c8"),
    Windows(:x86_64, compiler_abi=CompilerABI(:gcc8, :cxx11)) => ("$bin_prefix/Cbc.v2.10.3.x86_64-w64-mingw32-libgfortran5-cxx11.tar.gz", "7dc140e2c4e2c93b486ed53e819f967f10a345d91483b44df05d1fd4e817ab58"),
)
## END-VERSION-UPDATE-BLOCK

# To fix gcc4 bug in Windows
# https://sourceforge.net/p/mingw-w64/bugs/727/
this_platform = platform_key_abi()
if typeof(this_platform)==Windows && this_platform.compiler_abi.gcc_version == :gcc4
   this_platform = Windows(arch(this_platform), libc=libc(this_platform), compiler_abi=CompilerABI(:gcc6))
end


# no dynamic dependencies until Pkg3 support for binaries
dependencies = [
#     "https://github.com/juan-pablo-vielma/CglBuilder/releases/download/v0.59.10-1/build_CglBuilder.v0.59.10.jl",
#     "https://github.com/JuliaOpt/ClpBuilder/releases/download/v1.16.11-1/build_ClpBuilder.v1.16.11.jl",
#     "https://github.com/juan-pablo-vielma/OsiBuilder/releases/download/v0.107.9-1/build_OsiBuilder.v0.107.9.jl",
#     "https://github.com/juan-pablo-vielma/CoinUtilsBuilder/releases/download/v2.10.14-1/build_CoinUtilsBuilder.v2.10.14.jl",
#     "https://github.com/juan-pablo-vielma/COINMumpsBuilder/releases/download/v1.6.0-1/build_COINMumpsBuilder.v1.6.0.jl",
#     "https://github.com/juan-pablo-vielma/COINMetisBuilder/releases/download/v1.3.5-1/build_COINMetisBuilder.v1.3.5.jl",
#     "https://github.com/juan-pablo-vielma/COINLapackBuilder/releases/download/v1.5.6-1/build_COINLapackBuilder.v1.5.6.jl",
#     "https://github.com/juan-pablo-vielma/COINBLASBuilder/releases/download/v1.4.6-1/build_COINBLASBuilder.v1.4.6.jl",
#     "https://github.com/juan-pablo-vielma/ASLBuilder/releases/download/v3.1.0-1/build_ASLBuilder.v3.1.0.jl"
]

custom_library = false
if haskey(ENV,"JULIA_CBC_LIBRARY_PATH")
    custom_products = [LibraryProduct(ENV["JULIA_CBC_LIBRARY_PATH"],product.libnames,product.variable_name) for product in products]
    if all(satisfied(p; verbose=verbose) for p in custom_products)
        products = custom_products
        custom_library = true
    else
        error("Could not install custom libraries from $(ENV["JULIA_CBC_LIBRARY_PATH"]).\nTo fall back to BinaryProvider call delete!(ENV,\"JULIA_CBC_LIBRARY_PATH\") and run build again.")
    end
end

if !custom_library
    # Install unsatisfied or updated dependencies:
    # We added `, isolate=true` as otherwise, it would segfault when closing `OpenBLAS32`,
    # probably because it is conflicting with Julia openblas.
    unsatisfied = any(!satisfied(p; verbose=verbose, isolate=true) for p in products)

    dl_info = choose_download(download_info, this_platform)
    if dl_info === nothing && unsatisfied
        # If we don't have a compatible .tar.gz to download, complain.
        # Alternatively, you could attempt to install from a separate provider,
        # build from source or something even more ambitious here.
        error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!")
    end

    # If we have a download, and we are unsatisfied (or the version we're
    # trying to install is not itself installed) then load it up!
    if unsatisfied || !isinstalled(dl_info...; prefix=prefix)
        # Download and install binaries
        # no dynamic dependencies until Pkg3 support for binaries
        # for dependency in reverse(dependencies)          # We do not check for already installed dependencies
        #    download(dependency,basename(dependency))
        #    evalfile(basename(dependency))
        # end
        evalfile("build_CompilerSupportLibraries.v0.3.3.jl")
        evalfile("build_OpenBLAS32.v0.3.9.jl")
        evalfile("build_CoinUtils.v2.11.3.jl")
        evalfile("build_Osi.v0.108.5.jl")
        evalfile("build_Clp.v1.17.6.jl")
        evalfile("build_Cgl.v0.60.2.jl")
        install(dl_info...; prefix=prefix, force=true, verbose=verbose)
    end
 end

# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)
