ocaml-gettext/0006-ocaml-gettext-Use-cpp-instead-of-camlp4-for-ifdef-ma.patch
Richard W.M. Jones bf0bebee85 Remove camlp4 dependency.
Add all upstream patches since 0.3.7.
2019-07-19 10:54:04 +01:00

107 lines
3.4 KiB
Diff

From 2894761bcccf8d51c87f8f0470ed7514a94dca9e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 12 Jul 2019 16:03:04 +0100
Subject: [PATCH 6/9] ocaml-gettext: Use cpp instead of camlp4 for #ifdef
macros.
This requires some small changes to multiline strings to allow them to
pass through cpp without error or warning.
---
ocaml-gettext/Makefile | 4 ++--
ocaml-gettext/OCamlGettext.ml | 33 +++++++++++++++++----------------
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/ocaml-gettext/Makefile b/ocaml-gettext/Makefile
index 3858ea8..d5f37fa 100644
--- a/ocaml-gettext/Makefile
+++ b/ocaml-gettext/Makefile
@@ -41,12 +41,12 @@ REQUIRES = gettext.extension fileutils
ifeq ($(GETTEXT_MODULES),CAMOMILE)
REQUIRES += gettext-camomile
-INCLUDES += -pp 'camlp4o -I +camlp4 pa_macro.cmo -DCAMOMILE'
+INCLUDES += -pp 'cpp -DCAMOMILE'
endif
ifeq ($(GETTEXT_MODULES),STUB)
REQUIRES += gettext-stub
-INCLUDES += -pp 'camlp4o -I +camlp4 pa_macro.cmo -DSTUB'
+INCLUDES += -pp 'cpp -DSTUB'
endif
include ../TopMakefile
diff --git a/ocaml-gettext/OCamlGettext.ml b/ocaml-gettext/OCamlGettext.ml
index 6e72971..837057e 100644
--- a/ocaml-gettext/OCamlGettext.ml
+++ b/ocaml-gettext/OCamlGettext.ml
@@ -36,14 +36,15 @@ open GettextCategory;;
open GettextUtils;;
open FilePath.DefaultPath;;
-IFDEF CAMOMILE THEN
+#ifdef CAMOMILE
module OcamlGettextRealize = GettextCamomile.Open
-ELSE IFDEF STUB THEN
+#else
+#ifdef STUB
module OcamlGettextRealize = GettextStub.Native
-ELSE
+#else
module OcamlGettextRealize = GettextDummy.Dummy
-ENDIF
-ENDIF
+#endif
+#endif
;;
module OcamlGettext = Gettext.Program
@@ -104,12 +105,12 @@ let string_of_exception exc =
(s_ "You must specify one action.")
| InstallUninstallTooManyFilename ->
(s_
-"You cannot specify at the same time a language, a textdomain
-and provide more than one file to install/uninstall : all files
+"You cannot specify at the same time a language, a textdomain\n\
+and provide more than one file to install/uninstall : all files\n\
will have the same destination filename.")
| CompileTooManyFilename ->
(s_
-"You cannot specify a output filename and more than one
+"You cannot specify a output filename and more than one\n\
filename : all the compiled file will have the same output filename")
| _ ->
Gettext.string_of_exception exc
@@ -197,8 +198,8 @@ let guess_language_textdomain (language_option,textdomain_option) lst =
in
* (((chop_extension str_reduce), (get_extension str_reduce)),fl_mo)*)
raise (Failure
-"FilePath suffers from a default with the handling of
-chop/get_extension. This bug should disappears with
+"FilePath suffers from a default with the handling of\n\
+chop/get_extension. This bug should disappears with\n\
newer version of ocaml-fileutils")
) lst
;;
@@ -526,12 +527,12 @@ let () =
t := { !t with input_files = str :: !t.input_files }
)
(
- spf (f_ "%s
-
-Command: ocaml-gettext -action (%s) [options]
-When trying to guess language and textdomain from a
-MO file, the rules applied are: language.textdomain.mo
-
+ spf (f_ "%s\n\
+\n\
+Command: ocaml-gettext -action (%s) [options]\n\
+When trying to guess language and textdomain from a\n\
+MO file, the rules applied are: language.textdomain.mo\n\
+\n\
Options:")
gettext_copyright
(String.concat "|" (List.map fst actions))
--
2.22.0