[Pkg-ocaml-maint-commits] [SCM] ocamlviz packaging branch, ocamlbuild, updated. upstream/1.01-15-g77f7f66
Mehdi Dogguy
mehdi at debian.org
Fri Mar 26 09:17:20 UTC 2010
The following commit has been merged in the ocamlbuild branch:
commit 77f7f667ede37383c35420dcb7491753a9625a6f
Author: Mehdi Dogguy <mehdi at debian.org>
Date: Fri Mar 26 10:15:01 2010 +0100
Disable gui when lablgtk2 or cairo is not available
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index af985fb..05d7497 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -17,9 +17,6 @@ open Ocamlbuild_plugin
exception Require_findlib
exception Missing_findlib_package of string
-let libs = [ "libocamlviz" ]
-let bin = [ "gui"; "ascii" ]
-
let try_exec command =
try
let () = Command.execute ~quiet:true (Cmd(S[Sh command; Sh"> /dev/null"; Sh"2> /dev/null"])) in
@@ -32,12 +29,11 @@ let substitute env text =
let __ x = Printf.sprintf x
-let require pkg =
- if not (try_exec (__ "ocamlfind query %s" pkg)) then
- raise (Missing_findlib_package pkg)
-
let have_native = try_exec "ocamlopt -version"
let have_threads = try_exec "ocamlfind query threads"
+let have_lablgtk2 = try_exec "ocamlfind query lablgtk2"
+let have_cairo = try_exec "ocamlfind query cairo.lablgtk2"
+let have_gui = have_cairo && have_lablgtk2
let best = if have_native then "native" else "byte"
let ocamlbest = if have_native then Options.ocamlopt else Options.ocamlc
let _ = if not (try_exec "ocamlfind printconf") then raise Require_findlib
@@ -49,8 +45,6 @@ let findlib_packages = [
"cairo.lablgtk2";
]
-let _ = List.iter require findlib_packages
-
let unit_path suffix name =
__ "src/%s.%s" name suffix
let test_path suffix name =
@@ -94,8 +88,12 @@ let _ =
let pa_ocamlviz = "camlp4/pa_ocamlviz.cmo" in
let cma = unit_path "cma" "libocamlviz" in
let cmxa = unit_path "cmxa" "libocamlviz" in
- let native = [ cmxa; ascii_native; gui_native ] in
- let byte = [ cma; ascii_byte; gui_byte; pa_ocamlviz ] in
+ let native =
+ (if have_gui then [ gui_native ] else [])
+ @ [ cmxa; ascii_native ] in
+ let byte =
+ (if have_gui then [ gui_byte ] else [])
+ @ [ cma; ascii_byte; pa_ocamlviz ] in
(* Use -linkpkg when linking *)
flag ["ocaml"; "link"; "program"] & A"-linkpkg";
--
ocamlviz packaging
More information about the Pkg-ocaml-maint-commits
mailing list