Blob Blame History Raw
Name:           libsbml
Version:        5.11.0
Release:        4%{?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
Patch0:         trim-pc-file.diff

BuildRequires:  cmake
BuildRequires:  zlib-devel
BuildRequires:  bzip2-devel
BuildRequires:  libxml2-devel >= 2.6.16
BuildRequires:  python2-devel
BuildRequires:  python3-devel
BuildRequires:  check-devel
BuildRequires:  swig
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))

# https://sourceforge.net/p/sbml/libsbml/393/
ExcludeArch:    armv7hl

%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.

LibSBML is compiled with Python and PERL bindings for Fedora.
If you need additional bindings, feel free to create a bug report.

%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} = %{version}-%{release}
Provides:       bundled(jquery)
BuildArch:      noarch

%description    doc
This package contains %{summary}.

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

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

This is version for Python 2.

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

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

This is version for Python 3.

%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/392/
%patch0 -p1

# 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
sed -i 's|perl5/site_perl/${PERL_VERSION}/${PERL_PLATFORM}|perl5/vendor_perl|' src/bindings/perl/CMakeLists.txt

%build
mkdir build-c2 build-c3
pushd build-c2

%cmake -DENABLE_{LAYOUT,QUAL,COMP,FBC}=ON \
       -DWITH_{PYTHON,CHECK}=ON \
       -DPYTHON_INCLUDE_DIR:PATH=$(pkg-config --cflags python2|sed s/-I//) \
       -DPYTHON_LIBRARY:FILEPATH=$(pkg-config --libs python2) \
       -DPYTHON_EXECUTABLE:FILEPATH=%{__python2} \
       -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
       ..
make %{?_smp_mflags}

pushd ../build-c3
%cmake -DENABLE_{LAYOUT,QUAL,COMP,FBC}=ON \
       -DWITH_{PYTHON,PERL,CHECK}=ON \
       -DPYTHON_INCLUDE_DIR:PATH=$(pkg-config --cflags python3|sed s/-I//) \
       -DPYTHON_LIBRARY:FILEPATH=$(pkg-config --libs python3) \
       -DPYTHON_EXECUTABLE:FILEPATH=%{__python3} \
       -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
       ..
make %{?_smp_mflags}

pushd ..
%configure --disable-static \
           --with-doxygen \
           --with-python --with-python-interpreter=%{__python3} \
           --enable-layout --enable-comp --enable-fbc --enable-qual
make %{?_smp_mflags} docs
make %{?_smp_mflags} libsbml.pc

%install
make -C build-c2 install DESTDIR=%{buildroot}
make -C build-c3 install DESTDIR=%{buildroot}
make install-docs DESTDIR=%{buildroot}
make install-pc DESTDIR=%{buildroot}

# stupid cmake
rm %{buildroot}%{_libdir}/libsbml-static.a
rm %{buildroot}%{_datadir}/libsbml -r

mv %{buildroot}%{_pkgdocdir}-%{version} %{buildroot}%{_pkgdocdir}

%check
make -C build-c2 %{?_smp_mflags} check
make -C build-c3 %{?_smp_mflags} check

%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 python3-%{name}
#%%{python_sitearch}/%{name}*.egg-info
%{python3_sitearch}/%{name}.pth
%{python3_sitearch}/%{name}

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

%changelog
* Wed Dec 17 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-4
- Do not build on arm

* Sat Dec 13 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-3
- Convert to hybrid cmake (main part) / make (docs).

* Fri Dec 12 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-2
- docs subpackage is no arch, remove %%{_isa} from dependency.

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