Skip to content

Commit

Permalink
Use sexplib0 in config instead of base and stdio
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA committed Dec 24, 2021
1 parent 3a54903 commit 405d2a6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
20 changes: 13 additions & 7 deletions config/discover.ml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
open Base
open Stdio
open Sexplib0
open Sexplib0.Sexp_conv
open StdLabels
module C = Configurator.V1

let write_data fn data =
let och = open_out fn in
Fun.protect
(fun () -> output_string och data)
~finally:(fun () -> close_out och)

let write_sexp fn list_of_str =
let data = sexp_of_list sexp_of_string list_of_str |> Sexp.to_string in
Out_channel.write_all fn ~data
write_data fn data

let write_flags file list_of_str =
let write_flags fn list_of_str =
let data = String.concat list_of_str ~sep:" " in
Out_channel.write_all file ~data
write_data fn data

let () =
C.main ~name:"GObject-Introspection" (fun c ->
Expand Down Expand Up @@ -64,8 +71,7 @@ let () =
in
let os_type = C.ocaml_config_var_exn (C.create "") "system" in
let ccopts =
if Base.String.(os_type = "macosx") then [ "" ]
else [ "-Wl,-no-as-needed" ]
if os_type = "macosx" then [ "" ] else [ "-Wl,-no-as-needed" ]
in
write_sexp "c_flags.sexp" conf.cflags;
write_sexp "c_library_flags.sexp" conf.libs;
Expand Down
2 changes: 1 addition & 1 deletion config/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(executable
(name discover)
(libraries base stdio dune-configurator))
(libraries sexplib0 dune-configurator))
10 changes: 5 additions & 5 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
(description "This library provides bindings based on Ctypes for the libgirepository API (see https://developer.gnome.org/gi/stable/)")
(depends
(ocaml (>= 4.08))
ctypes
ctypes-foreign
(dune-configurator :build)
(base :build)
(stdio (and :build :with-test))
(conf-pkg-config :build)
(conf-gobject-introspection :build)
(conf-glib-2 :build)
(conf-gtk3 :build)
(dune-configurator :build)
(sexplib0 :build)
ctypes
ctypes-foreign
(ounit2 :with-test)
(stdio :with-test)
))
10 changes: 5 additions & 5 deletions gobject-introspection.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ bug-reports: "https://github.com/cedlemo/OCaml-GObject-Introspection/issues"
depends: [
"dune" {>= "2.9"}
"ocaml" {>= "4.08"}
"ctypes"
"ctypes-foreign"
"dune-configurator" {build}
"base" {build}
"stdio" {build & with-test}
"conf-pkg-config" {build}
"conf-gobject-introspection" {build}
"conf-glib-2" {build}
"conf-gtk3" {build}
"dune-configurator" {build}
"sexplib0" {build}
"ctypes"
"ctypes-foreign"
"ounit2" {with-test}
"stdio" {with-test}
"odoc" {with-doc}
]
build: [
Expand Down
2 changes: 1 addition & 1 deletion tests/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(test
(name test)
(libraries GObject_introspection ounit2 ctypes ctypes.foreign stdio))
(libraries GObject_introspection ounit2 ctypes ctypes.foreign))

0 comments on commit 405d2a6

Please sign in to comment.