From 05cb735234f0cb37b593d8cabf893bc4a8452cde Mon Sep 17 00:00:00 2001 From: Mark Wright Date: Tue, 13 Oct 2020 15:58:41 +1100 Subject: dev-ml/cairo-ocaml: Fix #710574 Thanks to Attila Toth for the Debian patch, I applied this alternative patch from the ml-overlay: https://github.com/aballier/ml-overlay.git Closes: https://bugs.gentoo.org/710574 Co-Author: Alexis Ballier Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Mark Wright --- dev-ml/cairo-ocaml/cairo-ocaml-1.2.0-r1.ebuild | 85 ++++++++++++++++++++++++++ dev-ml/cairo-ocaml/files/ocaml406.patch | 20 ++++++ 2 files changed, 105 insertions(+) create mode 100644 dev-ml/cairo-ocaml/cairo-ocaml-1.2.0-r1.ebuild create mode 100644 dev-ml/cairo-ocaml/files/ocaml406.patch diff --git a/dev-ml/cairo-ocaml/cairo-ocaml-1.2.0-r1.ebuild b/dev-ml/cairo-ocaml/cairo-ocaml-1.2.0-r1.ebuild new file mode 100644 index 000000000000..964ec3fc5b12 --- /dev/null +++ b/dev-ml/cairo-ocaml/cairo-ocaml-1.2.0-r1.ebuild @@ -0,0 +1,85 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit findlib autotools + +DESCRIPTION="Ocaml bindings for the cairo vector graphics library" +HOMEPAGE="https://www.cairographics.org/cairo-ocaml/" +SRC_URI="https://cgit.freedesktop.org/cairo-ocaml/snapshot/${P}.tar.bz2" + +LICENSE="LGPL-2.1" +SLOT="0/${PV}" +KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux" +IUSE="doc examples gtk pango" + +RDEPEND="dev-lang/ocaml:= + x11-libs/cairo + gtk? ( dev-ml/lablgtk:2= ) + pango? ( x11-libs/pango )" +DEPEND="${RDEPEND}" + +# 3 patches from debian and one for automagic on libsvg-cairo +PATCHES=( + "${FILESDIR}"/0001-Add-missing-libraries-used-by-the-stubs-to-CAIRO_LIB.patch \ + "${FILESDIR}"/0002-Fix-Makefile-to-avoid-recompiling-files-in-usr.patch \ + "${FILESDIR}"/0003-Fix-FTBFS-on-bytecode-architectures.patch \ + "${FILESDIR}"/0004-no-automagic.patch +) + +src_prepare() { + default + has_version '>=dev-lang/ocaml-4.06.0' && eapply "${FILESDIR}"/ocaml406.patch + AT_M4DIR=support eautoreconf +} + +src_configure() { + econf \ + $(use_with gtk) \ + $(use_with pango pango-cairo) \ + --without-svg-cairo +} + +src_compile() { + emake -j1 + use doc && emake doc +} + +src_install() { + findlib_src_install + dodoc README ChangeLog + if use examples; then + insinto /usr/share/doc/${PF}/examples + doins test/*.ml + fi + # ocamlfind support + cat <<-EOF > META + name = "${PN}" + description = "${DESCRIPTION}" + requires = "bigarray" + version = "${PV}" + archive(byte) = "cairo.cma" + archive(native) = "cairo.cmxa" + EOF + if use gtk; then + cat <<-EOF >> META + package "lablgtk2" ( + requires = "cairo lablgtk2" + archive(byte) = "cairo_lablgtk.cma" + archive(native) = "cairo_lablgtk.cmxa" + ) + EOF + fi + if use pango; then + cat <<-EOF >> META + package "pango" ( + requires = "cairo" + archive(byte) = "pango_cairo.cma" + archive(native) = "pango_cairo.cmxa" + ) + EOF + fi + insinto /usr/$(get_libdir)/ocaml/cairo + doins META +} diff --git a/dev-ml/cairo-ocaml/files/ocaml406.patch b/dev-ml/cairo-ocaml/files/ocaml406.patch new file mode 100644 index 000000000000..2ef9931463b0 --- /dev/null +++ b/dev-ml/cairo-ocaml/files/ocaml406.patch @@ -0,0 +1,20 @@ +Index: cairo-ocaml-1.2.0/src/cairo_png.ml +=================================================================== +--- cairo-ocaml-1.2.0.orig/src/cairo_png.ml ++++ cairo-ocaml-1.2.0/src/cairo_png.ml +@@ -7,13 +7,13 @@ + (**************************************************************************) + + external image_surface_create_from_stream_unsafe : +- (string -> int -> unit) -> Cairo.image_surface = "ml_cairo_image_surface_create_from_png_stream_unsafe" ++ (bytes -> int -> unit) -> Cairo.image_surface = "ml_cairo_image_surface_create_from_png_stream_unsafe" + + let image_surface_create_from_channel ic = + image_surface_create_from_stream_unsafe + (fun s n -> + for i = 0 to n - 1 do +- String.unsafe_set s i (input_char ic) ++ Bytes.unsafe_set s i (input_char ic) + done) + + let image_surface_create_from_file fname = -- cgit v1.2.3-65-gdbad