New upstream version 0.6.1.

Also:
- Add -gtk and -pango subpackages corresponding to upstream's opam packages.
- Add -gtk-devel and -pango-devel subpackages to manage dependencies.
- Add %check script.
This commit is contained in:
Jerry James 2020-01-22 20:37:06 -07:00
parent 1c4773546b
commit d219020c52
5 changed files with 186 additions and 86 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ ocaml-cairo-1.2.0-gita5c5ee9f.tar.gz
/ocaml-cairo-5c1df1516ad99bde444bf5717801e7df75252a6c.tar.gz
/ocaml-cairo-675e51b639824f97e06683b080d57f2037064738.tar.gz
/ocaml-cairo-be5a298c28d90b2c44b7c00066902b53834720b3.tar.gz
/cairo2-*.tbz

View File

@ -1,11 +0,0 @@
name = "cairo2"
description = "Bindings to the cairo library."
archive(byte) = "cairo2.cma"
archive(native) = "cairo2.cmxa"
requires = "bigarray"
package "lablgtk2" (
requires = "cairo2 lablgtk2"
archive(byte) = "cairo_gtk.cma"
archive(native) = "cairo_gtk.cmxa"
)

8
ocaml-cairo.rpmlintrc Normal file
View File

@ -0,0 +1,8 @@
# THIS FILE IS FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON
# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors
# The dictionary is missing some technical terms
addFilter(r'W: spelling-error .* (compositing|stateful)')
# The documentation is in the main package
addFilter(r'ocaml-cairo-(gtk|pango)(-devel)?\.[^:]+: W: no-documentation')

View File

@ -1,9 +1,3 @@
%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.
#
@ -14,31 +8,30 @@
# The other one (which used to be packaged in Fedora <= 22) is:
# http://cairographics.org/cairo-ocaml/
# Packaging git pre-releases here.
%global commit be5a298c28d90b2c44b7c00066902b53834720b3
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%ifnarch %{ocaml_native_compiler}
%global debug_package %{nil}
%endif
Name: ocaml-cairo
Epoch: 2
Version: 0.4.7
Release: 0.28.git%{shortcommit}%{?dist}
Version: 0.6.1
Release: 1%{?dist}
Summary: OCaml library for accessing cairo graphics
License: LGPLv3+
URL: https://github.com/Chris00/%{name}
Source0: https://github.com/Chris00/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
Source1: ocaml-cairo-META
Source0: %{url}/releases/download/%{version}/cairo2-%{version}.tbz
BuildRequires: ocaml >= 3.10.0
BuildRequires: ocaml >= 4.02
BuildRequires: ocaml-dune-devel
BuildRequires: ocaml-findlib-devel
BuildRequires: ocaml-ocamldoc
BuildRequires: ocaml-lablgtk-devel
BuildRequires: cairo-devel >= 1.2.0
BuildRequires: gtk2-devel
BuildRequires: pkgconfig(cairo) >= 1.2.0
BuildRequires: pkgconfig(gtk+-2.0)
%description
%global _description %{expand:
Cairo is a multi-platform library providing anti-aliased vector-based
rendering for multiple target backends. Paths consist of line segments
and cubic splines and can be rendered at any width with various join
@ -50,15 +43,18 @@ Cairo exports a stateful rendering API similar in spirit to the path
construction, text, and painting operators of PostScript, (with the
significant addition of translucence in the imaging model). When
complete, the API is intended to support the complete imaging model of
PDF 1.4.
PDF 1.4.}
%description
%_description
This package contains OCaml bindings for Cairo.
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: ocaml-lablgtk-devel
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: ocaml-lablgtk-devel%{?_isa}
%description devel
@ -66,83 +62,189 @@ The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.
%prep
%setup -q -n %{name}-%{commit}
%package gtk
Summary: OCaml library to render cairo on a gtk2 canvas
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
cp %{SOURCE1} META
%description gtk
%_description
This package contains OCaml bindings for rendering cairo on a gtk2 canvas.
%package gtk-devel
Summary: Development files for %{name}-gtk
Requires: %{name}-gtk%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release}
%description gtk-devel
The %{name}-gtk-devel package contains libraries and signature files for
developing applications that use %{name}-gtk.
%package pango
Summary: OCaml library to use pango with cairo
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
%description pango
%_description
This package contains OCaml bindings to use pango with cairo.
%package pango-devel
Summary: Development files for %{name}-pango
Requires: %{name}-pango%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release}
%description pango-devel
The %{name}-pango-devel package contains libraries and signature files
for developing applications that use %{name}-pango.
%prep
%autosetup -n cairo2-%{version}
%build
# 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
cairo_cflags="$(pkgconf --cflags cairo)"
cairo_libs="$(pkgconf --libs cairo)"
gtk_cflags="$(pkgconf --cflags gtk+-2.0)"
gtk_libs="$(pkgconf --libs gtk+-2.0)"
export CAIRO_CFLAGS="%{optflags} $cairo_cflags"
export CAIRO_LIBS="$RPM_LD_FLAGS $cairo_libs"
export GTK_CFLAGS="%{optflags} $gtk_cflags"
export GTK_LIBS="$RPM_LD_FLAGS $gtk_libs"
dune build
# Dune passes RPM_LD_FLAGS to ocamlmklib without -ldopt, resulting in "Unknown
# option" warnings from ocamlmklib and a library that has not been linked with
# the correct flags. We can't add -ldopt ourselves, since that breaks
# compilation of the cmxs files. This seems to be a weakness of dune; linker
# flags and libraries to be linked with have to be specified together, and
# nothing takes care of separating them and adding ldopt as necessary. We
# relink manually to address the problem.
pushd _build/default/src
ocamlmklib -g -ldopt "$RPM_LD_FLAGS" $cairo_libs -o cairo_stubs cairo_stubs.o
cd ../gtk
ocamlmklib -g -ldopt "$RPM_LD_FLAGS" $gtk_libs -o cairo_gtk_stubs cairo_gtk_stubs.o
cd ../pango
ocamlmklib -g -ldopt "$RPM_LD_FLAGS" $gtk_libs -o cairo_pango_stubs cairo_pango_stubs.o
popd
%install
export DESTDIR=$RPM_BUILD_ROOT
export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml
mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs
dune install --destdir=%{buildroot}
%if %{native_compiler}
ocamlfind install cairo2 src/{*.mli,*.cmi,*.cma,*.a,*.cmxa,*.cmx,dll*.so} META
%else
ocamlfind install cairo2 src/{*.mli,*.cmi,*.cma,dll*.so} META
# This just contains the README, LICENSE, and CHANGES files, 3 times, in
# directories with names other than the ones we want.
rm -rf %{buildroot}%{_prefix}/doc
%ifarch %{ocaml_native_compiler}
# Add missing executable bits
chmod a+x %{buildroot}%{_libdir}/ocaml/*/*.cmxs
%endif
# Remove files we do not need to package
rm %{buildroot}%{_libdir}/ocaml/*/*.ml
%check
dune runtest
%files
%{_libdir}/ocaml/cairo2
%if %{native_compiler}
%exclude %{_libdir}/ocaml/cairo2/*.a
%exclude %{_libdir}/ocaml/cairo2/*.cmxa
%exclude %{_libdir}/ocaml/cairo2/*.cmx
%doc CHANGES.md README.md
%license GPL3.md LICENSE.md
%dir %{_libdir}/ocaml/cairo2
%{_libdir}/ocaml/cairo2/META
%{_libdir}/ocaml/cairo2/cairo.cma
%{_libdir}/ocaml/cairo2/cairo.cmi
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/cairo2/cairo.cmxs
%endif
%exclude %{_libdir}/ocaml/cairo2/*.mli
%{_libdir}/ocaml/stublibs/*.so
%{_libdir}/ocaml/stublibs/*.so.owner
%{_libdir}/ocaml/stublibs/dllcairo_stubs.so
%files devel
# XXX The tutorial doesn't build.
%doc examples
%if %{native_compiler}
%{_libdir}/ocaml/cairo2/*.a
%{_libdir}/ocaml/cairo2/*.cmxa
%{_libdir}/ocaml/cairo2/*.cmx
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/cairo2/cairo.a
%{_libdir}/ocaml/cairo2/cairo.cmx
%{_libdir}/ocaml/cairo2/cairo.cmxa
%endif
%{_libdir}/ocaml/cairo2/*.mli
%{_libdir}/ocaml/cairo2/cairo.cmt
%{_libdir}/ocaml/cairo2/cairo.cmti
%{_libdir}/ocaml/cairo2/cairo.mli
%{_libdir}/ocaml/cairo2/cairo_ocaml.h
%{_libdir}/ocaml/cairo2/dune-package
%{_libdir}/ocaml/cairo2/libcairo_stubs.a
%{_libdir}/ocaml/cairo2/opam
%files gtk
%dir %{_libdir}/ocaml/cairo2-gtk
%{_libdir}/ocaml/cairo2-gtk/META
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.cma
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.cmi
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.cmxs
%endif
%{_libdir}/ocaml/stublibs/dllcairo_gtk_stubs.so
%files gtk-devel
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.a
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.cmx
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.cmxa
%endif
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.cmt
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.cmti
%{_libdir}/ocaml/cairo2-gtk/cairo_gtk.mli
%{_libdir}/ocaml/cairo2-gtk/dune-package
%{_libdir}/ocaml/cairo2-gtk/libcairo_gtk_stubs.a
%{_libdir}/ocaml/cairo2-gtk/opam
%files pango
%dir %{_libdir}/ocaml/cairo2-pango
%{_libdir}/ocaml/cairo2-pango/META
%{_libdir}/ocaml/cairo2-pango/cairo_pango.cma
%{_libdir}/ocaml/cairo2-pango/cairo_pango.cmi
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/cairo2-pango/cairo_pango.cmxs
%endif
%{_libdir}/ocaml/stublibs/dllcairo_pango_stubs.so
%files pango-devel
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/cairo2-pango/cairo_pango.a
%{_libdir}/ocaml/cairo2-pango/cairo_pango.cmx
%{_libdir}/ocaml/cairo2-pango/cairo_pango.cmxa
%endif
%{_libdir}/ocaml/cairo2-pango/cairo_pango.cmt
%{_libdir}/ocaml/cairo2-pango/cairo_pango.cmti
%{_libdir}/ocaml/cairo2-pango/cairo_pango.mli
%{_libdir}/ocaml/cairo2-pango/dune-package
%{_libdir}/ocaml/cairo2-pango/libcairo_pango_stubs.a
%{_libdir}/ocaml/cairo2-pango/opam
%changelog
* Wed Jan 22 2020 Jerry James <loganjerry@gmail.com> - 2:0.6.1-1
- New upstream version 0.6.1
- Add -gtk and -pango subpackages corresponding to upstream's opam packages
- Add -gtk-devel and -pango-devel subpackages to manage dependencies
- Add %%check script
* Sun Jan 19 2020 Richard W.M. Jones <rjones@redhat.com> - 2:0.4.7-0.28.gitbe5a298
- OCaml 4.10.0+beta1 rebuild.

View File

@ -1 +1 @@
55637a33b259c4598bbeafe23e5d335f ocaml-cairo-be5a298c28d90b2c44b7c00066902b53834720b3.tar.gz
SHA512 (cairo2-0.6.1.tbz) = d09274624854a45cf914ffbe984f1bcdd30db6283e7a0fd73aeec2a19226ff8f68d3f7139bbab72ca5698b58b840d6fd8a35570efc228391a7c5d031421f5c1f