Subject: [alpine-aports] [PATCH v2 1/3] community/ocaml-findlib: move from testing

From: Jean-Louis Fuchs <[email-masked]>
Date: Sat, 29 Apr 2017 15:08:37 +0200

---
Moving dependencies of unison, tested by removing testing from my build 
docker-image and testing the resulting unison.

 {testing => community}/ocaml-findlib/APKBUILD       | 0
 {testing => community}/ocaml-findlib/Makefile.patch | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename {testing => community}/ocaml-findlib/APKBUILD (100%)
 rename {testing => community}/ocaml-findlib/Makefile.patch (100%)

diff --git a/testing/ocaml-findlib/APKBUILD b/community/ocaml-findlib/APKBUILD
similarity index 100%
rename from testing/ocaml-findlib/APKBUILD
rename to community/ocaml-findlib/APKBUILD
diff --git a/testing/ocaml-findlib/Makefile.patch b/community/ocaml-findlib/Makefile.patch
similarity index 100%
rename from testing/ocaml-findlib/Makefile.patch
rename to community/ocaml-findlib/Makefile.patch
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Sat, 29 Apr 2017 15:08:38 +0200

---

 {testing => community}/lablgtk/APKBUILD | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename {testing => community}/lablgtk/APKBUILD (100%)

diff --git a/testing/lablgtk/APKBUILD b/community/lablgtk/APKBUILD
similarity index 100%
rename from testing/lablgtk/APKBUILD
rename to community/lablgtk/APKBUILD
-- 
2.11.1

---

---

From: Jean-Louis Fuchs <[email-masked]>
Date: Sat, 29 Apr 2017 15:08:39 +0200

---
Moving unison with its dependencies.

 {testing => community}/unison/APKBUILD             | 33 +++++++++-------
 .../unison/fix_inotify_check.patch                 |  0
 community/unison/marshalling.patch                 | 16 ++++++++
 testing/unison/bytearray_stubs_c.patch             | 45 ----------------------
 4 files changed, 35 insertions(+), 59 deletions(-)
 rename {testing => community}/unison/APKBUILD (67%)
 rename {testing => community}/unison/fix_inotify_check.patch (100%)
 create mode 100644 community/unison/marshalling.patch
 delete mode 100644 testing/unison/bytearray_stubs_c.patch

diff --git a/testing/unison/APKBUILD b/community/unison/APKBUILD
similarity index 67%
rename from testing/unison/APKBUILD
rename to community/unison/APKBUILD
index 1039b742d5..0150413df3 100644
--- a/testing/unison/APKBUILD
+++ b/community/unison/APKBUILD
@@ -2,38 +2,43 @@
 # Maintainer: Jean-Louis Fuchs <[email-masked]>
 pkgname=unison
 pkgver=2.48.4
-pkgrel=2
+pkgrel=3
 pkgdesc="Unison - efficient file-synchronization tool"
 url="https://www.cis.upenn.edu/~bcpierce/unison/"
 # ocaml is not built for x86, armhf
 # lablgtk is not built for aarch64
 arch="all !x86 !armhf !aarch64"
 license="GPL"
-depends=""
 makedepends="ocaml lablgtk-dev linux-headers emacs-nox"
-install=""
 subpackages="$pkgname-doc"
 source="http://www.seas.upenn.edu/~bcpierce/unison/download/releases/stable/unison-$pkgver.tar.gz
 	http://www.seas.upenn.edu/~bcpierce/unison/download/releases/stable/unison-$pkgver-manual.html
 	fix_inotify_check.patch
-	bytearray_stubs_c.patch"
+	marshalling.patch"
+# TODO: Enable check once this issue is fixed:
+# https://github.com/bcpierce00/unison/issues/73
+options="!check"
 builddir="$srcdir/src"
 
 build() {
 	cd "$builddir"
-	# ocamlopt doesn't know -Os nor -fomit-frame-pointer
-	export CFLAGS="-ccopt -Os -ccopt -fomit-frame-pointer"
+	# ocamlopt is a front-end for gcc which will create optimized ocaml
+	# binaries. It will call gcc, but it hasn't implemented all gcc options.
+	# -ccopt is the way to pass arbitrary options.
+	local _cflags=""
+	for i in $CFLAGS; do _cflags="$_cflags -ccopt $i"; done
+	export CFLAGS="$_cflags"
 	for ui in text gtk2; do
 		make -j1 clean
 		make -j1 mkProjectInfo 
-		make -j1 UISTYLE=$ui DEBUGGING=false THREADS=true || return 1
+		make -j1 UISTYLE=$ui DEBUGGING=false THREADS=true
 		mv unison unison-$ui
 	done
 }
 
 doc() {
 	pkgdesc="Unison - efficient file-synchronization tool (documentation)"
-	_docdir="$subpkgdir"/usr/share/doc/$pkgname/
+	local _docdir="$subpkgdir"/usr/share/doc/$pkgname/
 	mkdir -p "$_docdir"
 	cd "$srcdir"
 	cp unison-$pkgver-manual.html "$_docdir"
@@ -50,13 +55,13 @@ package() {
 
 md5sums="5334b78c7e68169df7de95f4c6c4b60f  unison-2.48.4.tar.gz
 3dc5de6c0609ae2e3019d22f76345b91  unison-2.48.4-manual.html
-2e119ce09b903763fb859d24d573f4f1  bytearray_stubs_c.patch
-c40a53099c98f7a82eaad52b7e5d0df2  fix_inotify_check.patch"
+c40a53099c98f7a82eaad52b7e5d0df2  fix_inotify_check.patch
+e4da5777b26376de728f22b2c296950d  marshalling.patch"
 sha256sums="30aa53cd671d673580104f04be3cf81ac1e20a2e8baaf7274498739d59e99de8  unison-2.48.4.tar.gz
 2b5674e2fd7751148784a716ce5a03f8cd0a321c8a3bd4343832ed9b83d2d404  unison-2.48.4-manual.html
-e475883bb55280f88cdd49688c1609a02d58eccbee9030546becc793b0645d6f  bytearray_stubs_c.patch
-ef0371e70c94250ca04e80a5fddf61f3edab1c6ec0854e9bf5b2edd6dd18e986  fix_inotify_check.patch"
+ef0371e70c94250ca04e80a5fddf61f3edab1c6ec0854e9bf5b2edd6dd18e986  fix_inotify_check.patch
+6e652b120f1b526557ab0a88c162aec3957444bfdeaf7f9c52ca0f3c48c58d9a  marshalling.patch"
 sha512sums="c8e7bd2b14edae31e7d08154cdc2dce8173546b6163b9e5f4f2b1c8255792a7645d8449da88d7acfcbf498746481d24d0a3936978969920530a15a16bcbc6024  unison-2.48.4.tar.gz
 b995712cda51d612bd81c89589d872099b3b9c90f7413268b24ab399a1eff7690200980514a834ee3d12bd3c89ef61bb8a29b3970c01433e0c4671d363a96b68  unison-2.48.4-manual.html
-ab79e6c3c2788c4333b0108d96a668c426d206cb11ddc5a56a9255873dff4cc88c7bd9303a027467937f95e512b9d7593f8e22d51999b768e8ee90b60f89e1e4  bytearray_stubs_c.patch
-27eaf4f347dc827dc14b338ef2be40d25507c6c9d65ecdc8f811ebe994f6e23577ad85fcc86b63d148b57844b24e6034061c869b641fbd3173532a26e0828803  fix_inotify_check.patch"
+27eaf4f347dc827dc14b338ef2be40d25507c6c9d65ecdc8f811ebe994f6e23577ad85fcc86b63d148b57844b24e6034061c869b641fbd3173532a26e0828803  fix_inotify_check.patch
+3ca783527ee4b5eacd060086a72987e479b2f04d795d6689c8357eb33635e91021b6cd8b926cb583a4ca3dd18373c8ce5b50ba44dd5fa18b2e2e78922cea3c9f  marshalling.patch"
diff --git a/testing/unison/fix_inotify_check.patch b/community/unison/fix_inotify_check.patch
similarity index 100%
rename from testing/unison/fix_inotify_check.patch
rename to community/unison/fix_inotify_check.patch
diff --git a/community/unison/marshalling.patch b/community/unison/marshalling.patch
new file mode 100644
index 0000000000..997b90b513
--- /dev/null
+++ b/community/unison/marshalling.patch
@@ -0,0 +1,16 @@
+--- a/remote.ml	2016-05-23 18:40:05.000000000 +0200
++++ b/remote.ml	2017-03-23 11:33:24.784228112 +0100
+@@ -450,12 +450,7 @@
+      let s = Bytearray.marshal data [Marshal.No_sharing] in
+      let l = Bytearray.length s in
+      ((s, 0, l) :: rem, l)),
+-  (fun buf pos ->
+-      try Bytearray.unmarshal buf pos
+-      with Failure s -> raise (Util.Fatal (Printf.sprintf 
+-"Fatal error during unmarshaling (%s),
+-possibly because client and server have been compiled with different\
+-versions of the OCaml compiler." s)))
++  (fun buf pos -> Bytearray.unmarshal buf pos)
+ 
+ let makeMarshalingFunctions payloadMarshalingFunctions string =
+   let (marshalPayload, unmarshalPayload) = payloadMarshalingFunctions in
diff --git a/testing/unison/bytearray_stubs_c.patch b/testing/unison/bytearray_stubs_c.patch
deleted file mode 100644
index 9f8396203d..0000000000
--- a/testing/unison/bytearray_stubs_c.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Fix rare SIGSEGV when transferring large replicas.
-Fix a theoretical integer overflow. 
-
-Patches from here:
-https://caml.inria.fr/mantis/view.php?id=7431#c17026
-and here:
-https://caml.inria.fr/mantis/view.php?id=7431#c16962
-
-Related issue reports:
-https://github.com/bcpierce00/unison/issues/48
-https://caml.inria.fr/mantis/view.php?id=7431
-https://bugzilla.redhat.com/show_bug.cgi?id=1401759
-
-Thanks to Alex Markley and OCaml developers
---- a/bytearray_stubs.c	Tue Jan 17 08:41:00 2017
-+++ b/bytearray_stubs.c	Tue Jan 17 08:41:21 2017
-@@ -5,6 +5,7 @@
- 
- #include "caml/intext.h"
- #include "caml/bigarray.h"
-+#include "caml/memory.h"
- 
- CAMLprim value ml_marshal_to_bigarray(value v, value flags)
- {
-@@ -21,15 +22,18 @@ CAMLprim value ml_marshal_to_bigarray(value v, value f
- 
- CAMLprim value ml_unmarshal_from_bigarray(value b, value ofs)
- {
-+  CAMLparam1(b); /* Holds [b] live until unmarshalling completes. */
-+  value result;
-   struct caml_bigarray *b_arr = Bigarray_val(b);
--  return input_value_from_block (Array_data (b_arr, ofs),
-+  result = input_value_from_block (Array_data (b_arr, ofs),
-                                  b_arr->dim[0] - Long_val(ofs));
-+  CAMLreturn(result);
- }
- 
- CAMLprim value ml_blit_string_to_bigarray
- (value s, value i, value a, value j, value l)
- {
--  char *src = String_val(s) + Int_val(i);
-+  char *src = String_val(s) + Long_val(i);
-   char *dest = Array_data(Bigarray_val(a), j);
-   memcpy(dest, src, Long_val(l));
-   return Val_unit;
-- 
2.11.1

---