-
Notifications
You must be signed in to change notification settings - Fork 4
/
mix.exs
90 lines (77 loc) · 2.06 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
defmodule Mix.Tasks.Compile.ExMagick do
use Mix.Task
@shortdoc "compiles the exmagick library"
def run(_) do
distroot = Path.absname(Path.expand("priv", __DIR__))
buildroot = Mix.Project.build_path()
runcmd("make", [
"--quiet",
"distroot=#{distroot}",
"buildroot=#{buildroot}",
"compile",
"install"
])
Mix.Project.build_structure()
end
defp runcmd(cmd, args) do
{_, 0} = System.cmd(cmd, args, into: IO.stream(:stdio, :line))
end
end
defmodule ExMagick.Mixfile do
use Mix.Project
def project do
[
app: :exmagick,
version: "1.0.0",
elixir: "~> 1.3",
description: description(),
package: package(),
deps: deps(),
aliases: aliases(),
dialyzer: [
paths: ["_build/dev/lib/exmagick/ebin/Elixir.ExMagick.beam"],
plt_file: System.get_env("DIALYZER_PLT") || ".dialyzer.plt"
],
compilers: [:exMagick | Mix.compilers()]
]
end
defp description do
"""
ExMagick is a library for manipulating images interfacing with GraphicsMagick.
It's implemented using Erlang NIFs (Native Implemented Functions).
"""
end
defp package do
[
maintainers: ["Guilherme nirev", "Diego Dsouza", "Renan Milhouse"],
licenses: ["BSD-3"],
links: %{"GitHub" => "https://github.com/Xerpa/exmagick"},
files: ["AUTHOR", "bin", "COPYING", "lib", "makefile", "mix.exs", "README.md"]
]
end
defp deps do
[
{:dialyxir, "~> 0.3.5", only: [:dev]},
{:earmark, "~> 0.1", only: :dev},
{:ex_doc, "~> 0.11", only: :dev}
]
end
defp aliases do
[clean: ["clean", &make_clean/1]]
end
defp make_clean(_) do
File.rm_rf("priv")
build_dir = Path.dirname(Mix.Project.build_path())
if File.exists?(build_dir) do
for env <- File.ls!(build_dir) do
buildroot = Path.join(build_dir, env)
{_, 0} =
System.cmd(
"make",
["buildroot=#{buildroot}", "clean", "--quiet"],
into: IO.stream(:stdio, :line)
)
end
end
end
end