- Add upstream patch to unbreak the build against OCaml 4.03.0+

- When possible, use modern spelling of native types to make the
  diff for upcoming OCaml update less noisy
- While here, rephrase the COMMENT and assume maintainership
This commit is contained in:
Alexey Dokuchaev 2019-06-13 14:01:09 +00:00
parent e4b6cd74b6
commit f15ec9b7a2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=504094
2 changed files with 104 additions and 2 deletions

View File

@ -7,8 +7,10 @@ PORTREVISION= 2
CATEGORIES+= net-p2p
MASTER_SITES= SF
MAINTAINER?= ports@FreeBSD.org
COMMENT?= OCAML client for multiple peer-to-peer networks
EXTRA_PATCHES= ${FILESDIR}/git-30e77e2:-p1
MAINTAINER?= danfe@FreeBSD.org
COMMENT?= Multi-protocol peer-to-peer client written in OCaml
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/Copying.txt
@ -114,6 +116,11 @@ post-patch:
-e 's|http://www.bluetack.co.uk/config/antip2p.txt|http://www.bluetack.co.uk/config/level1.gz|' \
${WRKSRC}/src/daemon/common/commonOptions.ml \
${WRKSRC}/src/networks/donkey/donkeyServers.ml
@${REINPLACE_CMD} \
-e 's/[u(]int32/&_t/' ${WRKSRC}/src/utils/cdk/zlibstubs.c
@${REINPLACE_CMD} \
-e 's/int64/&_t/' ${WRKSRC}/src/config/unix/os_stubs_c.c \
${WRKSRC}/src/utils/lib/os_stubs.h
do-install:
.if ${PORT_OPTIONS:MCORE}

View File

@ -0,0 +1,95 @@
From 30e77e2571b9b11065be16ca3b88e5f139fec9e5 Mon Sep 17 00:00:00 2001
From: Bastien Dejean <nihilhill@gmail.com>
Date: Sun, 24 Jul 2016 11:44:53 +0200
Subject: [PATCH] Fix compilation with OCaml 4.03.0
---
src/networks/donkey/donkeyGlobals.ml | 1 -
src/utils/cdk/zip.ml | 2 --
src/utils/lib/options.ml4 | 41 +---------------------------
3 files changed, 1 insertion(+), 43 deletions(-)
diff --git a/src/networks/donkey/donkeyGlobals.ml b/src/networks/donkey/donkeyGlobals.ml
index 5125d018..1228830b 100644
--- a/src/networks/donkey/donkeyGlobals.ml
+++ b/src/networks/donkey/donkeyGlobals.ml
@@ -781,7 +781,6 @@ let set_client_name c name md4 =
c.client_md4 <- md4;
end
-exception ClientFound of client
let find_client_by_name name =
try
H.iter (fun c ->
diff --git a/src/utils/cdk/zip.ml b/src/utils/cdk/zip.ml
index 2ed4e068..32085a8c 100644
--- a/src/utils/cdk/zip.ml
+++ b/src/utils/cdk/zip.ml
@@ -72,8 +72,6 @@ type out_file =
mutable of_entries: entry list;
of_comment: string }
-exception Error of string * string * string
-
(* Return the position of the last occurrence of s1 in s2, or -1 if not
found. *)
diff --git a/src/utils/lib/options.ml4 b/src/utils/lib/options.ml4
index a5ae1f0c..be5ea347 100644
--- a/src/utils/lib/options.ml4
+++ b/src/utils/lib/options.ml4
@@ -330,45 +330,6 @@ the last defined one ("defined" in the order of the program execution).
let exit_exn = Exit
-
-let unsafe_get = String.unsafe_get
-external is_printable : char -> bool = "caml_is_printable"
-let unsafe_set = String.unsafe_set
-
-let escaped s =
- let n = ref 0 in
- for i = 0 to String.length s - 1 do
- n :=
- !n +
- (match unsafe_get s i with
- '"' | '\\' -> 2
- | '\n' | '\t' -> 1
- | c -> if is_printable c then 1 else 4)
- done;
- if !n = String.length s then s
- else
- let s' = String.create !n in
- n := 0;
- for i = 0 to String.length s - 1 do
- begin match unsafe_get s i with
- '"' | '\\' as c -> unsafe_set s' !n '\\'; incr n; unsafe_set s' !n c
- | '\n' | '\t' as c -> unsafe_set s' !n c
- | c ->
- if is_printable c then unsafe_set s' !n c
- else
- let a = int_of_char c in
- unsafe_set s' !n '\\';
- incr n;
- unsafe_set s' !n (char_of_int (48 + a / 100));
- incr n;
- unsafe_set s' !n (char_of_int (48 + a / 10 mod 10));
- incr n;
- unsafe_set s' !n (char_of_int (48 + a mod 10))
- end;
- incr n
- done;
- s'
-
let safe_string s =
if s = "" then "\"\""
else
@@ -388,7 +349,7 @@ let safe_string s =
s
else raise exit_exn
with
- _ -> Printf.sprintf "\"%s\"" (escaped s)
+ _ -> Printf.sprintf "\"%s\"" (String.escaped s)
let with_help = ref false
let save_private = ref false