Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the os string in the main configuration file.

So 'opam config -var os' now returns the detected OS kind.
  • Loading branch information...
commit 59a5c0781e7fffa4940148601dbf45c3c0ae04c2 1 parent 0e5feaa
@samoht samoht authored
Showing with 15 additions and 3 deletions.
  1. +1 −0  src/client.ml
  2. +14 −3 src/globals.ml.in
View
1  src/client.ml
@@ -298,6 +298,7 @@ let install_conf_ocaml_config t =
("user" , try (Unix.getpwuid (Unix.getuid ())).Unix.pw_name with _ -> "user");
("group", try (Unix.getgrgid (Unix.getgid ())).Unix.gr_name with _ -> "group");
("make" , !Globals.makecmd);
+ ("os" , Globals.os_string);
] in
let config = File.Dot_config.create vars in
View
17 src/globals.ml.in
@@ -63,7 +63,7 @@ let warning fmt =
) fmt
exception Exit of int
-
+
let error_and_exit fmt =
Printf.ksprintf (fun str ->
error "%s" str;
@@ -77,7 +77,7 @@ let msg fmt =
Printf.printf "%s%!" str
) fmt
-type os =
+type os =
| Darwin
| Linux
| FreeBSD
@@ -85,6 +85,7 @@ type os =
| Cygwin
| Win32
| Unix
+ | Other of string
let os = match Sys.os_type with
| "Unix" -> begin
@@ -97,7 +98,17 @@ let os = match Sys.os_type with
end
| "Win32" -> Win32
| "Cygwin" -> Cygwin
- | _ -> assert false
+ | s -> Other s
+
+let os_string = match os with
+ | Darwin -> "darwin"
+ | Linux -> "linux"
+ | FreeBSD
+ | OpenBSD -> "bsd"
+ | Cygwin -> "cygwin"
+ | Win32 -> "win32"
+ | Unix -> "unix"
+ | Other x -> x
let makecmd = ref (match os with FreeBSD | OpenBSD -> "gmake" | _ -> "make") (* WARNING check the result of "which gmake", "which make", ... *)
Please sign in to comment.
Something went wrong with that request. Please try again.