Blob Blame History Raw
# Testing note: The makefile in test is broken in version 0.9.10.  After
# repairing it, compilation of ctest1.c fails due to too few arguments to
# ap_pkgrid_manager_alloc().  Try to create a %%check section again later.

Name:           apron
Version:        0.9.10
Release:        24%{?dist}
Summary:        Numerical abstract domain library

# The entire package is LGPLv2+ except newpolka/mf_qsort.c and ppl/*, all of
# which are GPLv2+.  This means that libpolkaMPQ.so.*, libpolkaRll.so.*, and
# libap_ppl.so.* are GPLv2+, and the other libraries are all LGPLv2+.
License:        LGPLv2+ and GPLv2+
URL:            http://apron.cri.ensmp.fr/library/
Source0:        http://apron.cri.ensmp.fr/library/%{name}-%{version}.tgz
# This patch has not been sent upstream as it is GCC-specific.  Certain
# symbols are defined in both libpolkaMPQ and libpolkaRll, with different
# implementations.  This patch makes references to those symbols in
# libap_pkgrid be weak references, since that library can be combined with
# either of the 2 implementations.
Patch0:         %{name}-weak.patch
# Sent upstream 10 May 2012.  This patch adapts to mlgmpidl 1.2.
Patch1:         %{name}-mlgmpidl12.patch
# Sent upstream 14 Feb 2013.  Fix the tests for GCC 4.7.1.
Patch2:         %{name}-test.patch
# Sent upstream 14 Feb 2013.  Adapt to PPL 1.0 + GMP 5.1.0
Patch3:         %{name}-ppl1.patch
# Alreay applied upstream.  Fix a -Werror=format-security failure.
Patch4:         %{name}-format-security.patch

BuildRequires:  mpfr-devel
BuildRequires:  ppl-devel
BuildRequires:  ocaml
BuildRequires:  ocaml-camlidl-devel
BuildRequires:  ocaml-mlgmpidl-devel
BuildRequires:  ocaml-ocamldoc

%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)

%global sover %(cut -d. -f 1 <<< %{version})

%description
The APRON library is dedicated to the static analysis of the numerical
variables of a program by Abstract Interpretation.  The aim of such an
analysis is to infer invariants about these variables, like 1<=x+y<=z,
which holds during any execution of the program.

The APRON library is intended to be a common interface to various
underlying libraries/abstract domains and to provide additional services
that can be implemented independently from the underlying
library/abstract domain.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       gmp-devel%{?_isa}
Requires:       mpfr-devel%{?_isa}

%description    devel
The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.

%package -n     ocaml-%{name}
Summary:        Ocaml interface to APRON
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description -n ocaml-%{name}
Ocaml interface to the APRON library.

%package -n     ocaml-%{name}-devel
Summary:        Development files for the Ocaml interface to APRON
Requires:       ocaml-%{name}%{?_isa} = %{version}-%{release}
Requires:       ocaml-camlidl-devel%{?_isa}
Requires:       ocaml-mlgmpidl-devel%{?_isa}
Requires:       %{name}-devel%{?_isa} = %{version}-%{release}

%description -n ocaml-%{name}-devel
Development files for the Ocaml interface to the APRON library.

%prep
%setup -q
%patch0
%patch1
%patch2
%patch3
%patch4

# Set the configuration values
sed -e "s|^# HAS_CPP.*|HAS_CPP = 1|" \
    -e "s|^# HAS_PPL.*|HAS_PPL = 1|" \
    -e "s|^# HAS_LONG_DOUBLE.*|HAS_LONG_DOUBLE = 1|" \
    -e "s|^APRON_PREFIX =.*|APRON_PREFIX=%{_prefix}|" \
    -e "s|^MLGMPIDL_PREFIX =.*|MLGMPIDL_PREFIX=%{_libdir}/ocaml/gmp|" \
    -e "s|^PPL_PREFIX =.*|PPL_PREFIX=%{_prefix}|" \
    -e "s|^-fPIC -O3 -DNDEBUG|$RPM_OPT_FLAGS -fsigned-char -fPIC -DNDEBUG -Wl,--as-needed|" \
    -e "s|^-fPIC -g -O0|$RPM_OPT_FLAGS -fsigned-char -fPIC -Wl,--as-needed|" \
    -e "s|-std=c99|-std=gnu99 -D_GNU_SOURCE|" \
%if !%opt
    -e "s|^HAS_OCAMLOPT.*|# HAS_OCAMLOPT = 1|" \
    -e "s|\.opt||" \
%endif
    Makefile.config.model > Makefile.config

# Fix library paths
sed -e "s|\$(CAMLIDL_PREFIX)/lib/ocaml|%{_libdir}/ocaml|g" \
    -e "s|\$(MLGMPIDL_PREFIX)/include|\$(MLGMPIDL_PREFIX)|g" \
    -e "s|\$(MLGMPIDL_PREFIX)/lib|\$(MLGMPIDL_PREFIX)|g" \
    -e "s|-std=c99|-std=gnu99 -D_GNU_SOURCE|" \
    -i Makefile box/Makefile examples/Makefile mlapronidl/Makefile \
       newpolka/Makefile octagons/Makefile ppl/Makefile products/Makefile \
       test/Makefile

# Remove rpaths
for f in `find . -name Makefile`; do
  sed -r -e 's| ?-L\$\(APRON_PREFIX\)/lib||' \
         -e 's| ?-L\$\(GMP_PREFIX\)/lib||' \
         -e 's| ?-L\$\(MPFR_PREFIX\)/lib||' \
         -e 's| ?-L\$\(PPL_PREFIX\)/lib||' \
         -i $f
done

# Fix the install location for libraries
if [ %{_libdir} = "/usr/lib64" ]; then
  sed -e "s|\$(APRON_PREFIX)/lib|\$(APRON_PREFIX)/lib64|g" \
      -e "s|\$(PREFIX)/lib|\$(PREFIX)/lib64|g" \
      -i apron/Makefile apronxx/Makefile box/Makefile examples/Makefile \
         itv/Makefile mlapronidl/Makefile newpolka/Makefile octagons/Makefile \
         ppl/Makefile products/Makefile test/Makefile
fi

# Add sonames
sed -i -e "s|-shared|-shared -Wl,-soname=\$@.%{sover}|" apron/Makefile
sed -r -e "s|(-shared -o \\\$@ \\\$\^ \\\$\(LIBS.*\))|\1 -Wl,-soname=\$@.%{sover}|" \
    -i apronxx/Makefile box/Makefile newpolka/Makefile octagons/Makefile \
    ppl/Makefile products/Makefile

# Fix submakes
sed -i "s|make|\$(MAKE)|g" Makefile

# Fix encodings
iconv -f iso8859-1 -t utf-8 Changes > Changes.utf8
touch -r Changes Changes.utf8
mv -f Changes.utf8 Changes

%build
# FIXME: Cannot use %%{?_smp_mflags} due to missing Makefile dependencies
make

%install
mkdir -p $RPM_BUILD_ROOT%{_prefix}
make install APRON_PREFIX=$RPM_BUILD_ROOT%{_prefix}

# We don't really want the test binaries
rm -fr $RPM_BUILD_ROOT%{_bindir}

# Move the header files into a subdirectory
mkdir $RPM_BUILD_ROOT%{_includedir}/%{name}
mv $RPM_BUILD_ROOT%{_includedir}/*.h $RPM_BUILD_ROOT%{_includedir}/apronxx \
   $RPM_BUILD_ROOT%{_includedir}/oct $RPM_BUILD_ROOT%{_includedir}/%{name}

# Most files in _libdir are ocaml files, and so are in the wrong place.
mkdir -p $RPM_BUILD_ROOT%{_libdir}/ocaml/%{name}
mv $RPM_BUILD_ROOT%{_libdir}/*.{a,cma,cmi,cmx,cmxa,idl,ml,mli} \
   $RPM_BUILD_ROOT%{_libdir}/*_caml.so \
   $RPM_BUILD_ROOT%{_libdir}/*_caml_debug.so \
   $RPM_BUILD_ROOT%{_libdir}/ocaml/%{name}

# Remove extraneous executable bits
chmod a-x $RPM_BUILD_ROOT%{_libdir}/ocaml/%{name}/*.{a,cma,cmi,cmx*,idl,ml,mli}
find $RPM_BUILD_ROOT%{_includedir} \( -name \*.h -o -name \*.hh \) \
     -perm /0111 | xargs chmod a-x

# Make duplicate files be symbolic links instead of copies
for f in ap_ppl apron boxD boxMPFR boxMPQ octD octMPQ polkaGrid polkaMPQ \
         polkaRll; do
  rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/%{name}/dll${f}_caml.so
  ln -s lib${f}_caml.so \
        $RPM_BUILD_ROOT%{_libdir}/ocaml/%{name}/dll${f}_caml.so
  rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/%{name}/dll${f}_caml_debug.so
  ln -s lib${f}_caml_debug.so \
        $RPM_BUILD_ROOT%{_libdir}/ocaml/%{name}/dll${f}_caml_debug.so
done

# Fix up the shared library names
cd $RPM_BUILD_ROOT%{_libdir}
for f in lib*.so; do
  mv $f $f.%{version}
  ln -s $f.%{sover} $f
  ln -s $f.%{version} $f.%{sover}
done

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc AUTHORS Changes README apron/apron.pdf
%license COPYING
%{_libdir}/*.so.*
%exclude %{_libdir}/*_debug.so*

%files devel
%doc apron/html/*
%{_libdir}/*.so
%exclude %{_libdir}/*_debug.so
%{_includedir}/%{name}
%exclude %{_includedir}/%{name}/apron_caml.h

%files -n ocaml-%{name}
%doc mlapronidl/mlapronidl.pdf
%{_libdir}/ocaml/%{name}
%exclude %{_libdir}/ocaml/%{name}/*_debug.so
%if %opt
%exclude %{_libdir}/ocaml/%{name}/*.a
%exclude %{_libdir}/ocaml/%{name}/*.cmxa
%exclude %{_libdir}/ocaml/%{name}/*.cmx
%endif
%exclude %{_libdir}/ocaml/%{name}/*.ml
%exclude %{_libdir}/ocaml/%{name}/*.mli

%files -n ocaml-%{name}-devel
%doc mlapronidl/html/*
%{_includedir}/%{name}/apron_caml.h
%if %opt
%{_libdir}/ocaml/%{name}/*.a
%exclude %{_libdir}/ocaml/%{name}/*_debug.a
%{_libdir}/ocaml/%{name}/*.cmxa
%{_libdir}/ocaml/%{name}/*.cmx
%endif
%{_libdir}/ocaml/%{name}/*.ml
%{_libdir}/ocaml/%{name}/*.mli

%changelog
* Wed Feb 11 2015 Jerry James <loganjerry@gmail.com> - 0.9.10-24
- Use license macro

* Sun Aug 31 2014 Richard W.M. Jones <rjones@redhat.com> - 0.9.10-23
- ocaml-4.02.0 final rebuild.

* Sat Aug 23 2014 Richard W.M. Jones <rjones@redhat.com> - 0.9.10-22
- ocaml-4.02.0+rc1 rebuild.

* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Aug 02 2014 Richard W.M. Jones <rjones@redhat.com> - 0.9.10-20
- ocaml-4.02.0-0.8.git10e45753.fc22 rebuild.

* Mon Jul 21 2014 Jerry James <loganjerry@gmail.com> - 0.9.10-19
- OCaml 4.02.0 beta rebuild

* Fri Jun 27 2014 Jerry James <loganjerry@gmail.com> - 0.9.10-18
- Build with -fsigned-char to fix FTBFS on aarch64
- Use a better test for installing files into 64-bit libdir

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Apr 30 2014 Jerry James <loganjerry@gmail.com> - 0.9.10-16
- Rebuild for ppl 1.1

* Fri Apr 18 2014 Jerry James <loganjerry@gmail.com> - 0.9.10-15
- Ensure GNU extensions are enabled to fix build failure

* Tue Apr 15 2014 Richard W.M. Jones <rjones@redhat.com> - 0.9.10-15
- Remove ocaml_arches macro (RHBZ#1087794).

* Wed Nov 20 2013 Jerry James <loganjerry@gmail.com> - 0.9.10-14
- Add -format-security patch

* Sat Sep 14 2013 Richard W.M. Jones <rjones@redhat.com> - 0.9.10-13
- Rebuild for OCaml 4.01.0.

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Jerry James <loganjerry@gmail.com> - 0.9.10-11
- Add -ppl1 patch to adapt to PPL 1.0 + GMP 5.1.0
- Update -mlgmpidl12 patch to fix more problems

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Nov 30 2012 Tom Callaway <spot@fedoraproject.org> - 0.9.10-10
- rebuild for ppl

* Wed Oct 17 2012 Jerry James <loganjerry@gmail.com> - 0.9.10-9
- Rebuild for OCaml 4.00.1

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.10-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jun  9 2012 Jerry James <loganjerry@gmail.com> - 0.9.10-7
- Rebuild for OCaml 4.00.0

* Wed May  9 2012 Jerry James <loganjerry@gmail.com> - 0.9.10-6
- Rebuild for new ocaml-mlgmpidl

* Fri Jan  6 2012 Jerry James <loganjerry@gmail.com> - 0.9.10-5
- Rebuild for GCC 4.7 and Ocaml 3.12.1

* Tue Nov  8 2011 Jerry James <loganjerry@gmail.com> - 0.9.10-4
- -devel also needs ocaml-camlidl-devel
- Pass --as-needed to the linker to fix unused shared library dependencies

* Fri Nov  4 2011 Jerry James <loganjerry@gmail.com> - 0.9.10-3
- Comment on license situation
- Drop debug libraries altogether

* Wed Aug 24 2011 Jerry James <loganjerry@gmail.com> - 0.9.10-2
- Correct license
- Build C and C++ interfaces even when the ocaml interface cannot be built
- Move debug libraries to separate packages

* Fri Jul  8 2011 Jerry James <loganjerry@gmail.com> - 0.9.10-1
- Initial RPM