Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on macos #4

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions antic/antic/dune
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
CFLAGS=-fPIC)
(run make library -j)
(run make install)
(system "if [ -f ../prefix/lib/libantic.dylib ]; then mv ../prefix/lib/libantic.dylib ../prefix/lib/libantic.so; fi")
))
(system
"if [ -f ../prefix/lib/libantic.dylib ]; then mv ../prefix/lib/libantic.dylib ../prefix/lib/libantic.so; fi")))
(copy prefix/lib/libantic%{ext_dll} dllantic%{ext_dll})
(copy prefix/lib/libantic%{ext_lib} libantic%{ext_lib})
(copy prefix/include/antic/nf_elem.h nf_elem.h)
Expand Down
13 changes: 9 additions & 4 deletions arb/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
(foreign_archives arb)
(foreign_stubs
(language c)
(names ocaml_acb_utils))
(names ocaml_acb_utils)
(flags
(:include ../configure/c_flags.sexp)
:standard))
(libraries zarith flint threads)
(flags -w -9-27)
(ctypes
Expand All @@ -18,7 +21,9 @@
"-Werror=implicit-function-declaration"
(:include ../configure/c_flags.sexp)
:standard)
(c_library_flags "-lgmp -lmpfr")))
(c_library_flags
(:include ../configure/libs.sexp)
"-lgmp -lmpfr")))
(deps arb.h acb.h)
(headers
(include "acb.h" "string.h"))
Expand Down Expand Up @@ -101,8 +106,8 @@
CFLAGS=-fPIC)
(run make library -j)
(run make install)
(system "if [ -f ../prefix/lib/libarb.dylib ]; then mv ../prefix/lib/libarb.dylib ../prefix/lib/libarb.so; fi")
))
(system
"if [ -f ../prefix/lib/libarb.dylib ]; then mv ../prefix/lib/libarb.dylib ../prefix/lib/libarb.so; fi")))
(copy prefix/lib/libarb%{ext_dll} dllarb%{ext_dll})
(copy prefix/lib/libarb%{ext_lib} libarb%{ext_lib})
(copy prefix/include/dirichlet.h dirichlet.h)
Expand Down
7 changes: 6 additions & 1 deletion calcium/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
(foreign_stubs
(language c)
(names ocaml_calcium_utils)
(flags
(:include ../configure/c_flags.sexp)
:standard)
(include_dirs
lib
(lib flint)
Expand All @@ -25,7 +28,9 @@
"-Werror=implicit-function-declaration"
(:include ../configure/c_flags.sexp)
:standard)
(c_library_flags "-lgmp -lmpfr")))
(c_library_flags
(:include ../configure/libs.sexp)
"-lgmp -lmpfr")))
(deps lib/ca.h)
(headers
(include "lib/ca.h" "string.h"))
Expand Down
4 changes: 2 additions & 2 deletions calcium/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
CFLAGS=-fPIC)
(run make library -j)
(run make install)
(system "if [ -f ../prefix/lib/libcalcium.dylib ]; then mv ../prefix/lib/libcalcium.dylib ../prefix/lib/libcalcium.so; fi")
))
(system
"if [ -f ../prefix/lib/libcalcium.dylib ]; then mv ../prefix/lib/libcalcium.dylib ../prefix/lib/libcalcium.so; fi")))
(copy prefix/lib/libcalcium%{ext_dll} dllcalcium%{ext_dll})
(copy prefix/lib/libcalcium%{ext_lib} libcalcium%{ext_lib})
(copy prefix/include/calcium/qqbar.h qqbar.h)
Expand Down
3 changes: 1 addition & 2 deletions calcium/tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
(names units)
(modules units)
(libraries calcium)
(package calcium)
)
(package calcium))

;; Need dune whole mode for foreign library

Expand Down
19 changes: 10 additions & 9 deletions configure/discover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ module C = Configurator.V1

let () =
C.main ~name:"discover" (fun c ->
let conf =
let cflags, libs =
match C.Pkg_config.get c with
| None -> []
| None -> ([], [])
| Some pc ->
let cflags ~package =
let flags ~package =
match C.Pkg_config.query pc ~package with
| None -> []
| Some info -> info.cflags
| None -> ([], [])
| Some info -> (info.cflags, info.libs)
in
let gmp = cflags ~package:"gmp" in
let mpfr = cflags ~package:"mpfr" in
let gmp = flags ~package:"gmp" in
let mpfr = flags ~package:"mpfr" in

gmp @ mpfr
(fst gmp @ fst mpfr, snd gmp @ snd mpfr)
in

C.Flags.write_sexp "c_flags.sexp" conf)
C.Flags.write_sexp "c_flags.sexp" cflags;
C.Flags.write_sexp "libs.sexp" libs)
5 changes: 3 additions & 2 deletions configure/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
(libraries dune-configurator))

(rule
(targets c_flags.sexp)
(action (run ./discover.exe)))
(targets c_flags.sexp libs.sexp)
(action
(run ./discover.exe)))
7 changes: 6 additions & 1 deletion flint/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
(foreign_stubs
(language c)
(names ocaml_flint_utils)
(flags
(:include ../configure/c_flags.sexp)
:standard)
(include_dirs
flint
(lib zarith)))
Expand All @@ -21,7 +24,9 @@
"-Werror=implicit-function-declaration"
(:include ../configure/c_flags.sexp)
:standard)
(c_library_flags "-lgmp -lmpfr")))
(c_library_flags
(:include ../configure/libs.sexp)
"-lgmp -lmpfr")))
(deps flint/flint.h flint/fmpz.h)
(headers
(include "flint/fmpz.h" "flint/fmpq.h" "string.h"))
Expand Down
4 changes: 2 additions & 2 deletions flint/flint/dune
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
(run ./configure --prefix=../prefix CFLAGS=-fPIC --with-pkg-config)
(run make library -j)
(run make install)
(system "if [ -f ../prefix/lib/libflint.dylib ]; then mv ../prefix/lib/libflint.dylib ../prefix/lib/libflint.so; fi")
))
(system
"if [ -f ../prefix/lib/libflint.dylib ]; then mv ../prefix/lib/libflint.dylib ../prefix/lib/libflint.so; fi")))
(copy prefix/lib/libflint%{ext_lib} libflint%{ext_lib})
(copy prefix/lib/libflint%{ext_dll} dllflint%{ext_dll})
(copy prefix/include/flint/aprcl.h aprcl.h)
Expand Down
6 changes: 3 additions & 3 deletions flint/tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
(names dynamic)
(modules dynamic)
(libraries dune-site.plugins zarith threads)
(deps (package flint))
(package flint)
)
(deps
(package flint))
(package flint))