Skip to content

Commit

Permalink
Change to use BinaryProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottPJones committed May 7, 2018
1 parent 3ac2633 commit 437e202
Show file tree
Hide file tree
Showing 6 changed files with 497 additions and 368 deletions.
2 changes: 2 additions & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
julia 0.6
BinaryProvider

43 changes: 43 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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, String["libpcre2-8"], :libpcre2_8),
LibraryProduct(prefix, String["libpcre2-16"], :libpcre2_16),
LibraryProduct(prefix, String["libpcre2-32"], :libpcre2_32),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaString/PCRE2Builder/releases/download/v0.1.3"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, :glibc) => ("$bin_prefix/PCRE2Builder.aarch64-linux-gnu.tar.gz", "46ad38baf0a3e310741c40fa4849f21161c978228ae0263bb36888bb50254793"),
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/PCRE2Builder.arm-linux-gnueabihf.tar.gz", "1997d02ee9cf659045889c1f97ae2a4307303629af11083b44ee7ec2b036c826"),
Linux(:i686, :glibc) => ("$bin_prefix/PCRE2Builder.i686-linux-gnu.tar.gz", "8584ea430b863632583237a09529abe762c0c3c2f9954f2c67ca65a6a61e46d6"),
Windows(:i686) => ("$bin_prefix/PCRE2Builder.i686-w64-mingw32.tar.gz", "308ccd9c6e5b6002395b7992796bdf78971301d46d01a4c1a65d79c3f19374cc"),
Linux(:powerpc64le, :glibc) => ("$bin_prefix/PCRE2Builder.powerpc64le-linux-gnu.tar.gz", "898c121f31aaefc7050dd433350e9685ec936109358250e477620d43e737979c"),
MacOS(:x86_64) => ("$bin_prefix/PCRE2Builder.x86_64-apple-darwin14.tar.gz", "ff05083d6b438cb2f642e21ae1b1c29d47ea78f7c41c93429ef6240eb8099d80"),
Linux(:x86_64, :glibc) => ("$bin_prefix/PCRE2Builder.x86_64-linux-gnu.tar.gz", "84449db456972b15ac27fe134525da25000f8a554ac95466ddd67e8bb320fc9f"),
Windows(:x86_64) => ("$bin_prefix/PCRE2Builder.x86_64-w64-mingw32.tar.gz", "a1730b682e0b463f74dc3fa8c30f90d775224349dbe5601096d8d69a5e962655"),
)

# Install unsatisfied or updated dependencies:
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
if haskey(download_info, platform_key())
url, tarball_hash = download_info[platform_key()]
if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix)
# Download and install binaries
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
end
elseif unsatisfied
# 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 even more ambitious here.
error("Your platform $(triplet(platform_key())) is not supported by this package!")
end

# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
52 changes: 52 additions & 0 deletions deps/build.jl~
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using BinaryProvider

# 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")))

# These are the two binary objects we care about
products = Product[
LibraryProduct(prefix, "libpcre2-8", :libpcre2_8),
LibraryProduct(prefix, "libpcre2-16", :libpcre2_16),
LibraryProduct(prefix, "libpcre2-32", :libpcre2_32),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/staticfloat/small_bin/raw/74b7fd81e3fbc8963b14b0ebbe5421e270d8bdcf"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:i686, :glibc) => ("$bin_prefix/libfoo.i686-linux-gnu.tar.gz", "1398353bcbbd88338189ece9c1d6e7c508df120bc4f93afbaed362a9f91358ff"),
Linux(:x86_64, :glibc) => ("$bin_prefix/libfoo.x86_64-linux-gnu.tar.gz", "b9d57a6e032a56b1f8641771fa707523caa72f1a2e322ab99eeeb011f13ad9f3"),
Linux(:aarch64, :glibc) => ("$bin_prefix/libfoo.aarch64-linux-gnu.tar.gz", "19d9da0e6e7fb506bf4889eb91e936fda43493a39cd4fd7bd5d65506cede6f95"),
Linux(:armv7l, :glibc) => ("$bin_prefix/libfoo.arm-linux-gnueabihf.tar.gz", "8e33c1a0e091e6e5b8fcb902e5d45329791bb57763ee9cbcde49c1ec9bd8532a"),
Linux(:powerpc64le, :glibc) => ("$bin_prefix/libfoo.powerpc64le-linux-gnu.tar.gz", "b48a64d48be994ec99b1a9fb60e0af7f4415a57596518cb90a340987b79fad81"),
MacOS() => ("$bin_prefix/libfoo.x86_64-apple-darwin14.tar.gz", "661b71edb433ab334b0fef70db3b5c45d35f2b3bee0d244f54875f1ec899c10f"),
Windows(:i686) => ("$bin_prefix/libfoo.i686-w64-mingw32.tar.gz", "3d4a8d4bf0169007a42d809a1d560083635b1540a1bc4a42108841dcb6d2aaea"),
Windows(:x86_64) => ("$bin_prefix/libfoo.x86_64-w64-mingw32.tar.gz", "2d08fbc9a534cd021f36b6bbe86ddabb2dafbedeb589581240aa4a8c5b896055"),
)
# First, check to see if we're all satisfied
if any(!satisfied(p; verbose=verbose) for p in products)
if platform_key() in keys(download_info)
# Download and install binaries
url, tarball_hash = download_info[platform_key()]
install(url, tarball_hash; prefix=prefix, force=true, verbose=true)
else
error("Your platform $(Sys.MACHINE) is not supported by this package!")
end

# Finally, write out a deps.jl file
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
end
© 2018 GitHub, Inc.
Terms
Privacy
Security
Status
Help
Contact GitHub
API
Training
Shop
Blog
About
Loading

0 comments on commit 437e202

Please sign in to comment.