diff --git a/0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch b/0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch index 0c49ab5..3fe155b 100644 --- a/0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch +++ b/0001-pr_gettext-stop-tracking-and-printing-untranslated-s.patch @@ -1,7 +1,7 @@ From 35d2d7381c7101bb73d0b7f00fea06442c7b2ab8 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 29 Aug 2017 18:29:34 +0200 -Subject: [PATCH 1/9] pr_gettext: stop tracking (and printing) untranslated +Subject: [PATCH 01/11] pr_gettext: stop tracking (and printing) untranslated strings Do not collect anymore the information of untranslated strings, since it diff --git a/0002-pr_gettext-stop-printing-extracted-strings.patch b/0002-pr_gettext-stop-printing-extracted-strings.patch index e327c2e..bcc5d8f 100644 --- a/0002-pr_gettext-stop-printing-extracted-strings.patch +++ b/0002-pr_gettext-stop-printing-extracted-strings.patch @@ -1,7 +1,7 @@ From 3f4fc73c2a0315c2da16dee7db0fcb2766f55d3c Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 29 Aug 2017 18:36:10 +0200 -Subject: [PATCH 2/9] pr_gettext: stop printing extracted strings +Subject: [PATCH 02/11] pr_gettext: stop printing extracted strings They are written in the pot file already, no need to print them to stderr (even though they are not errors). diff --git a/0003-add-more-generated-files-to-.gitignore.patch b/0003-add-more-generated-files-to-.gitignore.patch index 5a98d58..1fcf3a8 100644 --- a/0003-add-more-generated-files-to-.gitignore.patch +++ b/0003-add-more-generated-files-to-.gitignore.patch @@ -1,7 +1,7 @@ From 202bf1e00eaa533e133c29b509d77cdfb7c13f5e Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 29 Aug 2017 18:55:37 +0200 -Subject: [PATCH 3/9] add more generated files to .gitignore +Subject: [PATCH 03/11] add more generated files to .gitignore Make sure all the files generated during a build are properly ignored from the git status. diff --git a/0004-.gitignore-Add-a-few-more-ignored-files-and-director.patch b/0004-.gitignore-Add-a-few-more-ignored-files-and-director.patch index a83e7de..4765db2 100644 --- a/0004-.gitignore-Add-a-few-more-ignored-files-and-director.patch +++ b/0004-.gitignore-Add-a-few-more-ignored-files-and-director.patch @@ -1,7 +1,8 @@ From b1d775dd3b59f844a89603cfcc154dd18aea6202 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 12 Jul 2019 16:12:14 +0100 -Subject: [PATCH 4/9] .gitignore: Add a few more ignored files and directories. +Subject: [PATCH 04/11] .gitignore: Add a few more ignored files and + directories. --- .gitignore | 25 ++++++++++++++----------- diff --git a/0005-Miscellaneous-changes-to-remove-deprecated-features.patch b/0005-Miscellaneous-changes-to-remove-deprecated-features.patch index 058a364..904448b 100644 --- a/0005-Miscellaneous-changes-to-remove-deprecated-features.patch +++ b/0005-Miscellaneous-changes-to-remove-deprecated-features.patch @@ -1,7 +1,7 @@ From 685abfdad5f66b8df3ddf0713f7d3ba733b56b60 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 12 Jul 2019 13:50:31 +0100 -Subject: [PATCH 5/9] Miscellaneous changes to remove deprecated features. +Subject: [PATCH 05/11] Miscellaneous changes to remove deprecated features. - Use Bytes instead of mutable strings. - Use String.uppercase_ascii instead of String.uppercase. diff --git a/0006-ocaml-gettext-Use-cpp-instead-of-camlp4-for-ifdef-ma.patch b/0006-ocaml-gettext-Use-cpp-instead-of-camlp4-for-ifdef-ma.patch index 1ed4615..97235e4 100644 --- a/0006-ocaml-gettext-Use-cpp-instead-of-camlp4-for-ifdef-ma.patch +++ b/0006-ocaml-gettext-Use-cpp-instead-of-camlp4-for-ifdef-ma.patch @@ -1,7 +1,7 @@ From 2894761bcccf8d51c87f8f0470ed7514a94dca9e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 12 Jul 2019 16:03:04 +0100 -Subject: [PATCH 6/9] ocaml-gettext: Use cpp instead of camlp4 for #ifdef +Subject: [PATCH 06/11] ocaml-gettext: Use cpp instead of camlp4 for #ifdef macros. This requires some small changes to multiline strings to allow them to diff --git a/0007-Fix-warnings-in-newer-OCaml.patch b/0007-Fix-warnings-in-newer-OCaml.patch index 409a0ce..c4cf09f 100644 --- a/0007-Fix-warnings-in-newer-OCaml.patch +++ b/0007-Fix-warnings-in-newer-OCaml.patch @@ -1,7 +1,7 @@ From 399cf541e2abde8053b7ce39650f745c8bab8c44 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 18 Jul 2019 13:18:35 +0100 -Subject: [PATCH 7/9] Fix warnings in newer OCaml. +Subject: [PATCH 07/11] Fix warnings in newer OCaml. File "../libgettext-ocaml/gettextMo.ml", line 259, characters 13-36: 259 | | Failure("lexing: empty token") -> diff --git a/0008-Fix-probable-incorrect-definition-of-unit-type.patch b/0008-Fix-probable-incorrect-definition-of-unit-type.patch index 00e0bb7..aa598be 100644 --- a/0008-Fix-probable-incorrect-definition-of-unit-type.patch +++ b/0008-Fix-probable-incorrect-definition-of-unit-type.patch @@ -1,7 +1,7 @@ From 1ac10b2d4ee97e490880dbf8e70842f771c4e02e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 18 Jul 2019 13:20:50 +0100 -Subject: [PATCH 8/9] Fix probable incorrect definition of unit type. +Subject: [PATCH 08/11] Fix probable incorrect definition of unit type. echo File "../libgettext-ocaml/gettextCharset.ml", line 48, characters 4-15: 48 | type u = () diff --git a/0009-Convert-from-camlp4-to-ppx-for-translatable-string-e.patch b/0009-Convert-from-camlp4-to-ppx-for-translatable-string-e.patch index 6358c20..3699302 100644 --- a/0009-Convert-from-camlp4-to-ppx-for-translatable-string-e.patch +++ b/0009-Convert-from-camlp4-to-ppx-for-translatable-string-e.patch @@ -1,7 +1,7 @@ From 739e3a900993299e7e8b90af3da565417eb84412 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 12 Jul 2019 16:02:16 +0100 -Subject: [PATCH 9/9] Convert from camlp4 to ppx for translatable string +Subject: [PATCH 09/11] Convert from camlp4 to ppx for translatable string extraction. --- diff --git a/0010-xgettext-Print-filename-when-exceptions-are-thrown.patch b/0010-xgettext-Print-filename-when-exceptions-are-thrown.patch new file mode 100644 index 0000000..3bde6c1 --- /dev/null +++ b/0010-xgettext-Print-filename-when-exceptions-are-thrown.patch @@ -0,0 +1,33 @@ +From 5030d465a8b7b8232b3559d48cf9aba592efefab Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 19 Jul 2019 11:23:09 +0100 +Subject: [PATCH 10/11] xgettext: Print filename when exceptions are thrown. + +--- + ocaml-gettext/xgettext.ml | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/ocaml-gettext/xgettext.ml b/ocaml-gettext/xgettext.ml +index 76232d8..569d40d 100644 +--- a/ocaml-gettext/xgettext.ml ++++ b/ocaml-gettext/xgettext.ml +@@ -218,9 +218,13 @@ let ast_iterator = + + let go fn = + current_file := fn; +- let lexbuf = Lexing.from_channel (open_in fn) in +- let structure = Parse.implementation lexbuf in +- ast_iterator.Ast_iterator.structure ast_iterator structure ++ try ++ let lexbuf = Lexing.from_channel (open_in fn) in ++ let structure = Parse.implementation lexbuf in ++ ast_iterator.Ast_iterator.structure ast_iterator structure ++ with ++ exn -> ++ failwith (fn ^ ": " ^ Printexc.to_string exn) + + let () = + (* XXX Add -default-textdomain option which sets default_textdomain. *) +-- +2.22.0 + diff --git a/0011-xgettext-Remove-attempt-to-convert-strings-from-OCam.patch b/0011-xgettext-Remove-attempt-to-convert-strings-from-OCam.patch new file mode 100644 index 0000000..43395cf --- /dev/null +++ b/0011-xgettext-Remove-attempt-to-convert-strings-from-OCam.patch @@ -0,0 +1,61 @@ +From e15ca7b11c6da676097c1458df8306355044e817 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 19 Jul 2019 11:34:28 +0100 +Subject: [PATCH 11/11] xgettext: Remove attempt to convert strings from "OCaml + strings" to strings. + +--- + ocaml-gettext/xgettext.ml | 20 ++++---------------- + 1 file changed, 4 insertions(+), 16 deletions(-) + +diff --git a/ocaml-gettext/xgettext.ml b/ocaml-gettext/xgettext.ml +index 569d40d..111514c 100644 +--- a/ocaml-gettext/xgettext.ml ++++ b/ocaml-gettext/xgettext.ml +@@ -63,19 +63,13 @@ type t = { + translated: SetString.t; + } + +-let string_of_ocaml_string str = +- Scanf.sscanf +- (Printf.sprintf "\"%s\"" str) +- "%S" +- (fun s -> s) +- + let translations = ref { po_content = empty_po; translated = SetString.empty } + + let default_textdomain = ref None + + let current_file = ref "" + +-let add_translation loc ocaml_singular plural_opt domain = ++let add_translation loc singular plural_opt domain = + let t = !translations in + + let filepos = +@@ -85,19 +79,13 @@ let add_translation loc ocaml_singular plural_opt domain = + | fname -> fname in + fname, start.Lexing.pos_lnum + in +- let singular = +- string_of_ocaml_string ocaml_singular +- in + let translated = +- SetString.add ocaml_singular t.translated ++ SetString.add singular t.translated + in + let translated, translation = + match plural_opt with +- | Some ocaml_plural -> +- let plural = +- string_of_ocaml_string ocaml_plural +- in +- SetString.add ocaml_plural translated, ++ | Some plural -> ++ SetString.add plural translated, + { + po_comment_special = []; + po_comment_filepos = [filepos]; +-- +2.22.0 + diff --git a/ocaml-gettext.spec b/ocaml-gettext.spec index 605bc11..47d21a2 100644 --- a/ocaml-gettext.spec +++ b/ocaml-gettext.spec @@ -2,7 +2,7 @@ Name: ocaml-gettext Version: 0.3.7 -Release: 8%{?dist} +Release: 9%{?dist} Summary: OCaml library for i18n License: LGPLv2+ with exceptions @@ -25,6 +25,10 @@ Patch0007: 0007-Fix-warnings-in-newer-OCaml.patch Patch0008: 0008-Fix-probable-incorrect-definition-of-unit-type.patch Patch0009: 0009-Convert-from-camlp4-to-ppx-for-translatable-string-e.patch +# https://github.com/gildor478/ocaml-gettext/pull/5 +Patch0010: 0010-xgettext-Print-filename-when-exceptions-are-thrown.patch +Patch0011: 0011-xgettext-Remove-attempt-to-convert-strings-from-OCam.patch + BuildRequires: ocaml >= 4.00.1 BuildRequires: ocaml-findlib-devel >= 1.3.3-3 BuildRequires: ocaml-compiler-libs @@ -218,7 +222,7 @@ chrpath --delete $OCAMLFIND_DESTDIR/stublibs/dll*.so %changelog -* Fri Jul 19 2019 Richard W.M. Jones - 0.3.7-8 +* Fri Jul 19 2019 Richard W.M. Jones - 0.3.7-9 - Remove camlp4 dependency. - Add all upstream patches since 0.3.7.