Blob Blame History Raw
#global do_check
Name:           libsbml
Version:        5.11.0
Release:        1%{?dist}
Summary:        Systems Biology Markup Language library

License:        LGPLv2+
URL:            http://sbml.org/Software/libSBML
Source0:        http://downloads.sourceforge.net/project/sbml/libsbml/5.11.0/stable/libSBML-5.11.0-core-plus-packages-src.tar.gz

BuildRequires:  zlib-devel
BuildRequires:  bzip2-devel
BuildRequires:  libxml2-devel >= 2.6.16
BuildRequires:  python2-devel
BuildRequires:  check-devel
BuildRequires:  swig
BuildRequires:  chrpath
BuildRequires:  doxygen
BuildRequires:  doxygen-latex
BuildRequires:  graphviz
BuildRequires:  hostname
BuildRequires:  perl(Test::More)
BuildRequires:  perl(ExtUtils::MakeMaker)

Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description
LibSBML is an open-source programming library designed to
read, write, manipulate, translate, and validate SBML files and data
streams.  It is not an application itself (though it does come with
example programs), but rather a library you can embed in other
applications.

LibSBML %{version} understands SBML Level 3 Version 1 and older,
as well as the draft SBML Level 2 Layout proposal by Gauges, Rost,
Sahle and Wegner.  It's written in ISO C and C++ but can also be
used from C#, Java, MATLAB, Octave, Perl, Python, and Ruby.

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

%description    devel
This package contains libraries and header files for developing
applications that use libSBML.

%package        doc
Summary:        API documentation for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Provides:       bundled(jquery)
BuildArch:      noarch

%description    doc
This package contains %{summary}.

%package -n python-%{name}
Summary:        Python bindings for libSBML
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description -n python-%{name}
This package contains %{summary}.

%package -n perl-LibSBML
Summary:        PERL bindings for libSBML
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description -n perl-LibSBML
This package contains %{summary}.

%prep
%setup -q -n libSBML-%{version}-Source

# https://sourceforge.net/p/sbml/libsbml/391
iconv -f latin1 -t utf8 NEWS.txt > t; touch -r NEWS.txt t; mv t NEWS.txt

# Fix invalid shebang
# https://sourceforge.net/p/sbml/libsbml/390
sed -i -r 's|(#!/usr/bin/env python) +#.*|#!%{__python2}|' docs/src/filters/doc-filter-python.py

# Install perl to vendor_perl
sed -i s/pure_install/pure_vendor_install/ src/bindings/perl/Makefile.in

%build
%configure --disable-static \
           --with-check \
           --with-swig \
           --with-doxygen \
           --with-python --with-python-interpreter=%{__python2} \
           --with-perl \
           --enable-layout --enable-comp --enable-fbc --enable-qual

# parallel link does not work for the automake version
# https://sourceforge.net/p/sbml/libsbml/389/
make
make %{?_smp_mflags} docs

%if 0%{?do_check}
# check does not pass: https://sourceforge.net/p/sbml/libsbml/388
%check
# link is broken with parallel build :(
make check
%endif

%install
make install DESTDIR=%{buildroot}
make install-docs DESTDIR=%{buildroot}
find %{buildroot} -name '*.la' -delete
rm -rv %{buildroot}%{perl_vendorarch}/auto/*/.{libs,packlist}
# Fix permissions to avoid problems later
chmod u+w -R . %{buildroot}
# Remove RPATHs
chrpath --delete %{buildroot}%{python_sitearch}/%{name}/*.so
chrpath --delete %{buildroot}%{perl_vendorarch}/auto/*/*.so
mv %{buildroot}%{_pkgdocdir}-%{version} %{buildroot}%{_pkgdocdir}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license COPYING.txt
%doc AUTHORS.txt README.txt NEWS.txt OLD_NEWS.txt
%{_libdir}/*.so.*
%exclude %{_pkgdocdir}/*-api

%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{name}.pc

%files doc
%{_pkgdocdir}/cpp-api
# Binding docs are here too, as a compromise. Making a separate
# python-libsbml-doc seems overkill, but including them in an arched
# package is not nice.
%{_pkgdocdir}/python-api

%files -n python-%{name}
%{python_sitearch}/%{name}*.egg-info
%{python_sitearch}/%{name}.pth
%{python_sitearch}/%{name}

%files -n perl-LibSBML
%{perl_vendorarch}/*
%exclude %dir %{perl_vendorarch}/auto/

%changelog
* Tue Dec 09 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-1
- Initial packaging.