commit:     71df67d36b63cbe65b3eb9a8b91c07ccb2ac9071
Author:     Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
AuthorDate: Wed Oct 14 14:43:39 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 17 08:32:04 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71df67d3

net-misc/unison: build with ocaml-4.09.0

Patches from https://bugs.gentoo.org/709646 applied
Restricting to <=dev-lang/ocaml-4.09:=
Does not build with ocaml-4.10.0

Closes: https://bugs.gentoo.org/709646
Bug: https://bugs.gentoo.org/739426
Bug: https://bugs.gentoo.org/733720

Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../unison/files/unison-2.48.4-ocaml-4.08.patch    | 79 +++++++++++++++++++
 .../unison/files/unison-2.51.2-ocaml-4.08.patch    | 50 ++++++++++++
 net-misc/unison/unison-2.48.4-r2.ebuild            | 90 ++++++++++++++++++++++
 net-misc/unison/unison-2.51.2-r1.ebuild            | 86 +++++++++++++++++++++
 4 files changed, 305 insertions(+)

diff --git a/net-misc/unison/files/unison-2.48.4-ocaml-4.08.patch 
b/net-misc/unison/files/unison-2.48.4-ocaml-4.08.patch
new file mode 100644
index 00000000000..8b0d89b335a
--- /dev/null
+++ b/net-misc/unison/files/unison-2.48.4-ocaml-4.08.patch
@@ -0,0 +1,79 @@
+From: Stephane Glondu <[email protected]>
+Date: Mon, 25 Nov 2019 10:52:48 +0100
+Subject: Fix compilation with OCaml 4.08.1
+
+---
+ Makefile.OCaml           | 2 +-
+ files.ml                 | 2 +-
+ recon.ml                 | 4 ++--
+ system/system_generic.ml | 2 +-
+ uigtk2.ml                | 2 +-
+ 5 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile.OCaml b/Makefile.OCaml
+index 21610ce..7549907 100644
+--- a/Makefile.OCaml
++++ b/Makefile.OCaml
+@@ -95,7 +95,7 @@ buildexecutable::
+ ### Default parameters
+ 
+ # Generate backtrace information for exceptions
+-CAMLFLAGS+=-g
++CAMLFLAGS+=-g -unsafe-string
+ 
+ INCLFLAGS=-I lwt -I ubase -I system
+ CAMLFLAGS+=$(INCLFLAGS)
+diff --git a/files.ml b/files.ml
+index ba42ad5..02d52f3 100644
+--- a/files.ml
++++ b/files.ml
+@@ -722,7 +722,7 @@ let get_files_in_directory dir =
+   with End_of_file ->
+     dirh.System.closedir ()
+   end;
+-  Sort.list (<) !files
++  List.sort compare !files
+ 
+ let ls dir pattern =
+   Util.convertUnixErrorsToTransient
+diff --git a/recon.ml b/recon.ml
+index 5ed358d..a8719c4 100644
+--- a/recon.ml
++++ b/recon.ml
+@@ -651,8 +651,8 @@ let rec reconcile
+ 
+ (* Sorts the paths so that they will be displayed in order                   
*)
+ let sortPaths pathUpdatesList =
+-  Sort.list
+-    (fun (p1, _) (p2, _) -> Path.compare p1 p2 <= 0)
++  List.sort
++    (fun (p1, _) (p2, _) -> Path.compare p1 p2)
+     pathUpdatesList
+ 
+ let rec enterPath p1 p2 t =
+diff --git a/system/system_generic.ml b/system/system_generic.ml
+index 9230cdc..ee457c5 100755
+--- a/system/system_generic.ml
++++ b/system/system_generic.ml
+@@ -47,7 +47,7 @@ let open_out_gen = open_out_gen
+ let chmod = Unix.chmod
+ let chown = Unix.chown
+ let utimes = Unix.utimes
+-let link = Unix.link
++let link s1 s2 = Unix.link s1 s2
+ let openfile = Unix.openfile
+ let opendir f =
+   let h = Unix.opendir f in
+diff --git a/uigtk2.ml b/uigtk2.ml
+index 206d8ad..b2a17e2 100644
+--- a/uigtk2.ml
++++ b/uigtk2.ml
+@@ -94,7 +94,7 @@ let icon =
+ let icon =
+   let p = GdkPixbuf.create ~width:48 ~height:48 ~has_alpha:true () in
+   Gpointer.blit
+-    (Gpointer.region_of_string Pixmaps.icon_data) (GdkPixbuf.get_pixels p);
++    (Gpointer.region_of_bytes Pixmaps.icon_data) (GdkPixbuf.get_pixels p);
+   p
+ 
+ let leftPtrWatch =

diff --git a/net-misc/unison/files/unison-2.51.2-ocaml-4.08.patch 
b/net-misc/unison/files/unison-2.51.2-ocaml-4.08.patch
new file mode 100644
index 00000000000..e3353e77e62
--- /dev/null
+++ b/net-misc/unison/files/unison-2.51.2-ocaml-4.08.patch
@@ -0,0 +1,50 @@
+diff -ur src.orig/files.ml src/files.ml
+--- src.orig/files.ml  2018-01-27 21:53:44.000000000 +0100
++++ src/files.ml       2019-12-11 16:12:40.005712137 +0100
+@@ -734,7 +734,7 @@
+   with End_of_file ->
+     dirh.System.closedir ()
+   end;
+-  Sort.list (<) !files
++  List.sort compare !files
+ 
+ let ls dir pattern =
+   Util.convertUnixErrorsToTransient
+diff -ur src.orig/recon.ml src/recon.ml
+--- src.orig/recon.ml  2018-01-27 21:53:44.000000000 +0100
++++ src/recon.ml       2019-12-11 16:12:40.005712137 +0100
+@@ -661,8 +661,8 @@
+ 
+ (* Sorts the paths so that they will be displayed in order                   
*)
+ let sortPaths pathUpdatesList =
+-  Sort.list
+-    (fun (p1, _) (p2, _) -> Path.compare p1 p2 <= 0)
++  List.sort
++    (fun (p1, _) (p2, _) -> Path.compare p1 p2)
+     pathUpdatesList
+ 
+ let rec enterPath p1 p2 t =
+diff -ur src.orig/system/system_generic.ml src/system/system_generic.ml
+--- src.orig/system/system_generic.ml  2018-01-27 21:53:44.000000000 +0100
++++ src/system/system_generic.ml       2019-12-11 16:12:40.005712137 +0100
+@@ -47,7 +47,7 @@
+ let chmod = Unix.chmod
+ let chown = Unix.chown
+ let utimes = Unix.utimes
+-let link = Unix.link
++let link s1 s2 = Unix.link s1 s2
+ let openfile = Unix.openfile
+ let opendir f =
+   let h = Unix.opendir f in
+diff -ur src.orig/uigtk2.ml src/uigtk2.ml
+--- src.orig/uigtk2.ml 2018-01-27 21:53:44.000000000 +0100
++++ src/uigtk2.ml      2019-12-11 16:12:40.005712137 +0100
+@@ -94,7 +94,7 @@
+ let icon =
+   let p = GdkPixbuf.create ~width:48 ~height:48 ~has_alpha:true () in
+   Gpointer.blit
+-    (Gpointer.region_of_string Pixmaps.icon_data) (GdkPixbuf.get_pixels p);
++    (Gpointer.region_of_bytes Pixmaps.icon_data) (GdkPixbuf.get_pixels p);
+   p
+ 
+ let leftPtrWatch =

diff --git a/net-misc/unison/unison-2.48.4-r2.ebuild 
b/net-misc/unison/unison-2.48.4-r2.ebuild
new file mode 100644
index 00000000000..da2e58c430d
--- /dev/null
+++ b/net-misc/unison/unison-2.48.4-r2.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Two-way cross-platform file synchronizer"
+HOMEPAGE="https://www.seas.upenn.edu/~bcpierce/unison/";
+SRC_URI="https://www.seas.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}.tar.gz
+       doc? ( 
https://www.seas.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}-manual.pdf
+               
https://www.seas.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}-manual.html
 )"
+
+LICENSE="GPL-2"
+SLOT="$(ver_cut 1-2)"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos 
~sparc-solaris"
+IUSE="gtk doc static debug threads +ocamlopt test"
+
+# Upstream, for this version, has explicitly disabled test with marker
+# "Skipping some tests -- remove me!". Given the potentially destructive nature
+# of those tests, let's not try to run them (they're re-enabled in subsequent
+# releases).
+RESTRICT="test !ocamlopt? ( strip )"
+
+# ocaml version so we are sure it has ocamlopt use flag
+DEPEND="<dev-lang/ocaml-4.10.0:=[ocamlopt?]
+       gtk? ( dev-ml/lablgtk:2= )"
+
+RDEPEND="gtk? ( dev-ml/lablgtk:2=
+       || ( net-misc/x11-ssh-askpass net-misc/ssh-askpass-fullscreen ) )
+       >=app-eselect/eselect-unison-0.4"
+
+S="${WORKDIR}"/src
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.48.4-Makefile-dep.patch
+       "${FILESDIR}"/${PN}-2.48.4-ocaml-4.08.patch # 
https://bugs.gentoo.org/709646
+)
+
+DOCS=( BUGS.txt CONTRIB INSTALL NEWS README ROADMAP.txt TODO.txt )
+
+src_compile() {
+       local myconf
+
+       if use threads; then
+               myconf="$myconf THREADS=true"
+       fi
+
+       if use static; then
+               myconf="$myconf STATIC=true"
+       fi
+
+       if use debug; then
+               myconf="$myconf DEBUGGING=true"
+       fi
+
+       if use gtk; then
+               myconf="$myconf UISTYLE=gtk2"
+       else
+               myconf="$myconf UISTYLE=text"
+       fi
+
+       use ocamlopt || myconf="$myconf NATIVE=false"
+
+       # Discard cflags as it will try to pass them to ocamlc...
+       emake $myconf CFLAGS="" buildexecutable
+}
+
+src_test() {
+       emake selftest CFLAGS=""
+}
+
+src_install() {
+       # install manually, since it's just too much
+       # work to force the Makefile to do the right thing.
+       local binname
+       for binname in unison unison-fsmonitor; do
+               newbin ${binname} ${binname}-${SLOT}
+       done
+       if use doc; then
+               DOCS+=( "${DISTDIR}/${P}-manual.pdf" )
+               HTML_DOCS=( "${DISTDIR}/${P}-manual.html" )
+       fi
+       einstalldocs
+}
+
+pkg_postinst() {
+       elog "Unison now uses SLOTs, so you can specify 
servercmd=/usr/bin/unison-${SLOT}"
+       elog "in your profile files to access exactly this version over ssh."
+       elog "Or you can use 'eselect unison' to set the version."
+       eselect unison update
+}

diff --git a/net-misc/unison/unison-2.51.2-r1.ebuild 
b/net-misc/unison/unison-2.51.2-r1.ebuild
new file mode 100644
index 00000000000..c7b05df33aa
--- /dev/null
+++ b/net-misc/unison/unison-2.51.2-r1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Two-way cross-platform file synchronizer"
+HOMEPAGE="https://www.seas.upenn.edu/~bcpierce/unison/";
+SRC_URI="https://www.seas.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}.tar.gz
+       doc? (
+               
https://www.seas.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}-manual.pdf
+               
https://www.seas.upenn.edu/~bcpierce/unison/download/releases/${P}/${P}-manual.html
+       )"
+
+LICENSE="GPL-2"
+SLOT="$(ver_cut 1-2)"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos 
~sparc-solaris"
+IUSE="gtk doc static debug threads +ocamlopt test"
+
+# ocaml version so we are sure it has ocamlopt use flag
+DEPEND="<dev-lang/ocaml-4.10.0:=[ocamlopt?]
+       gtk? ( dev-ml/lablgtk:2= )"
+
+RDEPEND="gtk? ( dev-ml/lablgtk:2=
+       || ( net-misc/x11-ssh-askpass net-misc/ssh-askpass-fullscreen ) )
+       >=app-eselect/eselect-unison-0.4"
+
+RESTRICT="!ocamlopt? ( strip ) !test? ( test )"
+S="${WORKDIR}"/src
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.51.2-ocaml-4.08.patch # 
https://bugs.gentoo.org/709646
+)
+
+DOCS=( BUGS.txt CONTRIB INSTALL NEWS README ROADMAP.txt TODO.txt )
+
+src_compile() {
+       local myconf
+
+       if use threads; then
+               myconf="$myconf THREADS=true"
+       fi
+
+       if use static; then
+               myconf="$myconf STATIC=true"
+       fi
+
+       if use debug; then
+               myconf="$myconf DEBUGGING=true"
+       fi
+
+       if use gtk; then
+               myconf="$myconf UISTYLE=gtk2"
+       else
+               myconf="$myconf UISTYLE=text"
+       fi
+
+       use ocamlopt || myconf="$myconf NATIVE=false"
+
+       # Discard cflags as it will try to pass them to ocamlc...
+       emake $myconf CFLAGS="" buildexecutable
+}
+
+src_test() {
+       emake selftest CFLAGS=""
+}
+
+src_install() {
+       # install manually, since it's just too much
+       # work to force the Makefile to do the right thing.
+       local binname
+       for binname in unison unison-fsmonitor; do
+               newbin ${binname} ${binname}-${SLOT}
+       done
+       if use doc; then
+               DOCS+=( "${DISTDIR}/${P}-manual.pdf" )
+               HTML_DOCS=( "${DISTDIR}/${P}-manual.html" )
+       fi
+       einstalldocs
+}
+
+pkg_postinst() {
+       elog "Unison now uses SLOTs, so you can specify 
servercmd=/usr/bin/unison-${SLOT}"
+       elog "in your profile files to access exactly this version over ssh."
+       elog "Or you can use 'eselect unison' to set the version."
+       eselect unison update
+}

Reply via email to