From ba46bc4c60ae4d3c7cf56ff0c5e5125e26c09063 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 17 Apr 2018 12:33:03 +0100 Subject: [PATCH] Remove OCaml 4.06-isms from the code. --- labltk-8.06.4-remove-ocaml-406-isms.patch | 52 +++++++++++++++++++++++ ocaml-labltk.spec | 4 ++ 2 files changed, 56 insertions(+) create mode 100644 labltk-8.06.4-remove-ocaml-406-isms.patch diff --git a/labltk-8.06.4-remove-ocaml-406-isms.patch b/labltk-8.06.4-remove-ocaml-406-isms.patch new file mode 100644 index 0000000..82621d4 --- /dev/null +++ b/labltk-8.06.4-remove-ocaml-406-isms.patch @@ -0,0 +1,52 @@ +diff -ur labltk-8.06.4.old/builtin/rawimg.ml labltk-8.06.4/builtin/rawimg.ml +--- labltk-8.06.4.old/builtin/rawimg.ml 2017-10-30 09:19:07.000000000 +0000 ++++ labltk-8.06.4/builtin/rawimg.ml 2018-04-17 12:30:40.687146757 +0100 +@@ -10,8 +10,6 @@ + pixmap_data: bytes + } + +-let (.![]<-) = Bytes.set +- + type pixel = string (* 3 chars *) + + (* pixmap will be an abstract type *) +@@ -74,9 +72,9 @@ + (* Char.chr does range checking *) + let pixel r g b = + let s = Bytes.create 3 in +- s.![0] <- Char.chr r; +- s.![1] <- Char.chr g; +- s.![2] <- Char.chr b; ++ Bytes.set s 0 (Char.chr r); ++ Bytes.set s 1 (Char.chr g); ++ Bytes.set s 2 (Char.chr b); + Bytes.unsafe_to_string s + + ##ifdef CAMLTK +diff -ur labltk-8.06.4.old/compiler/printer.ml labltk-8.06.4/compiler/printer.ml +--- labltk-8.06.4.old/compiler/printer.ml 2017-10-30 09:19:07.000000000 +0000 ++++ labltk-8.06.4/compiler/printer.ml 2018-04-17 12:28:51.853254250 +0100 +@@ -18,8 +18,6 @@ + + open Format;; + +-let (.![]<-) = Bytes.set ;; +- + let escape_string s = + let more = ref 0 in + for i = 0 to String.length s - 1 do +@@ -33,8 +31,12 @@ + for i = 0 to String.length s - 1 do + let c = s.[i] in + match c with +- | '\\' | '\"' |'\'' -> res.![!j] <- '\\'; incr j; res.![!j] <- c; incr j +- | _ -> res.![!j] <- c; incr j ++ | '\\' | '\"' |'\'' -> ++ Bytes.set res !j '\\'; ++ incr j; ++ Bytes.set res !j c; ++ incr j ++ | _ -> Bytes.set res !j c; incr j + done; + Bytes.to_string res + ;; diff --git a/ocaml-labltk.spec b/ocaml-labltk.spec index 37cec03..f89fead 100644 --- a/ocaml-labltk.spec +++ b/ocaml-labltk.spec @@ -19,6 +19,9 @@ Source0: https://forge.ocamlcore.org/frs/download.php/1727/labltk-8.06.4.t Patch1: labltk-8.06.0-enable-debugging.patch Patch2: labltk-8.06.4-enable-more-debugging.patch +# Remove some OCaml 4.06-isms. +Patch3: labltk-8.06.4-remove-ocaml-406-isms.patch + BuildRequires: ocaml BuildRequires: tcl-devel, tk-devel @@ -46,6 +49,7 @@ This package contains the development files. %patch1 -p1 %patch2 -p1 +%patch3 -p1 # Remove version control files which might get copied into documentation. find -name .gitignore -delete