Skip to content

Commit f3ad74e

Browse files
visryeesian
authored andcommitted
use BinaryProvider (#47)
* add .gitignore * use BinaryProvider Which gets the binaries from https://github.com/visr/GEOSBuilder * GEOSBuilder transferred from visr to JuliaGeo
1 parent db97d3a commit f3ad74e

File tree

5 files changed

+46
-40
lines changed

5 files changed

+46
-40
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.jl.cov
2+
*.jl.*.cov
3+
*.jl.mem
4+
deps/deps.jl
5+
deps/usr

REQUIRE

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
julia 0.6
22
GeoInterface 0.2.1
3-
BinDeps
4-
@osx Homebrew
5-
@windows WinRPM
3+
BinaryProvider 0.2.5

deps/.gitignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

deps/build.jl

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
1-
using BinDeps
2-
@BinDeps.setup
1+
using BinaryProvider
32

4-
libgeos = library_dependency("libgeos",aliases=["libgeos_c", "libgeos_c-1"], validate = function(path, handle)
5-
return Libdl.dlsym_e(handle,:initGEOS) != C_NULL && Libdl.dlsym_e(handle,:GEOSDelaunayTriangulation) != C_NULL
6-
end)
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")))
76

8-
version = "3.6.1"
7+
products = Product[
8+
LibraryProduct(prefix, "libgeos_c", :libgeos),
9+
LibraryProduct(prefix, "libgeos", :libgeos_cpp)
10+
]
911

10-
provides(Sources, URI("http://download.osgeo.org/geos/geos-$(version).tar.bz2"), [libgeos], os = :Unix)
11-
provides(BuildProcess,Autotools(libtarget = "capi/.libs/libgeos_c."*Libdl.dlext),libgeos)
12-
# provides(AptGet,"libgeos-dev", libgeos)
13-
# TODO: provides(Yum,"libgeos-dev", libgeos)
14-
# TODO: provides(Pacman,"libgeos-dev", libgeos)
12+
# Download binaries from hosted location
13+
bin_prefix = "https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-0"
1514

16-
if is_windows()
17-
using WinRPM
18-
push!(WinRPM.sources, "http://download.opensuse.org/repositories/home:yeesian/openSUSE_Leap_42.2")
19-
WinRPM.update()
20-
provides(WinRPM.RPM, "libgeos", [libgeos], os = :Windows)
21-
end
15+
# Listing of files generated by BinaryBuilder:
16+
download_info = Dict(
17+
Linux(:i686, :glibc) => ("$bin_prefix/GEOS.i686-linux-gnu.tar.gz", "b8569ca5dd4a1aec464ae2eaec4247ea5a93f55bb843854cab09f06952c4fcd9"),
18+
Linux(:x86_64, :glibc) => ("$bin_prefix/GEOS.x86_64-linux-gnu.tar.gz", "a9f58321ff86ca05c87ec637cc6126ba5db313337491123b76b4ca7e7705223b"),
19+
Linux(:aarch64, :glibc) => ("$bin_prefix/GEOS.aarch64-linux-gnu.tar.gz", "c91616f06f03d64d9b7e06dd74b6056815e0e54e74a9af8288e4d0cd79929d6e"),
20+
Linux(:armv7l, :glibc) => ("$bin_prefix/GEOS.arm-linux-gnueabihf.tar.gz", "5ab9b9b92319daf7c08db63e711fea5724946c973a38307b33f61b49a8e93531"),
21+
Linux(:powerpc64le, :glibc) => ("$bin_prefix/GEOS.powerpc64le-linux-gnu.tar.gz", "e24c68a8e5cd517fae4ca089bd66ee2081aef5e1b492fc0835accdc112995ad6"),
22+
MacOS() => ("$bin_prefix/GEOS.x86_64-apple-darwin14.tar.gz", "017c593d91806578538d8dbdeefa9f2b88700e06c32cc07be52cdbe78f55390d"),
23+
Windows(:i686) => ("$bin_prefix/GEOS.i686-w64-mingw32.tar.gz", "f3fa4db98b50821db2b7209de76b0ac31d4d87c4d9bbbab60a6adb5f19ca0155"),
24+
Windows(:x86_64) => ("$bin_prefix/GEOS.x86_64-w64-mingw32.tar.gz", "9e8cba2c107884d1380bd6e5a6fce1003b6fa50be59e689b0a9bbe014d46d3ac"),
25+
)
2226

23-
if is_apple()
24-
if Pkg.installed("Homebrew") === nothing
25-
error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
27+
# First, check to see if we're all satisfied
28+
if any(!satisfied(p; verbose=verbose) for p in products)
29+
if platform_key() in keys(download_info)
30+
# Download and install binaries
31+
url, tarball_hash = download_info[platform_key()]
32+
install(url, tarball_hash; prefix=prefix, force=true, verbose=true)
33+
else
34+
error("Your platform $(Sys.MACHINE) is not supported by this package!")
2635
end
27-
using Homebrew
28-
provides(Homebrew.HB, "geos", libgeos, os = :Darwin)
29-
end
3036

31-
@BinDeps.install Dict(:libgeos => :libgeos)
37+
# Finally, write out a deps.jl file
38+
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
39+
end

src/LibGEOS.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ __precompile__()
22

33
module LibGEOS
44

5-
if isfile(joinpath(dirname(@__FILE__),"..","deps","deps.jl"))
6-
include("../deps/deps.jl")
7-
else
8-
error("LibGEOS not properly installed. Please run Pkg.build(\"LibGEOS\")")
5+
# Load in `deps.jl`, complaining if it does not exist
6+
const depsjl_path = joinpath(@__DIR__, "..", "deps", "deps.jl")
7+
if !isfile(depsjl_path)
8+
error("LibGEOS not installed properly, run Pkg.build(\"LibGEOS\"), restart Julia and try again")
99
end
10+
include(depsjl_path)
1011

1112
using GeoInterface
1213
import Base: contains
@@ -60,6 +61,9 @@ module LibGEOS
6061
end
6162

6263
function __init__()
64+
# Always check your dependencies from `deps.jl`
65+
check_deps()
66+
6367
global const _connection = GEOSconnection()
6468
end
6569

0 commit comments

Comments
 (0)