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

Use binaries from JuliaBinaryWrappers #5

Closed
wants to merge 2 commits 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
*.jl.*.cov
*.jl.mem
*DS_Store
/deps/build.log
/deps/deps.jl
/deps/usr/
5 changes: 0 additions & 5 deletions REQUIRE

This file was deleted.

54 changes: 19 additions & 35 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,30 @@ 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")))

# These are the binary objects we care about
products = [
LibraryProduct(prefix, ["libSDL2"], :libSDL2),
LibraryProduct(prefix, ["libSDL2", "SDL2"], :libsdl2),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/jonathanBieler/SDL2Builder/releases/download/v0.1.1"
dependencies = [
"build_X11.v1.6.8.jl",
"build_SDL2.v2.0.10.jl"
]

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/SDL2.v0.1.0.aarch64-linux-gnu.tar.gz", "dde349fe5ad22768665a1567d5f5ab3169cb2f3f4e79261f6845647311ce59e4"),
Linux(:aarch64, libc=:musl) => ("$bin_prefix/SDL2.v0.1.0.aarch64-linux-musl.tar.gz", "dd6a8286a128fa10a8948f69bbbb73e1bfa53d22a06627be18cfd2b787981d95"),
Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/SDL2.v0.1.0.arm-linux-gnueabihf.tar.gz", "9d81468ed7d4af5d746344cf9351a8811257e0a7e4ddfc51d929c76d3ff3b29a"),
Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/SDL2.v0.1.0.arm-linux-musleabihf.tar.gz", "51e9e302e858bc9579b4b7f44f8a2725949b469d4e9db6785222934b3ceef2b7"),
Linux(:i686, libc=:glibc) => ("$bin_prefix/SDL2.v0.1.0.i686-linux-gnu.tar.gz", "d5d25d8500e83359006f6d3b664f2dc141dfcb70f87360f07a9926ac6da00d5b"),
Linux(:i686, libc=:musl) => ("$bin_prefix/SDL2.v0.1.0.i686-linux-musl.tar.gz", "5284a6c09221fd57d1055a2ee15ca86e739ea0c763f09825b054c2d7c58d8a82"),
Windows(:i686) => ("$bin_prefix/SDL2.v0.1.0.i686-w64-mingw32.tar.gz", "7bb623cf207b0e4f8197fc71f4527d04dc2b39618c547e774ad2e3db96263f18"),
Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/SDL2.v0.1.0.powerpc64le-linux-gnu.tar.gz", "6fc174cd0c4e0aa81a040e8b0b74803e48b2440268c1898ccd0540909213ea7f"),
MacOS(:x86_64) => ("$bin_prefix/SDL2.v0.1.0.x86_64-apple-darwin14.tar.gz", "8e21a830fb7ee9ed6d549c38113b8eb4f89030c0ab2b5a586d00550369a2498d"),
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/SDL2.v0.1.0.x86_64-linux-gnu.tar.gz", "aebc7bc8f964e16ea25b6647aba9883b47f2e489d4aadbb476b4b081cf285cbd"),
Linux(:x86_64, libc=:musl) => ("$bin_prefix/SDL2.v0.1.0.x86_64-linux-musl.tar.gz", "6aac8dba4c6fcd383c4fdfb26b65c3a1fd97886bc256ce2bd8aac7d1f52980a3"),
FreeBSD(:x86_64) => ("$bin_prefix/SDL2.v0.1.0.x86_64-unknown-freebsd11.1.tar.gz", "bd2aa0811f7c3b06ce43c63d0315bf970d9dfd80b6e3a4c20dd6f7a7cc393b60"),
Windows(:x86_64) => ("$bin_prefix/SDL2.v0.1.0.x86_64-w64-mingw32.tar.gz", "16be7be10fde61bc01807b25689d308e97cfaacbf0c8a8bedf22bc3fa3ed1c65"),
)
for dependency in dependencies
# These packages are available only on Linux and FreeBSD
platform_key_abi() isa Union{MacOS,Windows} &&
occursin(r"^build_X11", dependency) &&
continue

# Install unsatisfied or updated dependencies:
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
dl_info = choose_download(download_info, platform_key_abi())
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
# it's a bit faster to run the build in an anonymous module instead of
# starting a new julia process

# 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
install(dl_info...; prefix=prefix, force=true, verbose=verbose)
# Build the dependencies
Mod = @eval module Anon end
Mod.include(dependency)
end

# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)
# Finally, write out a deps.jl file
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
48 changes: 48 additions & 0 deletions deps/build_SDL2.v2.0.10.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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, ["libSDL2", "SDL2"], :libsdl2),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaBinaryWrappers/SDL2_jll.jl/releases/download/SDL2-v2.0.10+0"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/SDL2.v2.0.10.aarch64-linux-gnu.tar.gz", "e4af64aaf96161ea41b5a18a1bf417465912bc1db3e552740e39c3a7f89e2420"),
Linux(:aarch64, libc=:musl) => ("$bin_prefix/SDL2.v2.0.10.aarch64-linux-musl.tar.gz", "5d5d437a24edc4e346a79395d1574b746c7a81d413f11e2138d63c282c3b8647"),
Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/SDL2.v2.0.10.arm-linux-gnueabihf.tar.gz", "b82418c48bed91a10c7bb89f4269ee072eac9f4a92eb464b63f04af1d46cff7d"),
Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/SDL2.v2.0.10.arm-linux-musleabihf.tar.gz", "c2b4a2b8ee78472136feac439d21995be0f08e3e6dbf8ffa89b0903bec485a8e"),
Linux(:i686, libc=:glibc) => ("$bin_prefix/SDL2.v2.0.10.i686-linux-gnu.tar.gz", "695e354966e91991633ed3ed6b26f18ff63b96ea92f49b737072fb7895bcfd54"),
Linux(:i686, libc=:musl) => ("$bin_prefix/SDL2.v2.0.10.i686-linux-musl.tar.gz", "878a391120d8aa6f817dbff8c9063f55e776f543d3bb7cb859fc1dee5c8baa54"),
Windows(:i686) => ("$bin_prefix/SDL2.v2.0.10.i686-w64-mingw32.tar.gz", "6c5bf153b3473e2dbdadac48aaba4ecb7445f0694ef379f3d387aa0b2085a154"),
Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/SDL2.v2.0.10.powerpc64le-linux-gnu.tar.gz", "819d5033dd225f11e06f93ba740c50819d5f4fca2d718407f47f26b37cdcbfac"),
MacOS(:x86_64) => ("$bin_prefix/SDL2.v2.0.10.x86_64-apple-darwin14.tar.gz", "d2c300727366ca3f196363bb864571d04a8332c4e2d0dd5920bf8e37838d8ec5"),
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/SDL2.v2.0.10.x86_64-linux-gnu.tar.gz", "4f39673b33d84df5116540b61cf3423819dda01c5637682c29823f71c7d56158"),
Linux(:x86_64, libc=:musl) => ("$bin_prefix/SDL2.v2.0.10.x86_64-linux-musl.tar.gz", "e62ec9b141a017472aecf07a979b64999261524ebcd9e3af8c31206c6395193b"),
FreeBSD(:x86_64) => ("$bin_prefix/SDL2.v2.0.10.x86_64-unknown-freebsd11.1.tar.gz", "449edeaab58373e01eff79ed8bd99b329bce0532cc11939f1c30931f08c04cef"),
Windows(:x86_64) => ("$bin_prefix/SDL2.v2.0.10.x86_64-w64-mingw32.tar.gz", "a9a6694fe885a41c5c2aa1ca23d4444ff8d29bbd1bc2b5c6ea30b92b50553ae8"),
)

# Install unsatisfied or updated dependencies:
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
dl_info = choose_download(download_info, platform_key_abi())
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
install(dl_info...; prefix=prefix, force=true, verbose=verbose)
end

# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)
46 changes: 46 additions & 0 deletions deps/build_X11.v1.6.8.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, ["libX11"], :libX11),
LibraryProduct(prefix, ["libX11-xcb"], :libX11_xcb),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/JuliaBinaryWrappers/X11_jll.jl/releases/download/X11-v1.6.8+3"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/X11.v1.6.8.aarch64-linux-gnu.tar.gz", "66a4e90fbbf28134ccc9955d69e7a39128fd5eac302908896c6afc49c7af8b74"),
Linux(:aarch64, libc=:musl) => ("$bin_prefix/X11.v1.6.8.aarch64-linux-musl.tar.gz", "6d72b9c547046236506ca167c6d906dd510d2d85584a6a3aee0554eac30d6b6f"),
Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/X11.v1.6.8.arm-linux-gnueabihf.tar.gz", "268f9074808301dcf7ec736e04c23456320611526aee4414104fa85988795ee4"),
Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/X11.v1.6.8.arm-linux-musleabihf.tar.gz", "4f0b3cf80aa6e0dcabc99fd4a24b09c540265c1fc4cf6bbff4f68f79e8245c55"),
Linux(:i686, libc=:glibc) => ("$bin_prefix/X11.v1.6.8.i686-linux-gnu.tar.gz", "ff46ea524df10a642a8d998731edaba4c1412592fb85671f371dca9644268867"),
Linux(:i686, libc=:musl) => ("$bin_prefix/X11.v1.6.8.i686-linux-musl.tar.gz", "c67d3c15ae1a85f2a7f9fbc3208d9dfb39517f1ea17d5d6701e115e29f14021d"),
Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/X11.v1.6.8.powerpc64le-linux-gnu.tar.gz", "8cf5424bd749e74bf8868159cd710ba8108e705b61b963f04e1a5850de1dbacd"),
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/X11.v1.6.8.x86_64-linux-gnu.tar.gz", "151d0366855cd3a9c26f1c6c7f32e81bc99d4f955e72c59f634e0152b658aac9"),
Linux(:x86_64, libc=:musl) => ("$bin_prefix/X11.v1.6.8.x86_64-linux-musl.tar.gz", "58cf221560c3ac0d32183e692eec58720fcf906c99f0ef6ab7f81d0286171560"),
FreeBSD(:x86_64) => ("$bin_prefix/X11.v1.6.8.x86_64-unknown-freebsd11.1.tar.gz", "3249f3ad025ff31ebdec4a5463df84700747f0d78a2c7a9702beadf0723c6ee0"),
)

# Install unsatisfied or updated dependencies:
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
dl_info = choose_download(download_info, platform_key_abi())
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
install(dl_info...; prefix=prefix, force=true, verbose=verbose)
end

# Write out a deps.jl file that will contain mappings for our products
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)
5 changes: 5 additions & 0 deletions src/SimpleDirectMediaLayer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ module SimpleDirectMediaLayer
error("SimpleDirectMediaLayer not properly installed. Please run Pkg.build(\"SimpleDirectMediaLayer\") then restart Julia.")
end

# Deprecate old library variables
Base.@deprecate_binding libSDL2 SimpleDirectMediaLayer.libsdl2 false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3 woah, this is awesome. Thanks, you're the best!

# Base.@deprecate_binding libSDL2_mixer SimpleDirectMediaLayer.libsdl2_mixer false
# Base.@deprecate_binding libSDL2_ttf SimpleDirectMediaLayer.libsdl2_ttf false

include("lib/SDL.jl")
include("lib/SDL_ttf.jl")
include("lib/SDL_mixer.jl")
Expand Down
Loading