diff --git a/.gitignore b/.gitignore index 0dd833c..e4c1a48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ ocaml-cairo-1.2.0-gita5c5ee9f.tar.gz /ocaml-cairo-1.2.0-git08b40192975.tar.gz /ocaml-cairo-1.2.0-git872c9bc92e6.tar.gz +/ocaml-cairo-5c1df1516ad99bde444bf5717801e7df75252a6c.tar.gz diff --git a/cairo-ocaml-1.0.0-bigarray.patch b/cairo-ocaml-1.0.0-bigarray.patch deleted file mode 100644 index c0afb8a..0000000 --- a/cairo-ocaml-1.0.0-bigarray.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ur cairo-ocaml-1.0.0.orig/src/ml_cairo_bigarr.c cairo-ocaml-1.0.0.compat/src/ml_cairo_bigarr.c ---- cairo-ocaml-1.0.0.orig/src/ml_cairo_bigarr.c 2009-06-18 19:01:26.000000000 +0100 -+++ cairo-ocaml-1.0.0.compat/src/ml_cairo_bigarr.c 2009-10-08 12:46:54.795555155 +0100 -@@ -9,6 +9,8 @@ - #include "ml_cairo.h" - - #include -+#undef CAML_NAME_SPACE -+#include - - unsigned long bigarray_byte_size (struct caml_bigarray *); - diff --git a/ocaml-cairo-1.2.0-enable-ocamlopt-debug.patch b/ocaml-cairo-1.2.0-enable-ocamlopt-debug.patch deleted file mode 100644 index 832081e..0000000 --- a/ocaml-cairo-1.2.0-enable-ocamlopt-debug.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ocaml-cairo-1.2.0/Makefile.rules~ 2011-09-11 16:09:06.000000000 +0100 -+++ ocaml-cairo-1.2.0/Makefile.rules 2013-09-14 14:51:18.682632883 +0100 -@@ -1,8 +1,8 @@ - %.cmo : %.ml -- $(OCAMLC) -c $(INCFLAGS) $< -+ $(OCAMLC) -g -c $(INCFLAGS) $< - %.cmx : %.ml -- $(OCAMLOPT) -c $(INCFLAGS) $< -+ $(OCAMLOPT) -g -c $(INCFLAGS) $< - %.cmi : %.mli -- $(OCAMLC) $(INCFLAGS) $< -+ $(OCAMLC) -g $(INCFLAGS) $< - %.o : %.c - $(OCAMLC) -ccopt "$(CPPFLAGS)" $< diff --git a/ocaml-cairo-META b/ocaml-cairo-META index 19acb8d..0f7b66d 100644 --- a/ocaml-cairo-META +++ b/ocaml-cairo-META @@ -1,11 +1,11 @@ -name = "cairo-ocaml" +name = "cairo2" description = "Bindings to the cairo library." -archive(byte) = "cairo.cma" -archive(native) = "cairo.cmxa" +archive(byte) = "cairo2.cma" +archive(native) = "cairo2.cmxa" requires = "bigarray" package "lablgtk2" ( - requires = "cairo lablgtk2" - archive(byte) = "cairo_lablgtk.cma" - archive(native) = "cairo_lablgtk.cmxa" + requires = "cairo2 lablgtk2" + archive(byte) = "cairo_gtk.cma" + archive(native) = "cairo_gtk.cmxa" ) diff --git a/ocaml-cairo.spec b/ocaml-cairo.spec index 76454fd..1bce353 100644 --- a/ocaml-cairo.spec +++ b/ocaml-cairo.spec @@ -1,42 +1,41 @@ -%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) +%ifarch %{ocaml_native_compiler} +%global native_compiler 1 +%else +%global native_compiler 0 +%endif -# Important note! There are at least two quite separate OCaml cairo -# projects. This one is: http://cairographics.org/cairo-ocaml/ -# The other one is: http://forge.ocamlcore.org/projects/cairo/ - -# There are no source releases for ocaml-cairo > 1.0.0. To get the -# source matching this you have to do: +# Important note! +# There are at least two quite separate OCaml cairo projects. # -# git clone git://anongit.freedesktop.org/cairo-ocaml -# cd cairo-ocaml -# git archive --prefix=ocaml-cairo-%{version}/ %{commit} | \ -# gzip > ../ocaml-cairo-1.2.0-git%{commit}.tar.gz -%global commit 872c9bc92e6 +# This is (packaged in Fedora >= 23): +# http://forge.ocamlcore.org/projects/cairo/ +# https://github.com/Chris00/ocaml-cairo +# +# The other one (which used to be packaged in Fedora <= 22) is: +# http://cairographics.org/cairo-ocaml/ + +# Packaging git pre-releases here. +%global commit 5c1df1516ad99bde444bf5717801e7df75252a6c +%global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: ocaml-cairo -Epoch: 1 -Version: 1.2.0 -Release: 0.20.git%{commit}%{?dist} +Epoch: 2 +Version: 0.4.7 +Release: 0.4.git%{shortcommit}%{?dist} Summary: OCaml library for accessing cairo graphics -ExcludeArch: sparc64 s390 s390x +License: LGPLv3+ +URL: https://github.com/Chris00/%{name} -License: LGPLv2 -URL: http://cairographics.org/cairo-ocaml/ - -Source0: ocaml-cairo-%{version}-git%{commit}.tar.gz +Source0: https://github.com/Chris00/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz Source1: ocaml-cairo-META -Patch1: ocaml-cairo-1.2.0-enable-ocamlopt-debug.patch - BuildRequires: ocaml >= 3.10.0 BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-lablgtk-devel BuildRequires: cairo-devel >= 1.2.0 -BuildRequires: automake BuildRequires: gtk2-devel -BuildRequires: chrpath %description @@ -53,6 +52,8 @@ significant addition of translucence in the imaging model). When complete, the API is intended to support the complete imaging model of PDF 1.4. +This package contains OCaml bindings for Cairo. + %package devel Summary: Development files for %{name} @@ -66,19 +67,44 @@ developing applications that use %{name}. %prep -%setup -q +%setup -q -n %{name}-%{commit} -%patch1 -p1 - -aclocal -I support -autoconf -./configure --libdir=%{_libdir} cp %{SOURCE1} META %build -make -make doc +# The upstream package uses some crackpot build system which is +# not supported in Fedora. Just build the files by hand instead. +pushd src + +# OCaml files. +ocamlfind ocamlc -package lablgtk2 -g -c cairo.mli +ocamlfind ocamlc -package lablgtk2 -g -c cairo.ml +ocamlfind ocamlc -package lablgtk2 -g -c cairo_gtk.mli +ocamlfind ocamlc -package lablgtk2 -g -c cairo_gtk.ml +%if %{native_compiler} +ocamlfind ocamlopt -package lablgtk2 -g -c cairo.ml +ocamlfind ocamlopt -package lablgtk2 -g -c cairo_gtk.ml +%endif + +# C files. +CFLAGS="%{optflags} -fPIC `pkg-config gtk+-2.0 --cflags` -I%{_libdir}/ocaml -I%{_libdir}/ocaml/lablgtk2" +gcc $CFLAGS -c cairo_stubs.c +gcc $CFLAGS -c cairo_gtk_stubs.c + +# Build the two libraries, twice (bytecode & native). +ocamlfind ocamlmklib -o cairo2 cairo_stubs.o cairo.cmo \ + `pkg-config gtk+-2.0 --libs` +ocamlfind ocamlmklib -o cairo_gtk cairo_gtk_stubs.o cairo_gtk.cmo \ + `pkg-config gtk+-2.0 --libs` +%if %{native_compiler} +ocamlfind ocamlmklib -o cairo2 cairo_stubs.o cairo.cmx \ + `pkg-config gtk+-2.0 --libs` +ocamlfind ocamlmklib -o cairo_gtk cairo_gtk_stubs.o cairo_gtk.cmx \ + `pkg-config gtk+-2.0 --libs` +%endif + +popd %install @@ -86,35 +112,37 @@ export DESTDIR=$RPM_BUILD_ROOT export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs -ocamlfind install cairo src/{*.mli,*.cmi,*.cma,*.a,*.cmxa,*.cmx,dll*.so} META - -chrpath --delete $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs/dll*.so +ocamlfind install cairo2 src/{*.mli,*.cmi,*.cma,*.a,*.cmxa,*.cmx,dll*.so} META %files -%doc COPYING -%{_libdir}/ocaml/cairo -%if %opt -%exclude %{_libdir}/ocaml/cairo/*.a -%exclude %{_libdir}/ocaml/cairo/*.cmxa -%exclude %{_libdir}/ocaml/cairo/*.cmx +%{_libdir}/ocaml/cairo2 +%if %{native_compiler} +%exclude %{_libdir}/ocaml/cairo2/*.a +%exclude %{_libdir}/ocaml/cairo2/*.cmxa +%exclude %{_libdir}/ocaml/cairo2/*.cmx %endif -%exclude %{_libdir}/ocaml/cairo/*.mli +%exclude %{_libdir}/ocaml/cairo2/*.mli %{_libdir}/ocaml/stublibs/*.so %{_libdir}/ocaml/stublibs/*.so.owner %files devel -%doc COPYING ChangeLog README doc/html -%if %opt -%{_libdir}/ocaml/cairo/*.a -%{_libdir}/ocaml/cairo/*.cmxa -%{_libdir}/ocaml/cairo/*.cmx +# XXX The tutorial doesn't build. +%doc examples +%if %{native_compiler} +%{_libdir}/ocaml/cairo2/*.a +%{_libdir}/ocaml/cairo2/*.cmxa +%{_libdir}/ocaml/cairo2/*.cmx %endif -%{_libdir}/ocaml/cairo/*.mli +%{_libdir}/ocaml/cairo2/*.mli %changelog +* Thu Mar 19 2015 Richard W.M. Jones - 2:0.4.7-0.4.git5c1df15 +- Switch bindings to https://github.com/Chris00/ocaml-cairo +- See: https://lists.fedoraproject.org/pipermail/devel/2015-March/209182.html + * Tue Feb 17 2015 Richard W.M. Jones - 1:1.2.0-0.20.git872c9bc92e6 - ocaml-4.02.1 rebuild. diff --git a/sources b/sources index 9e53149..a507a69 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4d47096f08fa069f88e4161b9cf4d693 ocaml-cairo-1.2.0-git872c9bc92e6.tar.gz +5119bd2096b310613c7fe082c84dab15 ocaml-cairo-5c1df1516ad99bde444bf5717801e7df75252a6c.tar.gz