Blob Blame History Raw
%global  checkout   22272
%global  date       20150528

%bcond_without perl
%bcond_without ruby
%bcond_without octave
%bcond_without check
%bcond_without r
%bcond_without python3
%bcond_without python2

%ifarch %{mono_arches}
%bcond_without mono
%else
%bcond_with mono
%endif

%ifarch s390 s390x %{arm} aarch64 ppc64 ppc64le
%bcond_with java
%else
%bcond_without java
%endif

# those have special requirements, the rest follows main package name
%global octpkg  SBML
%global perlpkg LibSBML
%global rubypkg SBML
%global rpkg    libSBML

%if %{with octave}
# Exclude .oct files from provides
%global __provides_exclude_from ^%{octpkglibdir}/.*\\.oct$
%endif

# Use the same directory of the main package for subpackage licence and docs
%global _docdir_fmt %{name}

Name:           libsbml
Version:        5.11.5
#Release:        1%{?dist}
Release:        0.9.%{date}svn%{checkout}%{?dist}
Summary:        Systems Biology Markup Language library

License:        LGPLv2+
URL:            http://sbml.org/Software/libSBML

## Source archive from svn #22272; obtained by:
## svn checkout http://svn.code.sf.net/p/sbml/code/trunk/libsbml sbml-code
## tar -czvf  libsbml-svn22272.tar.gz sbml-code
Source0:        libsbml-svn%{checkout}.tar.gz
#Source0:        http://downloads.sourceforge.net/project/sbml/libsbml/%%{version}/stable/libSBML-%%{version}-core-src.zip
Source1:        http://sourceforge.net/projects/sbml/files/libsbml/5.11.4/experimental/source/render-5.11.4-beta-1.zip

## Unbundle minizip
Patch0:         libsbml-use-system-minizip-cmake.patch
## Fix library installation paths
Patch1:         libsbml-fix_install_libpaths.patch

BuildRequires:  cmake, clang
BuildRequires:  zlib-devel
BuildRequires:  bzip2-devel
BuildRequires:  libxml2-devel >= 2.6.16
BuildRequires:  expat-devel
BuildRequires:  check-devel
BuildRequires:  minizip-devel
BuildRequires:  swig
BuildRequires:  hostname

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

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

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

This is the version for Python 2.
%endif
%if %{with python3}
%package -n python3-%{name}
BuildRequires:  python3-devel
Summary:        Python 3 bindings for libSBML
Requires:       %{name}%{?_isa} = %{version}-%{release}

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

This is the version for Python 3.
%endif

%if %{with perl}
%package -n perl-%{perlpkg}
BuildRequires:  perl(Test::More)
BuildRequires:  perl(ExtUtils::MakeMaker)
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Summary:        PERL bindings for libSBML
Requires:       %{name}%{?_isa} = %{version}-%{release}

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

%if %{with ruby}
%package -n ruby-%{rubypkg}
BuildRequires:  ruby-devel
Requires:       ruby(release)
Requires:       %{name}%{?_isa} = %{version}-%{release}
Provides:       ruby(%{rubypkg}) = %{version}
Summary:        Ruby bindings for libSBML

%description -n ruby-%{rubypkg}
This package contains %{summary}.
%endif

%if %{with java}
%package -n java-%{name}
BuildRequires:  java-devel
Requires:       java-headless
Requires:       jpackage-utils
Requires:       %{name}%{?_isa} = %{version}-%{release}
Summary:        Java bindings for libSBML

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

%if %{with octave}
%package -n octave-%{octpkg}
BuildRequires:  octave-devel
Requires:       octave(api) = %{octave_api}
Requires(post): octave
Requires(postun): octave
Requires:       %{name}%{?_isa} = %{version}-%{release}
Summary:        Octave bindings for libSBML

%description -n octave-%{octpkg}
This package contains %{summary}.
%endif

%if %{with r}
%package -n R-%{rpkg}
BuildRequires:  R-devel
BuildRequires:  R-core-devel
BuildRequires:  tex(latex)
Requires:       R-core
Summary:        R bindings for libSBML
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description -n R-%{rpkg}
This package contains %{summary}.
%endif

%if %{with mono}
%package sharp
BuildRequires:  mono-core
BuildRequires:  xerces-c-devel, libxml2-devel, expat-devel
Summary:        C# bindings for libSBML
Requires:       mono-core
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description sharp
This package contains %{summary}.
%endif

%if %{with doc}
%package        doc
BuildRequires:  doxygen
BuildRequires:  doxygen-latex
BuildRequires:  graphviz
Summary:        API documentation for %{name}
Requires:       %{name} = %{version}-%{release}

##Granted  exception temporarily
##http://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries
Provides:       bundled(jquery)
BuildArch:      noarch

%description    doc
This package contains %{summary}.
%endif

%prep
%autosetup -n sbml-code -p1

sed -i -r 's/DOXYGEN_MAX_VERSION=1\.8\.8/DOXYGEN_MAX_VERSION=1.8.9/' configure

unzip -n %{SOURCE1}

# 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
for i in `find docs/src/filters -type f \( -name "*.py" \)`; do
sed -i -r 's|(#!/usr/bin/env python) +#.*|#!%{__python2}|' $i
done

# Delete bundled minizip
rm -v src/sbml/compress/{crypt.h,ioapi.*,iowin32.*,unzip.*,zip.*}

#grep -e 'This file was automatically generated by SWIG' -r . -l|xargs rm

mkdir build-docs
cp -a $(/bin/ls -1|grep -v build-docs) build-docs/

%build
mkdir build2 build
pushd build2

export LDFLAGS="%{__global_ldflags} -Wl,--as-needed"
%if %{with python2}
# This build is only for Python 2
%cmake -DENABLE_{LAYOUT,QUAL,COMP,FBC,RENDER}=ON \
%if 0%{?fedora} > 22
%ifarch x86_64
       -DCMAKE_CXX_COMPILER:FILEPATH=%{_bindir}/clang++ \
%endif
       -DCSHARP_COMPILER:FILEPATH=%{_bindir}/mcs \
%endif
       -DWITH_PYTHON=ON \
%if %{with check}
       -DWITH_CHECK=ON \
%endif
       -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} \
       -DWITH_LIBXML:BOOL=ON \
       -DWITH_EXPAT:BOOL=OFF \
       -Wno-dev \
       ..
make %{?_smp_mflags}
%endif

pushd ../build
export LDFLAGS="%{__global_ldflags} -Wl,--as-needed"
%cmake -DENABLE_{LAYOUT,QUAL,COMP,FBC,RENDER}=ON \
%if 0%{?fedora} > 22
%ifarch x86_64
       -DCMAKE_CXX_COMPILER:FILEPATH=%{_bindir}/clang++ \
%endif
       -DCSHARP_COMPILER:FILEPATH=%{_bindir}/mcs \
%endif
%if %{with python3}
       -DWITH_PYTHON=ON \
       -DPYTHON_INCLUDE_DIR:PATH=$(pkg-config --cflags python3|sed s/-I//) \
       -DPYTHON_LIBRARY:FILEPATH=$(pkg-config --libs python3) \
       -DPYTHON_EXECUTABLE:FILEPATH=%{__python3} \
%endif
%if %{with perl}
       -DWITH_PERL=ON \
%endif
%if %{with ruby}
       -DWITH_RUBY=ON \
%endif
%if %{with java}
       -DWITH_JAVA=ON \
       -DWITH_JAVASCRIPT:BOOL=OFF \
       -DWITH_SWIG:BOOL=ON \
%endif
%if %{with octave}
       -DWITH_OCTAVE=ON \
%endif
%if %{with octave}
       -DWITH_OCTAVE=ON \
%endif
%if %{with r}
       -DWITH_R=ON \
       -DR_INCLUDE_DIRS:PATH=%{_includedir}/R \
%endif
%if %{with mono}
       -DWITH_CSHARP:BOOL=ON \
       -DWITH_XERCES:BOOL=OFF \
       -DWITH_LIBXML:BOOL=ON \
       -DWITH_EXPAT:BOOL=OFF \
       -DWITH_SWIG:BOOL=ON \
%endif
%if %{with check}
       -DWITH_CHECK=ON \
%endif
       -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
       -DCMAKE_BUILD_TYPE:STRING=Release \
       -DCMAKE_SKIP_RPATH:BOOL=YES \
       -DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES \
       -Wno-dev \
       ..
make %{?_smp_mflags}

pushd ../build-docs
%configure --disable-static \
           --with-expat=no \
           --with-libxml=yes \
%if %{with doc}
           --with-doxygen \
%endif
%if %{with python}
           --with-python --with-python-interpreter=%{__python3} \
%endif
           --enable-layout --enable-comp --enable-fbc --enable-qual
%if %{with doc}
cp ../build/src/bindings/python/libsbml-doxygen.py src/bindings/python/
make %{?_smp_mflags} docs
%endif
make %{?_smp_mflags} libsbml.pc

%install
%if %{with python2}
make -C build2 install DESTDIR=%{buildroot}
%endif
make -C build install DESTDIR=%{buildroot}

%if %{with octave}
chmod 0755 %{buildroot}%{octpkglibdir}/*.mex
%endif

%if %{with java}
mkdir -p %{buildroot}%{_libdir}/%{name} %{buildroot}%{_jnidir}
mv %{buildroot}%{_javadir}/libsbmlj.jar %{buildroot}%{_jnidir}/
mv %{buildroot}%{_libdir}/libsbmlj.so %{buildroot}%{_libdir}/%{name}/
%endif

%if %{with r}
mkdir -p %{buildroot}%{_libdir}/R/library
R CMD INSTALL -l %{buildroot}%{_libdir}/R/library build/src/bindings/r/%{rpkg}_%{version}_R_*.tar.gz
rm -rf %{buildroot}%{_libdir}/R/library/%{rpkg}/R.css
%endif

%if %{with doc}
make -C build-docs install-docs DESTDIR=%{buildroot}
mv %{buildroot}%{_pkgdocdir}-%{version} %{buildroot}%{_pkgdocdir}
%endif
make -C build-docs install-pc DESTDIR=%{buildroot}

%if %{with ruby}
install -Dm0644 src/bindings/ruby/README.txt %{buildroot}%{_pkgdocdir}/README-ruby.txt
%endif

%if %{with check}
%check
export CK_FORK=no
make -C build2 check CTEST_OUTPUT_ON_FAILURE=TRUE
%endif

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

%files
%license COPYING.txt LICENSE.txt
%doc AUTHORS.txt README* NEWS.txt OLD_NEWS.txt
%{_libdir}/*.so.*
##This directory provides just some txt documentation files
%exclude %{_datadir}/libsbml
%if %{with doc}
%exclude %{_pkgdocdir}/*-api
%endif

%files devel
%{_includedir}/sbml/
%{_libdir}/*.so
%exclude %{_libdir}/libsbml-static.a
%{_libdir}/pkgconfig/%{name}.pc

%if %{with python2}
%license COPYING.txt LICENSE.txt
%files -n python-%{name}
#%%{python2_sitearch}/%%{name}*.egg-info
%{python2_sitearch}/%{name}.pth
%{python2_sitearch}/%{name}
%endif

%if %{with python3}
%files -n python3-%{name}
%license COPYING.txt LICENSE.txt
#%%{python3_sitearch}/%%{name}*.egg-info
%{python3_sitearch}/%{name}.pth
%{python3_sitearch}/%{name}
%endif

%if %{with perl}
%files -n perl-%{perlpkg}
%license COPYING.txt LICENSE.txt
%{perl_vendorarch}/*
%exclude %dir %{perl_vendorarch}/auto/
%endif

%if %{with ruby}
%files -n ruby-%{rubypkg}
%license COPYING.txt LICENSE.txt
%doc %{_pkgdocdir}/README-ruby.txt
%{ruby_vendorarchdir}/*.so
%endif

%if %{with java}
%files -n java-%{name}
%license COPYING.txt LICENSE.txt
%{_jnidir}/libsbmlj.jar
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/libsbmlj.so
%endif

%if %{with octave}
%files -n octave-%{octpkg}
%license COPYING.txt
%{octpkglibdir}/
%endif

%if %{with r}
%files -n R-%{rpkg}
%license COPYING.txt LICENSE.txt
%{_libdir}/R/library/%{rpkg}/
%endif

%if %{with mono}
%files sharp
%license COPYING.txt LICENSE.txt
%{_monodir}/libsbmlcsP/
%endif

%if %{with doc}
%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
%endif


%changelog
* Thu Jun 18 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.5-0.9.20150528svn22272
- All tests enabled

* Thu Jun 18 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.5-0.8.20150528svn22272
- Excluded failed tests

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.11.5-0.7.20150528svn22272
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 06 2015 Jitka Plesnikova <jplesnik@redhat.com> - 5.11.5-0.6.20150528svn22272
- Perl 5.22 rebuild

* Thu Jun 04 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.5-0.5.20150528svn22272
- Rebuild again

* Thu Jun 04 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.5-0.4.20150528svn22272
- Performed all tests in F23

* Wed Jun 03 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.5-0.3.20150528svn22272
- Exclude 'test_csharp_bindings_full' and 'test_ruby_binding' test in <F23

* Wed Jun 03 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.5-0.2.20150528svn22272
- Exclude 'test_csharp_bindings_full' test in ARM
- Use clang++ in >F22

* Thu May 28 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.5-0.1.20150528svn22272
- Update to svn pre-release #22272
- clang++ set as compiler on >F22
- Set C# compiler on >F22

* Thu May 28 2015 Antonio Trande <sagitterATfedoraproject.org> - 5.11.4-1
- Update to 5.11.4
- clang++ set as compiler

* Sat Feb 21 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-11
- Disable -java and -mono on arch: they crash in tests

* Fri Feb 06 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-10
- Rename -docs to -doc, run make unparallelized

* Wed Feb 04 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-9
- Apply upstream patch for arm test failures

* Tue Feb 03 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-8
- Fix things found in review (macro in comment, R:mono-core, %%doc
  duplication, macro usage)

* Mon Jan 26 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-7
- Allow newer doxygen

* Fri Jan 09 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-6
- Enable many many subpackages

* Tue Jan 06 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5.11.0-5
- Unbundle minizip

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