Skip to content

Commit

Permalink
update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Sep 27, 2015
1 parent fa4b578 commit fa44ddd
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions deps/build.jl
Expand Up @@ -7,12 +7,12 @@ if !isempty(mpath)
push!(DL_LOAD_PATH, mpath)
push!(DL_LOAD_PATH, joinpath(mpath,"lib"))
end
libnames = ["libMagickWand", "CORE_RL_wand_"]
suffixes = ["", "-Q16", "-6.Q16", "-Q8"]
options = ["", "HDRI"]
extensions = ["", ".so.2", ".so.4", ".so.5"]
aliases = vec(libnames.*transpose(suffixes).*reshape(options,(1,1,length(options))).*reshape(extensions,(1,1,1,length(extensions))))
libwand = library_dependency("libwand", aliases = aliases)
libnames = ["libMagickWand", "CORE_RL_wand_"]
suffixes = ["", "-Q16", "-6.Q16", "-Q8"]
options = ["", "HDRI"]
extensions = ["", ".so.2", ".so.4", ".so.5"]
aliases = vec(libnames.*transpose(suffixes).*reshape(options,(1,1,length(options))).*reshape(extensions,(1,1,1,length(extensions))))
libwand = library_dependency("libwand", aliases = aliases)

initfun = """
function init_deps()
Expand All @@ -38,17 +38,16 @@ end
# TODO: checksums: we have gpg
# Extract the appropriate filename to download
magick_base = "http://www.imagemagick.org/download/binaries"
binariesfn = download(magick_base)
str = readall(binariesfn)
pattern = "ImageMagick-6.9.*?-Q16-$(OS_ARCH)-dll.exe"
m = match(Regex(pattern), str)
magick_exe = convert(ASCIIString, m.match)
binariesfn = download(magick_base)
str = readall(binariesfn)
pattern = "ImageMagick-6.9.*?-Q16-$(OS_ARCH)-dll.exe"
m = match(Regex(pattern), str)
magick_exe = convert(ASCIIString, m.match)

magick_tmpdir = BinDeps.downloadsdir(libwand)
magick_url = "$(magick_base)/$(magick_exe)"
magick_libdir = joinpath(BinDeps.libdir(libwand), OS_ARCH)

innounp_url = "https://bintray.com/artifact/download/julialang/generic/innounp.exe"
magick_tmpdir = BinDeps.downloadsdir(libwand)
magick_url = "$(magick_base)/$(magick_exe)"
magick_libdir = joinpath(BinDeps.libdir(libwand), OS_ARCH)
innounp_url = "https://bintray.com/artifact/download/julialang/generic/innounp.exe"

provides(BuildProcess,
(@build_steps begin
Expand All @@ -62,24 +61,21 @@ end
`innounp.exe -q -y -b -e -x -d$(magick_libdir) $(magick_exe)`
end
end),
libwand,
os = :Windows,
unpacked_dir = magick_libdir,
libwand, os = :Windows, unpacked_dir = magick_libdir,
preload ="""
function init_deps()
ENV["MAGICK_CONFIGURE_PATH"] = \"$(escape_string(magick_libdir))\"
ENV["MAGICK_CONFIGURE_PATH"] = \"$(escape_string(magick_libdir))\"
ENV["MAGICK_CODER_MODULE_PATH"] = \"$(escape_string(magick_libdir))\"
end
init_deps()
""",
onload = "init_deps();ccall((:MagickWandGenesis,libwand), Void, ())"
onload = "ccall((:MagickWandGenesis,libwand), Void, ())"
)
end

@osx_only begin
if Pkg.installed("Homebrew") === nothing
error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
end
using Homebrew
provides( Homebrew.HB, "imagemagick", libwand, os = :Darwin, preload =
Expand All @@ -106,4 +102,4 @@ vstr = string("v\"", join(split(bytestring(p), ',')[1:3], '.'), "\"")
open(joinpath(dirname(@__FILE__),"versioninfo.jl"), "w") do file
write(file, "const libversion = $vstr\n")
end
end
end

0 comments on commit fa44ddd

Please sign in to comment.