forked from ocaml/Zarith
/
dune
99 lines (88 loc) · 1.92 KB
/
dune
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
91
92
93
94
95
96
97
98
99
(env
(dev
(flags
(:standard -w -6-32-39))))
(library
(name zarith)
(public_name zarith)
(modules z q big_int_Z zarith_version)
(wrapped false)
(foreign_stubs
(language c)
(names caml_z)
(flags
:standard
(:include cflags.sexp)))
(c_library_flags
(:include libs.sexp)))
(executable
(name configure_env)
(modules configure_env))
(rule
(target Makefile)
(deps configure env)
(action
(bash
"env %{read:env} ./configure --ocamllibdir %{ocaml-config:standard_library}")))
(rule
(target env)
(action
(copy gmp.%{lib-available:gmp} env)))
(rule
(target gmp.true)
(deps
(:exe configure_env.exe)
%{lib:gmp:libgmp.a}
%{lib:gmp:libgmp.so}
%{lib:gmp:gmp.h})
(action
(with-stdout-to
%{target}
(run %{exe} --cc "%{cc}" --with-gmp=%{lib:gmp:libgmp.a}))))
(rule
(target gmp.false)
(deps
(:exe configure_env.exe))
(action
(with-stdout-to
%{target}
(run %{exe} --cc "%{cc}" --with-conf-gmp))))
(rule
(target cflags.sexp)
(deps Makefile)
(action
(with-stdout-to
%{target}
(progn
(bash "echo -n '('")
(bash "cat Makefile | sed -n -e 's/CFLAGS=//p'")
(bash "echo -n ')'")))))
; Note that the order (LDFLAGS, then LIBS) is important below since
; zarith uses pkg-config to detect gmp, and adds the output to LIBS
; but we like -L ..._build/solo5/duniverse/Zarith/../../../install/solo5/lib/gmp
; first, followed by -L/usr/local/lib -lgmp (from pkg-config)
(rule
(target libs.sexp)
(deps Makefile)
(action
(with-stdout-to
%{target}
(progn
(bash "echo -n '('")
(bash "cat Makefile | sed -n -e 's/LDFLAGS=//p'")
(bash "cat Makefile | sed -n -e 's/LIBS=//p'")
(bash "echo -n ')'")))))
(rule
(deps META)
(action
(with-stdout-to
zarith_version.ml
(progn
(run echo "let")
(bash "grep \"version\" META | head -1")))))
(library
(name zarith_top)
(optional)
(public_name zarith.top)
(modules zarith_top)
(libraries zarith compiler-libs.toplevel))