Blob Blame History Raw
%if 0%{?fedora} <= 22
%global _hardened_build 1
%endif

##Documents generation and Octave binding seem not available yet
##Tests not provided
%global with_python2 1
%global with_python3 1
%global with_ruby    1

%ifarch s390 s390x %{arm} aarch64 ppc64 ppc64le
%global with_java    0
%else
%global with_java    1
%endif

%global with_octave  0
%global with_perl    1
%global with_r       1

%ifarch %{mono_arches}
%global with_mono    1
%else
%global with_mono    0
%endif

%global with_doc     0
%global with_check   1

%global octpkg SEDML
%if 0%{?with_octave}
# Exclude .oct files from provides
%global __provides_exclude_from ^%{octpkglibdir}/.*\\.oct$
%endif

%global _docdir_fmt %{name}

Name:           libsedml
Summary:        Library that fully supports SED-ML for SBML
Version:        0.3.1
Release:        5%{?dist}
URL:            https://github.com/fbergmann/libSEDML
Source0:        https://github.com/fbergmann/libSEDML/archive/v.%{version}.tar.gz#/libSEDML-v.%{version}.tar.gz
License:        BSD

BuildRequires:  cmake, zlib-devel, swig, libsbml-devel, libxml2-devel, bzip2-devel
BuildRequires:  xerces-c-devel, clang

%if 0%{?with_check}
BuildRequires:  check-devel
%endif

##This patch BuildRequires:  cmakesets libraries' installation paths
Patch0: %{name}-fix_install_libpaths.patch

%description
C++ library that fully supports SED-ML 
(Simulation Experiment Description Markup Language) for SBML as well as 
CellML models for creation of the description just as for
the execution of Simulation Experiments. 
This project makes use of libSBML XML layer as well as code generation 
as starting point to produce a library for reading and writing of SED-ML models.
This package provides header and library files of libsedml.
 

%package devel
Summary: Library that fully supports SED-ML for SBML 
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
This package provides header and library files of libsedml.

%if 0%{?with_python2}
%package -n python-libsedml
Summary: Python2 library that fully supports SED-ML for SBML
BuildRequires: python2-devel
%description -n python-libsedml
The %{octpkg} python package contains the libraries to 
develop applications with libSEDML Python2 bindings.
%endif

%if 0%{?with_python3}
%package -n python3-libsedml
Summary: Python3 library that fully supports SED-ML for SBML
BuildRequires: python3-devel
%description -n python3-libsedml
The %{octpkg} python package contains the libraries to 
develop applications with libSEDML Python3 bindings.
%endif

%if 0%{?with_java}
%package -n java-%{octpkg}
Summary: Java library that fully supports SED-ML for SBML
BuildRequires:  java-1.8.0-openjdk-devel
BuildRequires:  java-devel
Requires:       java-headless
Requires:       jpackage-utils
%description -n java-%{octpkg}
The %{octpkg} java package contains the libraries to 
develop applications with libSEDML Java bindings.
%endif

%if 0%{?with_octave}
%package -n octave-%{octpkg}
Summary: Octave library that fully supports SED-ML for SBML
BuildRequires:  octave-devel
Requires:       octave(api) = %{octave_api}
Requires(post): octave
Requires(postun): octave
%description -n octave-%{octpkg}
The %{octpkg} octave package contains the libraries to 
develop applications with libSEDML Octave bindings.
%endif

%if 0%{?with_perl}
%package -n perl-%{octpkg}
Summary: Perl library that fully supports SED-ML for SBML
BuildRequires: perl
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Test::More)
Requires:      perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%description -n perl-%{octpkg}
The %{octpkg} perl package contains the libraries to 
develop applications with libSEDML Perl bindings.
%endif

%if 0%{?with_ruby}
%package -n ruby-%{octpkg}
Summary: Ruby library that fully supports SED-ML for SBML
BuildRequires: ruby-devel
Requires: ruby(release)
Provides: ruby(SBML) = %{version}
%description -n ruby-%{octpkg}
The %{octpkg} ruby package contains the libraries to 
develop applications with libSEDML Ruby bindings.
%endif

%if 0%{?with_r}
%package -n R-%{octpkg}
Summary: R library that fully supports SED-ML for SBML
BuildRequires: R-devel, R-core-devel, tex(latex)
Requires:      R-core
%description -n R-%{octpkg}
The %{octpkg} R package contains the libraries to 
develop applications with libSEDML R bindings.
%endif

%if 0%{?with_mono}
%package sharp
Summary: Mono library that fully supports SED-ML for SBML
BuildRequires: xerces-c-devel, libxml2-devel, expat-devel
BuildRequires: mono-core
Requires: mono-core
%description sharp
The %{octpkg} csharp package contains the libraries to 
develop applications with libSEDML C# bindings.
%endif

%if 0%{?with_doc}
%package -n libsedml-javadoc
Summary: Library that fully supports SED-ML for SBML
BuildRequires: doxygen
BuildArch: noarch
%description -n libsedml-javadoc
The %{octpkg} doc package contains the documentation
of libSEDML libraries.
%endif

%prep
%setup -n libSEDML-v.%{version} -q

%patch0 -p0

%build

%if 0%{?with_python3}
mkdir build2 && pushd build2
export LDFLAGS="$RPM_LD_FLAGS -Wl,-z,now -lpthread"
##Fix 'some warnings being treated as errors'
##https://github.com/fbergmann/libSEDML/issues/8
SEDMLOPT_FLAGS=$(echo "$RPM_OPT_FLAGS" | sed -e 's/-Werror=format-security/-Wno-error=unused-value/g')
export CFLAGS="$SEDMLOPT_FLAGS $RPM_LD_FLAGS -Wl,-z,now"
export CXXFLAGS="$SEDMLOPT_FLAGS $RPM_LD_FLAGS -Wl,-z,now"
%cmake -Wno-dev \
 -DWITH_PYTHON:BOOL=ON \
 -DWITH_SWIG:BOOL=ON \
 -DPYTHON_EXECUTABLE:FILEPATH=%{__python3} \
 -DPYTHON_INCLUDE_DIR:PATH=%{_includedir}/python%{python3_version}m \
 -DPYTHON_LIBRARY:FILEPATH=%{_libdir}/libpython%{python3_version}m.so \
%if 0%{?with_java}
 -DWITH_JAVA:BOOL=OFF \
 -DWITH_SWIG:BOOL=OFF \
%endif
%if 0%{?with_octave}
 -DWITH_OCTAVE:BOOL=OFF \
%endif
%if 0%{?with_perl}
 -DWITH_PERL:BOOL=OFF \
%endif
%if 0%{?with_ruby}
 -DWITH_RUBY:BOOL=OFF \
%endif
%if 0%{?with_r}
 -DWITH_R:BOOL=OFF \
 -DR_INCLUDE_DIRS:PATH=%{_includedir}/R \
%endif
%if 0%{?with_mono}
 -DWITH_CSHARP:BOOL=OFF \
 -DWITH_SWIG:BOOL=OFF \
%if 0%{?fedora} > 22
%ifarch x86_64 aarch64
 -DCMAKE_CXX_COMPILER:FILEPATH=%{_bindir}/clang++ \
%endif
 -DCSHARP_COMPILER:FILEPATH=%{_bindir}/mcs \
%endif
%endif
%if 0%{?with_doc}
 -DWITH_DOXYGEN:BOOL=OFF \
%endif
%if 0%{?with_check}
 -DWITH_CHECK:BOOL=ON \
 -DWITH_EXAMPLES:BOOL=ON \
%endif
 -DLIBSBML_LIBRARY:FILEPATH=%{_libdir}/libsbml.so -DLIBSBML_INCLUDE_DIR:PATH=%{_includedir} \
 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} -DLIBSEDML_SHARED_VERSION:BOOL=ON \
 -DEXTRA_LIBS:STRING="sbml;xml2;bz2;z;m;dl" -DLIBSBML_STATIC:BOOL=OFF \
 -DCMAKE_CXX_FLAGS_RELEASE:STRING="-I%{_includedir}/libxml2" \
 -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -DCMAKE_COLOR_MAKEFILE:BOOL=ON \
 -DCPACK_BINARY_TZ:BOOL=OFF -DCPACK_BINARY_TGZ:BOOL=OFF \
 -DCPACK_SOURCE_TBZ2:BOOL=OFF -DCPACK_SOURCE_TGZ:BOOL=OFF \
 -DCPACK_SOURCE_TZ:BOOL=OFF -DWITH_ZLIB:BOOL=ON -DWITH_CPP_NAMESPACE:BOOL=OFF \
 -DCMAKE_SKIP_RPATH:BOOL=YES -DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES ..

make %{?_smp_mflags}
popd
%endif

######################################################################################################
## ----> Move to build directory ##

mkdir build && pushd build
export LDFLAGS="$RPM_LD_FLAGS -Wl,-z,now -lpthread"
##Fix 'some warnings being treated as errors'
##https://github.com/fbergmann/libSEDML/issues/8
SEDMLOPT_FLAGS=$(echo "$RPM_OPT_FLAGS" | sed -e 's/-Werror=format-security/-Wno-error=unused-value/g')
export CFLAGS="$SEDMLOPT_FLAGS $RPM_LD_FLAGS -Wl,-z,now"
export CXXFLAGS="$SEDMLOPT_FLAGS $RPM_LD_FLAGS -Wl,-z,now"
%cmake -Wno-dev \
%if 0%{?with_python2}
 -DWITH_PYTHON:BOOL=ON \
 -DWITH_SWIG:BOOL=ON \
 -DPYTHON_EXECUTABLE:FILEPATH=%{__python2} \
 -DPYTHON_INCLUDE_DIR:PATH=%{_includedir}/python%{python2_version} \
 -DPYTHON_LIBRARY:FILEPATH=%{_libdir}/libpython%{python2_version}.so \
%endif
%if 0%{?with_java}
 -DWITH_JAVA:BOOL=ON \
 -DWITH_SWIG:BOOL=ON \
%endif
%if 0%{?with_octave}
 -DWITH_OCTAVE:BOOL=ON \
%endif
%if 0%{?with_perl}
 -DWITH_PERL:BOOL=ON \
%endif
%if 0%{?with_ruby}
 -DWITH_RUBY:BOOL=ON \
%endif
%if 0%{?with_r}
 -DWITH_R:BOOL=ON \
 -DR_INCLUDE_DIRS:PATH=%{_includedir}/R \
%endif
%if 0%{?with_mono}
 -DWITH_CSHARP:BOOL=ON \
 -DWITH_SWIG:BOOL=ON \
%if 0%{?fedora} > 22
%ifarch x86_64 aarch64
 -DCMAKE_CXX_COMPILER:FILEPATH=%{_bindir}/clang++ \
%endif
 -DCSHARP_COMPILER:FILEPATH=%{_bindir}/mcs \
%endif
%endif
%if 0%{?with_doc}
 -DWITH_DOXYGEN:BOOL=ON \
%endif
%if 0%{?with_check}
 -DWITH_CHECK:BOOL=ON \
 -DWITH_EXAMPLES:BOOL=ON \
%endif
 -DLIBSBML_LIBRARY:FILEPATH=%{_libdir}/libsbml.so -DLIBSBML_INCLUDE_DIR:PATH=%{_includedir} \
 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} -DLIBSEDML_SHARED_VERSION:BOOL=ON \
 -DEXTRA_LIBS:STRING="sbml;xml2;bz2;z;m;dl" -DLIBSBML_STATIC:BOOL=OFF \
 -DCMAKE_CXX_FLAGS_RELEASE:STRING="-I%{_includedir}/libxml2" \
 -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -DCMAKE_COLOR_MAKEFILE:BOOL=ON \
 -DCPACK_BINARY_TZ:BOOL=OFF -DCPACK_BINARY_TGZ:BOOL=OFF \
 -DCPACK_SOURCE_TBZ2:BOOL=OFF -DCPACK_SOURCE_TGZ:BOOL=OFF \
 -DCPACK_SOURCE_TZ:BOOL=OFF -DWITH_ZLIB:BOOL=ON -DWITH_CPP_NAMESPACE:BOOL=OFF \
 -DCMAKE_SKIP_RPATH:BOOL=YES -DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES ..

##'Parallel make' breaks Java library's building
%if 0%{?with_java}
make
%else
make %{?_smp_mflags}
%endif

####################################################################################################

%install
make -C build DESTDIR=$RPM_BUILD_ROOT install

%if 0%{?with_python3}
make -C build2 DESTDIR=$RPM_BUILD_ROOT install
%endif

mkdir -p $RPM_BUILD_ROOT%{_datadir}/libsedml

##Only for R library
%if 0%{?with_r}
mkdir -p $RPM_BUILD_ROOT%{_libdir}/R/library
%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_libdir}/R/library build/bindings/r/libSEDML_%{version}_R_*.tar.gz
test -d %{octpkg}/src && (cd %{octpkg}/src; rm -f *.o *.so)
rm -rf $RPM_BUILD_ROOT%{_libdir}/R/library/%{octpkg}/R.css

# Make symlink instead hard-link
ln -sf %{_libdir}/libSEDML.so $RPM_BUILD_ROOT%{_libdir}/R/library/libSEDML/libs/libSEDML.so
%endif
##

## Remove libtool archives
find $RPM_BUILD_ROOT -name '*.la' -delete

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

%if 0%{?with_check}
%check
cd build
%{_bindir}/ctest -V --force-new-ctest-process --stop-time 2000
%endif

%files
%doc *.md
%license LICENSE.txt
%{_libdir}/libsedml.so.*
##This directory provides just some txt documentation files
%exclude %{_datadir}/libsedml

%files devel
%{_libdir}/libsedml.so
%exclude %{_libdir}/libsedml-static.a
%{_includedir}/sedml/

%if 0%{?with_python2}
%files -n python-libsedml
%doc *.md
%license LICENSE.txt
%{python2_sitearch}/libsedml/
%{python2_sitearch}/*.pth
%endif

%if 0%{?with_python3}
%files -n python3-libsedml
%doc *.md
%license LICENSE.txt
%{python3_sitearch}/libsedml/
%{python3_sitearch}/*.pth
%endif

%if 0%{?with_java}
%files -n java-%{octpkg}
%{_javadir}/libsedmlj.jar
%{_libdir}/libsedml/
%endif

%if 0%{?with_octave}
%files -n octave-%{octpkg}
%doc *.md
%license LICENSE.txt
%{octpkglibdir}/
%endif

%if 0%{?with_perl}
%files -n perl-%{octpkg}
%doc *.md
%license LICENSE.txt
%{perl_vendorarch}/LibSEDML.*
%exclude %dir %{perl_vendorarch}/auto/
%{perl_vendorarch}/auto/libSEDML/
%endif

%if 0%{?with_ruby}
%files -n ruby-%{octpkg}
%doc *.md
%license LICENSE.txt
%{ruby_vendorarchdir}/*.so
%endif

%if 0%{?with_r}
%files -n R-%{octpkg}
%doc *.md
%license LICENSE.txt
%{_libdir}/R/library/libSEDML/
%{_libdir}/libSEDML.so
%endif

%if 0%{?with_mono}
%files sharp
%doc *.md
%license LICENSE.txt
##DLL library cannot be registered because not signed
##https://github.com/fbergmann/libSEDML/issues/10
#%%{_monogacdir}/libsedmlcsP
%{_monodir}/libsedmlcsP/
%endif

%if 0%{?with_doc}
%files -n libsedml-javadoc
%doc *.md
%license LICENSE.txt
%doc 00README*
%doc index.html src formatted
%endif

%changelog
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.1-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Sun Nov 01 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.1-4
- Built with clang++ on aarch64

* Sun Nov 01 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.1-3
- Hardened builds on <F23

* Sat Sep 19 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.1-2
- Disabled C++ namespaces (Bug2188 on copasi bug tracker)

* Fri Sep 18 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.1-1
- Update to 0.3.1
- Enabled tests

* Sun Jul 26 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-13.20150422git235bb5
- Rebuild after libsbml update

* Fri Jun 19 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-12.20150422git235bb5
- Debug undefined references
- Built with clang on F23 64bit

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

* Fri Jun 12 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-10.20150422git235bb5
- Fixed octpkg macro

* Thu Jun 11 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-9.20150422git235bb5
- Added missing linkage to libsbml
- Fixed Python variables

* Mon Jun 08 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-8.20150422git235bb5
- Python2 package is named python-libsedml
- Forced same documentation directory for all sub-packages
- Make symlink between R libraries

* Fri Jun 05 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-7.20150422git235bb5
- Description improved
- Sub-packages main name changed to libsedml for Python, Java
- Packaged Python3 bindings

* Fri Jun 05 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-6.20150422git235bb5
- Set CSHARP compiler on F23

* Fri May 29 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-5.20150422git235bb5
- Update to commit 235bb5

* Mon Feb 02 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-4.20141230gitb455cd
- Set installation directory of the java library

* Fri Jan 09 2015 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-3.20141230gitb455cd
- Package name modified

* Wed Dec 31 2014 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-2.20141230gitb455cd
- Excluded packaging of static file

* Tue Dec 30 2014 Antonio Trande <sagitterATfedoraproject.org> 0.3.0-1.20141230gitb455cd
- Update to the commit fb91ad (post-release 0.3.0)

* Sun Dec 28 2014 Antonio Trande <sagitterATfedoraproject.org> - 5.11.0-1
- First package