From 405d2a66281a4385decfa2e447ce5abdd5e028f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Fri, 24 Dec 2021 10:42:25 +0100 Subject: [PATCH] Use sexplib0 in config instead of base and stdio --- config/discover.ml | 20 +++++++++++++------- config/dune | 2 +- dune-project | 10 +++++----- gobject-introspection.opam | 10 +++++----- tests/dune | 2 +- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/config/discover.ml b/config/discover.ml index fe106cc..cb17fa4 100644 --- a/config/discover.ml +++ b/config/discover.ml @@ -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 -> @@ -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; diff --git a/config/dune b/config/dune index 613473c..0e0b6f5 100644 --- a/config/dune +++ b/config/dune @@ -1,3 +1,3 @@ (executable (name discover) - (libraries base stdio dune-configurator)) + (libraries sexplib0 dune-configurator)) diff --git a/dune-project b/dune-project index f2459ba..2e08fc3 100644 --- a/dune-project +++ b/dune-project @@ -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) )) diff --git a/gobject-introspection.opam b/gobject-introspection.opam index 9ef81fe..9539fa6 100644 --- a/gobject-introspection.opam +++ b/gobject-introspection.opam @@ -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: [ diff --git a/tests/dune b/tests/dune index 8c21565..0fa810f 100644 --- a/tests/dune +++ b/tests/dune @@ -1,3 +1,3 @@ (test (name test) - (libraries GObject_introspection ounit2 ctypes ctypes.foreign stdio)) + (libraries GObject_introspection ounit2 ctypes ctypes.foreign))