Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

get libz from BinaryBuilder system #387

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.swp
deps/deps.jl
deps/deps*.jl
docs/build
.DS_Store
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ julia 0.7
Cairo 0.2.2
Graphics 0.1
BinDeps
BinaryProvider 0.3.0
Reexport
@windows WinRPM
@osx Homebrew
Expand Down
44 changes: 44 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ if Sys.isapple()
Homebrew.add("adwaita-icon-theme")
end

if Sys.islinux()
using BinaryProvider # requires BinaryProvider 0.3.0 or later

dependencies = [
"build_Zlib.v1.2.11.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.include(m, (joinpath(@__DIR__, elem)))
end

end

@BinDeps.install Dict([
(:glib, :libglib),
(:gobject, :libgobject),
Expand All @@ -68,3 +84,31 @@ end
(:gdk_pixbuf, :libgdk_pixbuf),
(:gio, :libgio),
])

if Sys.islinux()
# WARNING: This is nonstandard use of BinaryBuilder tools.
# We are insuring that BB-managed libs are loaded before the noncompliant
# ones.
function include_deps(name)
"""
module $name
import Libdl
path = joinpath(@__DIR__, $(repr(string("deps_", name, ".jl"))))
isfile(path) || error("$name wasn't build correctly. Please run Pkg.build(\\\"Gtk\\\")")
include(path)
function __init__()
if Sys.islinux()
check_deps()
end
end
end
"""
end

open("deps.jl", "a") do io
for dep in (:zlib,)
println(io, include_deps(dep))
end
# normally one would define the check_deps wrapper here
end
end
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, ["libz"], :libz),
]

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

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, :glibc) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-gnu.tar.gz", "66e6b2414a4fc9a5b8392b70efef9c4d163fad5159270c78e0740eebec95a415"),
Linux(:aarch64, :musl) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-musl.tar.gz", "2445bd730e8f7c9dcaaace86b15244549d8630f4d78ce4c4df3fb693adde1333"),
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz", "d6417bffeacdc542a0b35407e1d8cf7a85d8c9d695868c7770df57fe556c5a6f"),
Linux(:armv7l, :musl, :eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-musleabihf.tar.gz", "0ec51f27db2a7dc3c8056b18a99776ccc7459e6e5127cf82efeca770945d68b6"),
Linux(:i686, :glibc) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-gnu.tar.gz", "1d2bba7f971ab3576d84ce5094cc8e0849d6c7552182146454d90cae1714a542"),
Linux(:i686, :musl) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-musl.tar.gz", "06a77d15bb8ea3db8f7c45b06cf9b2b6944804147ef5ac5de11527a2badca886"),
Windows(:i686) => ("$bin_prefix/Zlib.v1.2.11.i686-w64-mingw32.tar.gz", "db1063328e9f2a961977f870e1954a977f86066f2aa0922ccba6e559aee22484"),
Linux(:powerpc64le, :glibc) => ("$bin_prefix/Zlib.v1.2.11.powerpc64le-linux-gnu.tar.gz", "13bc52cec6a5f40ef81ecb5120b123c6f63508e1b999c76b48ccf27a7029a1bd"),
MacOS(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-apple-darwin14.tar.gz", "deb72ecf071dc410870d9df75f3dbeef00c084394e1fc8e8631f5928ead3b87b"),
Linux(:x86_64, :glibc) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz", "26f8ddebd91628ca5c08310ec3ed6d7ebef1598ccabc34e5e4d495c6b21d89d0"),
Linux(:x86_64, :musl) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-musl.tar.gz", "e826ceffc841d2abf67854ce9ed739ae2d32d1b5acc46df6233b8fd1b549cc12"),
FreeBSD(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-unknown-freebsd11.1.tar.gz", "223f1f7886e45f2b1af889d5045402cbc0c22175515e593fead19099e5378741"),
Windows(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz", "016d0ad7dedea4aed59059ba0cf5776ca6955ebcdec262035391ec717e9b67df"),
)

# 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_zlib.jl"), products)