Skip to content

Commit 469cb75

Browse files
committed
Revert PMP's fix of rocq-prover#2498, which introduces an incompatibility with lablgtk
2.14. Debian ships with lablgtk 2.16 only since a few months, so we apply the fix to trunk instead. This reverts commits: 490160d. ef8718a. 6f9cc3a. 901a9b2.
1 parent c377938 commit 469cb75

File tree

3 files changed

+14
-69
lines changed

3 files changed

+14
-69
lines changed

INSTALL.ide

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ COMPILATION REQUIREMENTS
3939
install GTK+ 2.x, should you need to force it for one reason
4040
or another.)
4141
- The OCaml bindings for GTK+ 2.x, lablgtk2 with support for gtksourceview2.
42-
You need at least version 2.16.
42+
You need at least version 2.14.2.
4343

4444
Your distribution may contain precompiled packages. For example, for
4545
Debian, run

configure.ml

+9-41
Original file line numberDiff line numberDiff line change
@@ -719,18 +719,10 @@ let operating_system, osdeplibs =
719719

720720
(** * lablgtk2 and CoqIDE *)
721721

722-
type source = Manual | OCamlFind | Stdlib
723-
724-
let get_source = function
725-
| Manual -> "manually provided"
726-
| OCamlFind -> "via ocamlfind"
727-
| Stdlib -> "in OCaml library"
728-
729722
(** Is some location a suitable LablGtk2 installation ? *)
730723

731-
let check_lablgtkdir ?(fatal=false) src dir =
724+
let check_lablgtkdir ?(fatal=false) msg dir =
732725
let yell msg = if fatal then die msg else (printf "%s\n" msg; false) in
733-
let msg = get_source src in
734726
if not (dir_exists dir) then
735727
yell (sprintf "No such directory '%s' (%s)." dir msg)
736728
else if not (Sys.file_exists (dir/"gSourceView2.cmi")) then
@@ -744,46 +736,22 @@ let check_lablgtkdir ?(fatal=false) src dir =
744736
let get_lablgtkdir () =
745737
match !Prefs.lablgtkdir with
746738
| Some dir ->
747-
let msg = Manual in
739+
let msg = "manually provided" in
748740
if check_lablgtkdir ~fatal:true msg dir then dir, msg
749-
else "", msg
741+
else "", ""
750742
| None ->
751-
let msg = OCamlFind in
743+
let msg = "via ocamlfind" in
752744
let d1,_ = tryrun "ocamlfind" ["query";"lablgtk2.sourceview2"] in
753745
if d1 <> "" && check_lablgtkdir msg d1 then d1, msg
754746
else
755747
(* In debian wheezy, ocamlfind knows only of lablgtk2 *)
756748
let d2,_ = tryrun "ocamlfind" ["query";"lablgtk2"] in
757749
if d2 <> "" && d2 <> d1 && check_lablgtkdir msg d2 then d2, msg
758750
else
759-
let msg = Stdlib in
751+
let msg = "in OCaml library" in
760752
let d3 = camllib^"/lablgtk2" in
761753
if check_lablgtkdir msg d3 then d3, msg
762-
else "", msg
763-
764-
(** Detect and/or verify the Lablgtk2 version *)
765-
766-
let check_lablgtk_version src dir = match src with
767-
| Manual | Stdlib ->
768-
let test accu f =
769-
if accu then
770-
let test = sprintf "grep -q -w %s %S/glib.mli" f dir in
771-
Sys.command test = 0
772-
else false
773-
in
774-
let heuristics = [
775-
"convert_with_fallback";
776-
"wrap_poll_func"; (** Introduced in lablgtk 2.16 *)
777-
] in
778-
let ans = List.fold_left test true heuristics in
779-
if ans then printf "Warning: could not check the version of lablgtk2.\n";
780-
(ans, "an unknown version")
781-
| OCamlFind ->
782-
let v, _ = tryrun "ocamlfind" ["query"; "-format"; "%v"; "lablgtk2"] in
783-
try
784-
let vi = List.map s2i (numeric_prefix_list v) in
785-
([2; 16] <= vi, v)
786-
with _ -> (false, v)
754+
else "", ""
787755

788756
let pr_ide = function No -> "no" | Byte -> "only bytecode" | Opt -> "native"
789757

@@ -807,9 +775,9 @@ let check_coqide () =
807775
if !Prefs.coqide = Some No then set_ide No "CoqIde manually disabled";
808776
let dir, via = get_lablgtkdir () in
809777
if dir = "" then set_ide No "LablGtk2 not found";
810-
let (ok, version) = check_lablgtk_version via dir in
811-
let found = sprintf "LablGtk2 found (%s, %s)" (get_source via) version in
812-
if not ok then set_ide No (found^", but too old (required >= 2.16, found " ^ version ^ ")");
778+
let found = sprintf "LablGtk2 found (%s)" via in
779+
let test = sprintf "grep -q -w convert_with_fallback %S/glib.mli" dir in
780+
if Sys.command test <> 0 then set_ide No (found^" but too old");
813781
(* We're now sure to produce at least one kind of coqide *)
814782
lablgtkdir := shorten_camllib dir;
815783
if !Prefs.coqide = Some Byte then set_ide Byte (found^", bytecode requested");

ide/preferences.ml

+4-27
Original file line numberDiff line numberDiff line change
@@ -711,61 +711,38 @@ let configure ?(apply=(fun () -> ())) () =
711711
~f:(fun s -> current.project_file_name <- s)
712712
current.project_file_name
713713
in
714-
let update_modifiers prefix mds =
715-
let change ~path ~key ~modi ~changed =
716-
if CString.is_sub prefix path 0 then
717-
ignore (GtkData.AccelMap.change_entry ~key ~modi:mds ~replace:true path)
718-
in
719-
GtkData.AccelMap.foreach change
720-
in
721714
let help_string =
722715
"restart to apply"
723716
in
724717
let the_valid_mod = str_to_mod_list current.modifiers_valid in
725718
let modifier_for_tactics =
726-
let cb l =
727-
current.modifier_for_tactics <- mod_list_to_str l;
728-
update_modifiers "<Actions>/Tactics/" l
729-
in
730719
modifiers
731720
~allow:the_valid_mod
732-
~f:cb
721+
~f:(fun l -> current.modifier_for_tactics <- mod_list_to_str l)
733722
~help:help_string
734723
"Modifiers for Tactics Menu"
735724
(str_to_mod_list current.modifier_for_tactics)
736725
in
737726
let modifier_for_templates =
738-
let cb l =
739-
current.modifier_for_templates <- mod_list_to_str l;
740-
update_modifiers "<Actions>/Templates/" l
741-
in
742727
modifiers
743728
~allow:the_valid_mod
744-
~f:cb
729+
~f:(fun l -> current.modifier_for_templates <- mod_list_to_str l)
745730
~help:help_string
746731
"Modifiers for Templates Menu"
747732
(str_to_mod_list current.modifier_for_templates)
748733
in
749734
let modifier_for_navigation =
750-
let cb l =
751-
current.modifier_for_navigation <- mod_list_to_str l;
752-
update_modifiers "<Actions>/Navigation/" l
753-
in
754735
modifiers
755736
~allow:the_valid_mod
756-
~f:cb
737+
~f:(fun l -> current.modifier_for_navigation <- mod_list_to_str l)
757738
~help:help_string
758739
"Modifiers for Navigation Menu"
759740
(str_to_mod_list current.modifier_for_navigation)
760741
in
761742
let modifier_for_display =
762-
let cb l =
763-
current.modifier_for_display <- mod_list_to_str l;
764-
update_modifiers "<Actions>/View/" l
765-
in
766743
modifiers
767744
~allow:the_valid_mod
768-
~f:cb
745+
~f:(fun l -> current.modifier_for_display <- mod_list_to_str l)
769746
~help:help_string
770747
"Modifiers for View Menu"
771748
(str_to_mod_list current.modifier_for_display)

0 commit comments

Comments
 (0)