git: 4c1e5cee8f0e - main - lang/mtasc: the port had been improved (+)
Alexey Dokuchaev
danfe at FreeBSD.org
Sat Sep 11 11:04:42 UTC 2021
The branch main has been updated by danfe:
URL: https://cgit.FreeBSD.org/ports/commit/?id=4c1e5cee8f0e3f7faf330ec9da80d6da57d0ff1c
commit 4c1e5cee8f0e3f7faf330ec9da80d6da57d0ff1c
Author: Alexey Dokuchaev <danfe at FreeBSD.org>
AuthorDate: 2021-09-11 11:01:12 +0000
Commit: Alexey Dokuchaev <danfe at FreeBSD.org>
CommitDate: 2021-09-11 11:02:40 +0000
lang/mtasc: the port had been improved (+)
- Unbreak against safe strings in OCaml 4.06+
- Define LICENSE (GNU GPL version 2 or later)
---
lang/mtasc/Makefile | 9 +++++++++
lang/mtasc/files/patch-extc_extc.ml | 34 +++++++++++++++++++++++++++++++++
lang/mtasc/files/patch-swflib_swfZip.ml | 18 +++++++++++++++++
3 files changed, 61 insertions(+)
diff --git a/lang/mtasc/Makefile b/lang/mtasc/Makefile
index d51def062697..96c0b5e9ad2b 100644
--- a/lang/mtasc/Makefile
+++ b/lang/mtasc/Makefile
@@ -9,6 +9,8 @@ MASTER_SITES= LOCAL/chinsan
MAINTAINER= saper at saper.info
COMMENT= Motion-Twin ActionScript 2 Compiler
+LICENSE= GPLv2+
+
BUILD_DEPENDS= ${LOCALBASE}/lib/ocaml/site-lib/extlib/IO.cmi:devel/ocaml-extlib
USE_OCAML= yes
@@ -32,6 +34,13 @@ PORTDATA= std std8
OPTIONS_DEFINE= DOCS EXAMPLES
+post-patch:
+ @${REINPLACE_CMD} -E 's,n(read|write) ch,n\1_string ch,' \
+ ${WRKSRC}/swflib/actionScript.ml \
+ ${WRKSRC}/swflib/as3code.ml \
+ ${WRKSRC}/swflib/as3parse.ml \
+ ${WRKSRC}/swflib/swfParser.ml
+
do-build:
(cd ${WRKSRC}/extc && \
${OCAMLOPT} ${WRKSRC}/extc/extc_stubs.c && \
diff --git a/lang/mtasc/files/patch-extc_extc.ml b/lang/mtasc/files/patch-extc_extc.ml
new file mode 100644
index 000000000000..53268b1d904c
--- /dev/null
+++ b/lang/mtasc/files/patch-extc_extc.ml
@@ -0,0 +1,34 @@
+--- extc/extc.ml.orig 2007-02-26 13:00:51 UTC
++++ extc/extc.ml
+@@ -34,11 +34,11 @@ type zresult = {
+ }
+
+ external zlib_deflate_init : int -> zstream = "zlib_deflate_init"
+-external zlib_deflate : zstream -> src:string -> spos:int -> slen:int -> dst:string -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_deflate_bytecode" "zlib_deflate"
++external zlib_deflate : zstream -> src:string -> spos:int -> slen:int -> dst:bytes -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_deflate_bytecode" "zlib_deflate"
+ external zlib_deflate_end : zstream -> unit = "zlib_deflate_end"
+
+ external zlib_inflate_init : unit -> zstream = "zlib_inflate_init"
+-external zlib_inflate : zstream -> src:string -> spos:int -> slen:int -> dst:string -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_inflate_bytecode" "zlib_inflate"
++external zlib_inflate : zstream -> src:string -> spos:int -> slen:int -> dst:bytes -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_inflate_bytecode" "zlib_inflate"
+ external zlib_inflate_end : zstream -> unit = "zlib_inflate_end"
+
+ external _executable_path : string -> string = "executable_path"
+@@ -60,7 +60,7 @@ let zlib_op op z str =
+ let rec loop pos len acc =
+ let r = op z ~src:str ~spos:pos ~slen:len ~dst:tmp ~dpos:0 ~dlen:bufsize (if len = 0 then Z_FINISH else Z_SYNC_FLUSH) in
+ total := !total + r.z_wrote;
+- let acc = String.sub tmp 0 r.z_wrote :: acc in
++ let acc = Bytes.sub_string tmp 0 r.z_wrote :: acc in
+ if r.z_finish then
+ acc
+ else
+@@ -74,7 +74,7 @@ let zlib_op op z str =
+ String.unsafe_blit s 0 big p l;
+ p
+ ) !total strings);
+- big
++ Bytes.unsafe_to_string big
+
+ let zip str =
+ let z = zlib_deflate_init 9 in
diff --git a/lang/mtasc/files/patch-swflib_swfZip.ml b/lang/mtasc/files/patch-swflib_swfZip.ml
new file mode 100644
index 000000000000..d1639b38f9f9
--- /dev/null
+++ b/lang/mtasc/files/patch-swflib_swfZip.ml
@@ -0,0 +1,18 @@
+--- swflib/swfZip.ml.orig 2004-11-03 02:38:17 UTC
++++ swflib/swfZip.ml
+@@ -24,13 +24,13 @@ let deflate o =
+ let buf = Buffer.create 0 in
+ let flush() =
+ let data = Buffer.contents buf in
+- IO.nwrite o (Extc.zip data);
++ IO.nwrite_string o (Extc.zip data);
+ IO.flush o;
+ Buffer.reset buf;
+ in
+ IO.create_out
+ ~write:(Buffer.add_char buf)
+- ~output:(fun s p l -> Buffer.add_substring buf s p l; l)
++ ~output:(fun s p l -> Buffer.add_subbytes buf s p l; l)
+ ~flush
+ ~close:(fun () -> flush(); IO.close_out o)
+
More information about the dev-commits-ports-all
mailing list