File mathgl.spec of Package mathgl

#
# spec file for package mathgl
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name:           mathgl
Version:        2.0.2
Release:        0
Summary:        Cross-platform library for making high-quality scientific graphics
License:        GPL-3.0
Group:          Productivity/Scientific/Other
Url:            http://mathgl.sourceforge.net
Source:         http://downloads.sourceforge.net/mathgl/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM mathgl-fltk.patch badshah400@gmail.com -- Correct typo in fltk's include statements
Patch0:         mathgl-fltk.patch
# PATCH-FIX-UPSTREAM mathgl-libpath.patch badshah400@gmail.com -- Allow setting installed libraries location using a cmake variable
Patch1:         mathgl-libpath.patch
# PATCH-FIX-UPSTREAM mathgl-fix-python-module-path.patch bashah400@gmail.com -- Make python modules install in subdirectories of $RPM_BUILD_ROOT during make install
Patch2:         mathgl-fix-python-module-path.patch
# PATCH-FIX-UPSTERAM mathgl-cmake-enable-doc-option-fix.patch sf#3529593 badshah400@gmail.com -- Fix the cmake option for enable-doc
Patch3:         mathgl-cmake-enable-doc-option-fix.patch
BuildRequires:  cmake
# mathgl's fltk bindings do not build on openSUSE 12.1 and lower
%if 0%{?suse_version} > 1210
BuildRequires:  fltk-devel
%endif
BuildRequires:  freeglut-devel
BuildRequires:  gcc-c++
BuildRequires:  giflib-devel
BuildRequires:  gsl-devel
BuildRequires:  hdf5-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
#BuildRequires:  octave-devel
BuildRequires:  python-devel
BuildRequires:  python-numpy-devel
BuildRequires:  swig
BuildRequires:  texinfo
BuildRequires:  texlive-latex
%if %suse_version >= 1140
BuildRequires:  wxWidgets-devel
%define _use_internal_dependency_generator 0
%define __find_requires %wx_requires
%else
BuildRequires:  wxGTK-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Recommends:     %{name}-doc

%description
Mathgl is a cross-platform library for making high-quality scientific
graphics. It provides fast data plotting and handling of large data
arrays, as well as  window and console modes and for easy embedding
into other programs. Mathgl integrates into fltk, qt and
opengl applications.

%package devel

Summary:        Libraries and header files for %{name} library
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       gsl-devel

%description devel
Mathgl is a cross-platform library for making high-quality scientific
graphics. It provides fast data plotting and handling of large data
arrays, as well as  window and console modes and for easy embedding
into other programs. Mathgl integrates into fltk, qt and
opengl applications.

This package contains libraries and header files for developing
applications that use mathgl.

%package doc

Summary:        Documentation for %{name}
Group:          Documentation/Other
Requires:       %{name} = %{version}

%description doc
Mathgl is a cross-platform library for making high-quality scientific
graphics. It provides fast data plotting and handling of large data
arrays, as well as  window and console modes and for easy embedding
into other programs. Mathgl integrates into fltk, qt and
opengl applications.

This package provides the documentation for mathgl.

%package -n python-mathgl

Summary:        Libraries and header files for %{name} library
Group:          Productivity/Scientific/Other
Requires:       %{name} = %{version}
Requires:       python-base

%description -n python-mathgl
Mathgl is a cross-platform library for making high-quality scientific
graphics. It provides fast data plotting and handling of large data
arrays, as well as  window and console modes and for easy embedding
into other programs. Mathgl integrates into fltk, qt and
opengl applications.

This package provides the python bindings for mathgl.

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

#Correct location of numpy/arrayobject.h header file
numpy_h=%{python_sitearch}/numpy/core/include/numpy/arrayobject.h
sed -i "s|<numpy/arrayobject.h>|\"${numpy_h}\"|" lang/numpy.i.in

#convert EOL encodings, maintaining timestames
sed -i 's/\r$//' AUTHORS README

%build
cmake \\\
      -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix}   \
      -DLIB_INSTALL_DIR:PATH=%{_lib}           \
      -Denable-pthread=on                      \
      -Denable-gsl=on                          \
      -Denable-jpeg=on                         \
      -Denable-pdf=off                         \
      -Denable-gif=on                          \
      -Denable-hdf5_18=on                      \
      -Denable-opengl=on                       \
      -Denable-glut=on                         \
      -Denable-wx=on                           \
      -Denable-qt=on                           \
      -Denable-python=on                       \
      -Denable-octave=off                      \
%if 0%{?sles_version}
      -Denable-doc=off                         \
%else
      -Denable-doc=on                          \
%endif
%if 0%{?suse_version} > 1210
      -Denable-fltk=on                         \
%else      
      -Denable-fltk=off                        \
%endif
      .

cmake \\\
      -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix}   \
      -DLIB_INSTALL_DIR:PATH=%{_lib}           \
      -Denable-pthread=on                      \
      -Denable-gsl=on                          \
      -Denable-jpeg=on                         \
      -Denable-pdf=off                         \
      -Denable-gif=on                          \
      -Denable-hdf5_18=on                      \
      -Denable-opengl=on                       \
      -Denable-glut=on                         \
      -Denable-wx=on                           \
      -Denable-qt=on                           \
      -Denable-python=on                       \
      -Denable-octave=off                      \
%if 0%{?sles_version}
      -Denable-doc=off                         \
%else
      -Denable-doc=on                          \
%endif
%if 0%{?suse_version} > 1210
      -Denable-fltk=on                         \
%else      
      -Denable-fltk=off                        \
%endif
      .

# Parallel make fails
make

%install
%if 0%{suse_version} < 1120
%makeinstall DESTDIR=%{buildroot}
%else
%make_install DESTDIR=%{buildroot}
%endif

#Remove static library files
rm %{buildroot}/%{_libdir}/*.a

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog.txt README COPYING
%{_libdir}/*.so.*
%{_bindir}/mgl*
%{_bindir}/udav
%{_datadir}/%{name}/
%if 0%{?sles_version} == 0
%{_mandir}/man1/*.gz
%{_mandir}/man5/*.gz
%endif

%if 0%{?sles_version} == 0
%files doc
%defattr(-,root,root)
%dir %{_datadir}/doc/mathgl
%{_datadir}/doc/mathgl/*
%endif

%files devel
%defattr(-,root,root)
%{_includedir}/mgl2/
%{_libdir}/*.so

%files -n python-mathgl
%defattr(-,root,root)
%{python_sitearch}/*

%changelog
openSUSE Build Service is sponsored by