Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include binarybuilds from dependencies. #52

Merged
merged 3 commits into from
Jul 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
julia 0.6.3
BinaryProvider 0.3.0
CodecZlib 0.4.3
Proj4 0.3.0
LibGEOS 0.3.0
25 changes: 15 additions & 10 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
using BinaryProvider # requires BinaryProvider 0.3.0 or later

# Example taken from
# https://github.com/JuliaIO/ImageMagick.jl/blob/sd/binaryprovider/deps/build.jl
dependencies = [
"build_Zlib.v1.2.11.jl",
"build_GEOS.v3.6.2.jl",
"build_PROJ.v4.9.3.jl",
]

for elem in dependencies
# it's a bit faster to run the build in an anonymous module instead of
# starting a new julia process
m = Module(:__anon__)
Core.eval(m, :(Main.include($(joinpath(@__DIR__, elem)))))
end

# 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")))
Expand Down Expand Up @@ -42,15 +57,5 @@ elseif unsatisfied
error("Your platform $(triplet(platform_key())) is not supported by this package!")
end

# custom block, not auto generated by BinaryBuilder
# needed to do write_deps_file, which fails if libgdal cannot find its dependencies
import CodecZlib
import Proj4
import LibGEOS
Libdl.dlopen(CodecZlib.libz)
Libdl.dlopen(Proj4.libproj)
Libdl.dlopen(LibGEOS.libgeos_cpp)
Libdl.dlopen(LibGEOS.libgeos)

# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
42 changes: 42 additions & 0 deletions deps/build_GEOS.v3.6.2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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["libgeos_c"], :libgeos),
LibraryProduct(prefix, String["libgeos"], :libgeos_cpp),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-3"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, :glibc) => ("$bin_prefix/GEOS.v3.6.2.aarch64-linux-gnu.tar.gz", "f2a299a956db14855641635bd319b302220371a7fc121bb1f2231c9ed42983bc"),
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/GEOS.v3.6.2.arm-linux-gnueabihf.tar.gz", "a8da3b29d888a14fb2d3788df1bc6e763ba9047b10b4f1728a2f67bba0388f1c"),
Linux(:i686, :glibc) => ("$bin_prefix/GEOS.v3.6.2.i686-linux-gnu.tar.gz", "5d6c51199d228bdd1876e7e4aeec103755ecde26464139277b5185e437f6b221"),
Windows(:i686) => ("$bin_prefix/GEOS.v3.6.2.i686-w64-mingw32.tar.gz", "8e05b3a3ba8c8a7769d2947f80a01536c9b8f96f0e604c51296f7a40e392ab07"),
Linux(:powerpc64le, :glibc) => ("$bin_prefix/GEOS.v3.6.2.powerpc64le-linux-gnu.tar.gz", "d2083d831899f49e90e6c4fa854f9ac4564b2616d1ec6d58e0dfd1b9994d9d2d"),
MacOS(:x86_64) => ("$bin_prefix/GEOS.v3.6.2.x86_64-apple-darwin14.tar.gz", "9618a0ebed6bf1031c007ce73f518c80c828e2f673f2b60411d459e16c164920"),
Linux(:x86_64, :glibc) => ("$bin_prefix/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz", "1ded88fc0129dfd7f0bfae7f777135d13e2866920e3457181f934c001a6961ab"),
Windows(:x86_64) => ("$bin_prefix/GEOS.v3.6.2.x86_64-w64-mingw32.tar.gz", "dcca4342944b52ef0d03b283207211e4aa47661d3891c63047963480ae4b2126"),
)

# 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)
53 changes: 53 additions & 0 deletions deps/build_PROJ.v4.9.3.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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["libproj"], :libproj),
FileProduct(prefix, "share/proj/CH", :ch_path),
FileProduct(prefix, "share/proj/epsg", :epsg_path),
FileProduct(prefix, "share/proj/esri", :esri_path),
FileProduct(prefix, "share/proj/esri.extra", :esri_extra_path),
FileProduct(prefix, "share/proj/GL27", :gl27_path),
FileProduct(prefix, "share/proj/IGNF", :ignf_path),
FileProduct(prefix, "share/proj/nad27", :nad27_path),
FileProduct(prefix, "share/proj/nad83", :nad83_path),
FileProduct(prefix, "share/proj/nad.lst", :nad_lst_path),
FileProduct(prefix, "share/proj/other.extra", :other_extra_path),
FileProduct(prefix, "share/proj/proj_def.dat", :proj_def_dat_path),
FileProduct(prefix, "share/proj/world", :world_path),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaGeo/PROJBuilder/releases/download/v4.9.3-3"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, :glibc) => ("$bin_prefix/PROJ.v4.9.3.aarch64-linux-gnu.tar.gz", "2fef7ae57ace63ae641844b99390e37783022225ff278881523d4181fb9e6e3f"),
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/PROJ.v4.9.3.arm-linux-gnueabihf.tar.gz", "2532eee2bf42a64f43a88891f3b6ffa17c1a024efc4af899bccfe6ab8374ebe3"),
Linux(:i686, :glibc) => ("$bin_prefix/PROJ.v4.9.3.i686-linux-gnu.tar.gz", "7a1043bc648f5973534fa792a0d8e7c43443f5ae69174db2a11a61dbd57bfa97"),
Windows(:i686) => ("$bin_prefix/PROJ.v4.9.3.i686-w64-mingw32.tar.gz", "7e55852eeade27c22eb01ed4a4ebd5b77b3a06c044df493e0f1cea67db32e66d"),
Linux(:powerpc64le, :glibc) => ("$bin_prefix/PROJ.v4.9.3.powerpc64le-linux-gnu.tar.gz", "d0ecbf0e4584e959e4f49195160aada6140f0d356cf1e53cdeed4e97697eb84a"),
MacOS(:x86_64) => ("$bin_prefix/PROJ.v4.9.3.x86_64-apple-darwin14.tar.gz", "9701ad59fb39e0bc73958fd017499ceece88b8af5c91fbe2f3f7e59cdb64d5c5"),
Linux(:x86_64, :glibc) => ("$bin_prefix/PROJ.v4.9.3.x86_64-linux-gnu.tar.gz", "8e9820c512a2b71c2db0b7d757cbe176cfa1046a655112c0e6375314caf482a0"),
Windows(:x86_64) => ("$bin_prefix/PROJ.v4.9.3.x86_64-w64-mingw32.tar.gz", "2c642d7a470007cff4f2eeecd247ff1855085091ce4622971f9da8e7173548a2"),
)

# 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)
46 changes: 46 additions & 0 deletions deps/build_Zlib.v1.2.11.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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["libz"], :libz),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.1"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, :glibc) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-gnu.tar.gz", "37de2156c3c7e71cf7a913726eaae493239bcd65e5b42a84008298d8d418122a"),
Linux(:aarch64, :musl) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-musl.tar.gz", "4eaed05355abc53edfda7add75db1b37508a6bfc7c7612f6a622435ab6e2376e"),
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz", "f08efe363ec8d1cd683a0ede7e1a9b7f8fc9104b02f345fa0134c41f8ed6b858"),
Linux(:armv7l, :musl, :eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-musleabihf.tar.gz", "480406c4ad864d6fc469a68e7f64fed8650de31c7330bb0ab2969eea22c26157"),
Linux(:i686, :glibc) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-gnu.tar.gz", "8d0b2e36823e3ef9ad5a37d7adc629cb2fd1d64c4d5173237c27523e2d01fa48"),
Linux(:i686, :musl) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-musl.tar.gz", "23cf414f24a7138b8c4b77d54750a371eda340cda3f91bf081643335de4a44b2"),
Windows(:i686) => ("$bin_prefix/Zlib.v1.2.11.i686-w64-mingw32.tar.gz", "a58cc5df045f50caaf16bb9e393f5549fb6498471a04e5c55659425936243e0a"),
Linux(:powerpc64le, :glibc) => ("$bin_prefix/Zlib.v1.2.11.powerpc64le-linux-gnu.tar.gz", "1ac9ceeaf2512734d04848a6fb45ba40213e5ea7d2b7d33b72bfda879e1c69bd"),
MacOS(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-apple-darwin14.tar.gz", "c923f866a0770cf2165d1b18b6e301b3d01a875401a7801ddc9deba86759ca7b"),
Linux(:x86_64, :glibc) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz", "2b081904e33195cd24e40639c3fa1b3e70284d86f267710343941083bedaf610"),
Linux(:x86_64, :musl) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-musl.tar.gz", "a782fb42c612576cffbc448cc8b17aa888592e1419b5e3713e6e0a9859ebbb36"),
FreeBSD(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-unknown-freebsd11.1.tar.gz", "e035a82177cad715e819c08f888538db4ddb0589a13292cb18e9a69a220a7028"),
Windows(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz", "34cfc00b28c3883d007e642c4518cba3ba4244bcced25101e3f15168e1a898d7"),
)

# 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)
9 changes: 0 additions & 9 deletions src/GDAL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ if !isfile(depsjl_path)
end
include(depsjl_path)

# import these for their dynamic libraries, which libgdal needs
import CodecZlib
import Proj4
import LibGEOS

module C
import GDAL: libgdal

Expand Down Expand Up @@ -49,10 +44,6 @@ include("cpl_error.jl")
include("error.jl")

function __init__()
Libdl.dlopen(CodecZlib.libz)
Libdl.dlopen(Proj4.libproj)
Libdl.dlopen(LibGEOS.libgeos_cpp)
Libdl.dlopen(LibGEOS.libgeos)
h = Libdl.dlopen(libgdal)
finfo = Libdl.dlsym(h, :GDALVersionInfo)
fconf = Libdl.dlsym(h, :CPLSetConfigOption)
Expand Down