File: context_flags.ml

package info (click to toggle)
opam 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,500 kB
  • sloc: ml: 61,414; sh: 2,963; ansic: 1,147; makefile: 479; sed: 6; csh: 1
file content (32 lines) | stat: -rw-r--r-- 1,059 bytes parent folder | download | duplicates (2)
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
#directory "+compiler-libs";;
#load "ocamlcommon.cma";;

let p = String.index Sys.ocaml_version '.' in
let _ocaml_major = String.sub Sys.ocaml_version 0 p |> int_of_string in
let p = succ p in
let _ocaml_minor = String.sub Sys.ocaml_version p (String.index_from Sys.ocaml_version p '.' - p) |> int_of_string in
match Sys.argv.(1) with
| "flags" ->
    print_string "()"
| "mingw-arch" ->
    if Config.system = "mingw64" then
      print_string "x86_64"
    else
      print_string "i686"
| "clibs" ->
    if Sys.win32 then
      let common =
        "-ladvapi32 -lgdi32 -luser32 -lshell32 -lole32 -luuid -luserenv"
      in
      if Config.system = "mingw" then
        (* This appears to be a packaging bug in i686-w64-mingw32, as
           GetFileVersionInfoEx and friends are include in the x86_64 copy of
           libversion.a *)
        Printf.printf "(%s -lwindowsapp)" common
      else
        Printf.printf "(%s)" common
    else
      print_string "()"
| _ ->
    Printf.eprintf "Unrecognised context instruction: %s\n" Sys.argv.(1);
    exit 1