Skip to content

Commit 3a7ea72

Browse files
authored
use pre-built libxml2 binaries (#45)
1 parent 2ebc33d commit 3a7ea72

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
*.jl.cov
22
*.jl.*.cov
33
*.jl.mem
4+
/deps/deps.jl
5+
/deps/usr/
46
/docs/build/
57
/docs/site/

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
julia 0.6
2-
@windows WinRPM
2+
BinaryProvider 0.1

deps/build.jl

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1-
if isdefined(Sys, :iswindows) ? Sys.iswindows() : is_windows()
2-
using WinRPM
3-
WinRPM.install("libxml2-2", yes=true)
1+
using BinaryProvider
2+
3+
# This is where all binaries will get installed
4+
prefix = Prefix(!isempty(ARGS) ? ARGS[1] : joinpath(@__DIR__, "usr"))
5+
6+
# Instantiate products here. Examples:
7+
libxml2 = LibraryProduct(prefix, "libxml2")
8+
9+
# Assign products to `products`:
10+
products = [libxml2]
11+
12+
# Download binaries from hosted location
13+
bin_prefix = "https://github.com/bicycle1885/XML2Builder/releases/download/v1.0.0"
14+
15+
# Listing of files generated by BinaryBuilder:
16+
download_info = Dict(
17+
BinaryProvider.Linux(:aarch64, :glibc) => ("$bin_prefix/XML2Builder.aarch64-linux-gnu.tar.gz", "cc64013edbf308f1d26e02b05b29c2072545276122884024a2e79871c4f23be6"),
18+
BinaryProvider.Linux(:armv7l, :glibc) => ("$bin_prefix/XML2Builder.arm-linux-gnueabihf.tar.gz", "08c1b599aeda68e1783479b147e68a79224167ba4f693f431d02f734523b11a5"),
19+
BinaryProvider.Linux(:i686, :glibc) => ("$bin_prefix/XML2Builder.i686-linux-gnu.tar.gz", "f6a076cfa78cc04f782428e23f1492b8c583fcf3d177a1b7eea206721666cecb"),
20+
BinaryProvider.Linux(:powerpc64le, :glibc) => ("$bin_prefix/XML2Builder.powerpc64le-linux-gnu.tar.gz", "2c04d6dd67107b933ed5fb2b2afd50892b6f3a94bdf2412604a49654f033947b"),
21+
BinaryProvider.Linux(:x86_64, :glibc) => ("$bin_prefix/XML2Builder.x86_64-linux-gnu.tar.gz", "d3125723e5c75ded1eb01e5ce06c7dfae149ee276aa2d3f82a64edb2e8df23b8"),
22+
BinaryProvider.MacOS() => ("$bin_prefix/XML2Builder.x86_64-apple-darwin14.tar.gz", "c29fc38446b74830ce26d135974cc5043b636e0fe350bfa0e26e166edcebd7b7"),
23+
BinaryProvider.Windows(:i686) => ("$bin_prefix/XML2Builder.i686-w64-mingw32.tar.gz", "d09490cc615b541c236485b170007911587501ee8c3a3e3edc8d054e5412553c"),
24+
BinaryProvider.Windows(:x86_64) => ("$bin_prefix/XML2Builder.x86_64-w64-mingw32.tar.gz", "37f5b9d4df9e919a196dacbc2ede80b75a3aae7058890701958925336d145fb6"),
25+
)
26+
if platform_key() in keys(download_info)
27+
# First, check to see if we're all satisfied
28+
if any(!satisfied(p; verbose=true) for p in products)
29+
# Download and install binaries
30+
url, tarball_hash = download_info[platform_key()]
31+
install(url, tarball_hash; prefix=prefix, force=true, verbose=true)
32+
end
33+
34+
# Finally, write out a deps.jl file that will contain mappings for each
35+
# named product here: (there will be a "libxml2" variable and a "xml2ifier"
36+
# variable, etc...)
37+
@write_deps_file libxml2
38+
else
39+
error("Your platform $(Sys.MACHINE) is not supported by this package!")
440
end

src/EzXML.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ export
9595
nodedepth,
9696
expandtree
9797

98-
if isdefined(Sys, :iswindows) ? Sys.iswindows() : is_windows()
99-
const libxml2 = Pkg.dir("WinRPM","deps","usr","$(Sys.ARCH)-w64-mingw32","sys-root","mingw","bin","libxml2-2")
100-
else
101-
const libxml2 = "libxml2"
98+
# Load libxml2.
99+
const libxml2path = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")
100+
if !isfile(libxml2path)
101+
error("EzXML.jl is not installed properly, run Pkg.build(\"EzXML\") and restart Julia.")
102102
end
103+
include(libxml2path)
104+
check_deps()
103105

104106
if VERSION > v"0.7.0-DEV.3052"
105107
import Printf: @printf

0 commit comments

Comments
 (0)