-
Notifications
You must be signed in to change notification settings - Fork 14
/
mix.exs
74 lines (64 loc) · 1.77 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
defmodule ExNcurses.MixProject do
use Mix.Project
def project do
[
app: :ex_ncurses,
version: "0.3.1",
package: package(),
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
description: description(),
deps: deps(),
compilers: [:elixir_make | Mix.compilers()],
make_targets: ["all"],
make_clean: ["clean"],
make_env: make_env(),
aliases: [format: ["format", &format_c/1]]
]
end
defp make_env() do
case System.get_env("ERL_EI_INCLUDE_DIR") do
nil ->
%{
"ERL_EI_INCLUDE_DIR" => "#{:code.root_dir()}/usr/include",
"ERL_EI_LIBDIR" => "#{:code.root_dir()}/usr/lib"
}
_ ->
%{}
end
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
mod: {ExNcurses.Application, []}
]
end
defp description() do
"""
ExNcurses - a NIF interface to the ncurses lib.
"""
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[{:elixir_make, "~> 0.4", runtime: false}, {:ex_doc, "~> 0.11", only: :dev, runtime: false}]
end
defp package() do
[
name: :ex_ncurses,
maintainers: ["Jim Freeze, Frank Hunleth, Justin Schneck"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/jfreeze/ex_ncurses"},
files: ["CHANGELOG.md", "LICENSE", "README.md", "lib/**/*.ex", "mix.exs", "Makefile", "src/*.c"]
]
end
defp format_c([]) do
astyle =
System.find_executable("astyle") ||
Mix.raise("""
Could not format C code since astyle is not available.
""")
System.cmd(astyle, ["-n", "-r", "src/*.c"], into: IO.stream(:stdio, :line))
end
defp format_c(_args), do: true
end