Blob Blame History Raw
%ifnarch s390 s390x
%global with_openmpi 1
%endif
%global with_mpich2 1

Name:          mathgl
Version:       2.3
Release:       1%{?dist}
Summary:       Cross-platform library for making high-quality scientific graphics
Summary(de):   Plattformübergreifende Bibliothek für hochwertige wissenschaftliche Graphiken
Summary(ru):   Библиотека для осуществления высококачественной визуализации данных
License:       GPLv2+
Group:         Development/Libraries
Url:           http://mathgl.sourceforge.net
Source0:       http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz

#Mathgl's enable all tries to use hdf4 and 5 at the same time
Patch0:        mathgl-2.3-no-hdf4-and-hdf5-simultaneously.patch

# Install binaries for generation examples of illustrations
Patch1:        mathgl-2.2.1-examples.patch

# There is no easy way to disable ONLY octave. Have to cut it from CmakeList.txt
Patch2:        mathgl-2.3-no_octave.patch

# Skip FLUID binary test
Patch3:        mathgl-2.3-fltk-skip-fluid.patch

# No qt4 and qt5 simultaneously. There are some issues with Qt5, leave v.4
Patch4:        mathgl-2.3-no_qt4.patch

Requires:      %{name}-common = %{version}-%{release}

# mandatory packages
BuildRequires: gsl-devel libpng-devel
BuildRequires: desktop-file-utils
BuildRequires: cmake

# optional packages
BuildRequires: freeglut-devel hdf5-devel libjpeg-devel libtiff-devel
BuildRequires: fltk-devel qt5-qtbase-devel qt5-qtwebkit-devel
BuildRequires: wxGTK-devel giflib-devel
BuildRequires: libharu-devel
BuildRequires: swig lua-devel
#Stop for a while. No new SWIG for 3.8 octave
%if 0%{?fedora} < 21
BuildRequires: octave-devel 
%endif
BuildRequires: libXmu-devel
BuildRequires: python2-devel numpy


Requires(post): info
Requires(preun): info

%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

%description -l ru
Mathgl - это кроссплатформенная библиотека для подготовки высококачественных
научных иллюстраций. Библиотека обладает возможностью работы с большими
массивами данных, быстрой отрисовки, при этом работая как в консольном, так и
оконном режимах, легко интегрируясь в другие приложения. Mathgl может быть
использована в FLTK, Qt и OpenGL приложениях.

%package devel
Summary:       Libraries and header files for %{name} library
Summary(ru):   Библиотеки и файлы заголовков для %{name}
Group:         Development/Libraries
Requires:      %{name} = %{version}-%{release}
Requires:      gsl-devel

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use serial version of %{name}.

%description devel -l ru
Пакет %{name}-devel содержит библиотеки и файлы заголовков, необходимые
для разработки приложений с использованием однопоточной версии %{name}.

%package doc
Group:         Documentation
Summary:       HTML documentation and tutorial for the %{name} applications
BuildArch:     noarch
BuildRequires: texi2html texinfo-tex

%description doc
This package contains the documentation in the HTML and PDF format of the %{name}
package.

%package -n udav
Summary:       Viewer and editor for mathgl graphs
Summary(ru):   Редактор и средство визуализации для MathGL
Group:         Applications/Engineering
Requires:      %{name} = %{version}-%{release}

%description -n udav
UDAV is cross-platform program for interactive data array visualization
using the MathGL library. UDAV works as a front-end to the mathgl
scripting engine, allowing for the generation of a wide variety of
scientific graph styles.

%description -n udav -l ru
UDAV - это кроссплатформенное приложение для интерактивной визуализации массивов
данных с применением библиотеки MathGL. UDAV, как GUI для MathGL, может быть
использован для формирования различного вида научных иллюстраций.

%package common
Summary:       Common files for %{name}
Group:         Applications/Engineering
BuildArch:     noarch
Requires:      %{name} = %{version}-%{release}

%description common
%{summary}.

%package examples
Summary:       Example illustration generators for %{name}
Group:         Applications/Engineering
Requires:      %{name} = %{version}-%{release}

%description examples
Binaries for generation examples of illustrations that could be 
prepared by %{name}.

%if 0%{?with_openmpi}
%package openmpi
Summary:       OpenMPI version of %{name} library
Group:         Applications/Engineering
BuildRequires: openmpi-devel
Requires:      openmpi
Requires:      %{name}-common = %{version}-%{release}

%description openmpi
%{summary}.

%package openmpi-devel
Summary:       Devel files for OpenMPI version of %{name} library
Group:         Applications/Engineering
Requires:      %{name}-openmpi%{_isa} = %{version}-%{release}

%description openmpi-devel
%{summary}.
%endif

%package mpich
Summary:       MPICH version of %{name} library
Group:         Applications/Engineering
BuildRequires: mpich-devel
Requires:      mpich
Requires:      %{name}-common = %{version}-%{release}
Provides:      %{name}-mpich2 = %{version}-%{release}
Obsoletes:     %{name}-mpich2 < 2.1.2-9

%description mpich
%{summary}.

%package mpich-devel
Summary:       Devel files for MPICH version of %{name} library
Group:         Applications/Engineering
Requires:      %{name}-mpich%{_isa} = %{version}-%{release}
Provides:      %{name}-mpich2-devel = %{version}-%{release}
Obsoletes:     %{name}-mpich2-devel < 2.1.2-9

%description mpich-devel
%{summary}.

%prep
%setup -q


#convert EOL encodings, maintaining timestames
for file in AUTHORS ChangeLog.txt README ; do
    sed 's/\r//' $file > $file.new && \
    touch -r $file $file.new && \
    mv $file.new $file
done

%patch0 -b .no-hdf4-and-hdf5-simultaneously
%patch1 -b .examples
%patch2 -b .no_octave
%patch3 -b .fluid
%patch4 -b .no_qt4_qt5

# Fix hardcoded paths
sed -i s,/usr/local/share/doc/mathgl/,%{_docdir}/%{name}/, udav/udav_wnd.h
sed -i s,/usr/local/share/udav/,%{_datadir}/udav/, udav/udav_wnd.cpp
sed -i s,/usr/local/share/mathgl/fonts/,%{_datadir}/%{name}/fonts/, udav/prop_dlg.cpp


%build

OMP_NUM_THREADS=1
export OMP_NUM_THREADS

%define building() \
BUILD_MPI="-Denable-mpi=on -Denable-all-docs=off" %buildcommon

%define building_serial() \
BUILD_MPI="-Denable-mpi=off -Denable-all-docs=on" %buildcommon

%define buildcommon() \
mkdir -p %{_target_platform}_$MPI_COMPILER_NAME; \
pushd %{_target_platform}_$MPI_COMPILER_NAME; \
%{cmake} \\\
    -DMGL_LIB_INSTALL_DIR=%{_libdir} \\\
    -Denable-all=on \\\
    -Denable-hdf4=off \\\
    -Denable-qt4=on \\\
    -Denable-qt5=off \\\
    -Denable-octave=off \\\
    -Denable-all-swig=on \\\
    -Denable-all-widgets=on \\\
    $BUILD_MPI \\\
    ..; \
popd; \
make %{?_smp_mflags} -C %{_target_platform}_$MPI_COMPILER_NAME

# serial
MPI_COMPILER_NAME=serial %building_serial

# MPI vars
export CC=mpicc
export CXX=mpicxx

%if 0%{?with_openmpi}
# OpenMPI
%{_openmpi_load}
MPI_COMPILER_NAME=openmpi %building
%{_openmpi_unload}
%endif

%if 0%{?with_mpich2}
# MPICH2
%{_mpich_load}
MPI_COMPILER_NAME=mpich %building
%{_mpich_unload}
%endif

%install

# MPI install libs only
%define installing() \
make install DESTDIR=%{buildroot}%{_libdir}/$MPI_COMPILER_NAME -C %{_target_platform}_$MPI_COMPILER_NAME INSTALL="install -p"; \
mkdir -p %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/lib/ \
mv %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/%{_libdir}/libmgl* %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/lib/; \
mkdir -p %{buildroot}%{_includedir}/$MPI_COMPILER/mgl2; \
mv %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/%{_includedir}/mgl2/* %{buildroot}%{_includedir}/$MPI_COMPILER/mgl2/; \
rm -f %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/lib/*.a; \
rm -r %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/usr

# Serial
make install DESTDIR=%{buildroot} -C %{_target_platform}_serial INSTALL="install -p"

%if 0%{?with_openmpi}
# OpenMPI
%{_openmpi_load}
MPI_COMPILER_NAME=openmpi %installing
%{_openmpi_unload}
%endif

%if 0%{?with_mpich2}
# MPICH
%{_mpich_load}
MPI_COMPILER_NAME=mpich %installing
%{_mpich_unload}
%endif

#Remove symlink to .so file in python dir. Let python find libs normally
unlink %{buildroot}/%{python_sitelib}/_mathgl.so

#Remove static libraries generated by cmake
rm %{buildroot}/%{_libdir}/*.a

# Remove the binary mgl.cgi. Im not convinced about it (eg mem leak in main), and that its really needed
# The same with man file for it
rm %{buildroot}/%{_datadir}/mathgl/mgl.cgi
rm %{buildroot}/%{_mandir}/man1/mgl.cgi.1*

# Remove bad octave archive
%if 0%{?fedora} < 21
#rm %{buildroot}%{_datadir}/mathgl/mathgl.tar.gz
%endif

# Prepare for documentation
if [ -d _tmp_docdir ]
then
rm -r _tmp_docdir
fi
mv %{buildroot}%{_docdir}/mathgl _tmp_docdir

# Check .desktop file
desktop-file-validate %{buildroot}%{_datadir}/applications/udav.desktop

# Maintain l18n for udav
%find_lang udav --with-qt

%post -p /sbin/ldconfig

%post common
/sbin/install-info %{_infodir}/%{name}_en.info %{_infodir}/dir || :

%preun common
if [ $1 = 0 ] ; then
    /sbin/install-info --delete %{_infodir}/%{name}_en.info %{_infodir}/dir || :
fi

%postun -p /sbin/ldconfig

%files
%doc AUTHORS ChangeLog.txt README COPYING  README_V2
%{_libdir}/*.so.*
%{_libdir}/mgl-lua.so
%{_bindir}/mgl*
%exclude %{_bindir}/mgl_*example
%{_mandir}/man1/mglconv.1.gz
%{_mandir}/man1/mglview.1.gz

%files devel
%{_libdir}/*.so
%exclude %{_libdir}/mgl-lua.so
%{_includedir}/mgl2/

%files -n udav -f udav.lang
%{_bindir}/udav
%{_mandir}/man1/udav.1.gz
%{_datadir}/applications/udav.desktop
%dir %{_datadir}/udav/
%{_datadir}/pixmaps/*.png

%files doc
%doc AUTHORS COPYING
%doc _tmp_docdir/*

%files common
%{python_sitelib}/*
%{_datadir}/%{name}/
%{_infodir}/%{name}*.gz
%{_mandir}/man5/mgl.5.gz

%files examples
%{_bindir}/mgl_*example

%if 0%{?with_openmpi}
%files openmpi
%doc COPYING
%{_libdir}/openmpi/lib/*.so.*

%files openmpi-devel
%{_libdir}/openmpi/lib/*.so
%{_includedir}/openmpi-%{_arch}/mgl2/
%endif

%files mpich
%doc COPYING
%{_libdir}/mpich/lib/*.so.*

%files mpich-devel
%{_libdir}/mpich/lib/*.so
%{_includedir}/mpich-%{_arch}/mgl2/

%changelog
* Tue Oct 07 2014 Dmitrij S. Kryzhevich <krege@land.ru> - 2.3-1
- Update for new 2.3 version.

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Feb 22 2014 Deji Akingunola <dakingun@gmail.com> - 2.2.1-4
- Rebuild for mpich-3.1

* Mon Feb 17 2014 Dan Horák <dan[at]danny.cz> - 2.2.1-3
- Conditionalize openmpi support, fixes build on s390(x)

* Fri Feb  7 2014 Dmitrij S. Kryzhevich <krege@land.ru> - 2.2.1-2
- Workaround for race condition during package building.

* Tue Feb  4 2014 Dmitrij S. Kryzhevich <krege@land.ru> - 2.2.1-1
- Update for new 2.2.1.

* Thu Jan 16 2014 Dmitrij S. Kryzhevich <krege@land.ru> - 2.2-2
- Drop bogus ocatave support. For a time.

* Wed Dec 25 2013 Dmitrij S. Kryzhevich <krege@land.ru> - 2.2-1
- Update to 2.2.
- Fix bogus dates.
- Fix issue with docdirs.

* Mon Aug 12 2013 Orion Poplawski <orion@cora.nwra.com> - 2.1.2-11
- Fix hdf BRs

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.2-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Jul 22 2013 Deji Akingunola <dakingun@gmail.com> - 2.1.2-9
- Rename mpich2 sub-packages to mpich and rebuild for mpich-3.0

* Thu May 16 2013 Orion Poplawski <orion@cora.nwra.com> - 2.1.2-8
- Rebuild for hdf5 1.8.11

* Tue Apr 23 2013 Dmitrij S. Kryzhevich <krege@land.ru> - 2.1.2-7
- Modify patch to fix pics generation.

* Mon Apr 22 2013 Dmitrij S. Kryzhevich <krege@land.ru> - 2.1.2-6
- Add patch to fix pics generation.

* Thu Apr 18 2013 Dmitrij S. Kryzhevich <krege@land.ru> - 2.1.2-5
- Install binaries used for generation of examples of illustrations.

* Wed Apr 17 2013 Dmitrij S. Kryzhevich <krege@land.ru> - 2.1.2-4
- Disable some .png generation for -doc.

* Mon Apr 15 2013 Dmitrij S. Kryzhevich <krege@land.ru> - 2.1.2-3
- MPI suport for MathGL library: add -common subpackage.
- MPI enabled for MathGL library: add OpenMPI and MPICH2 support.
- Reformat spec for better reading (spaces vs tabs, aligning).

* Mon Apr 15 2013 Dmitrij S. Kryzhevich <krege@land.ru> - 2.1.2-2
- Fix spec for better cmake use.
- Make vars in spec to be in one style.
- Add some Russian translation.
- .info is installed. Remove copying.
- Make udav sub-package to be with name "udav".
- Maintain traslation for udav.

* Sun Apr 14 2013 <mycae(a!)gmx.com> 2.1.2-1
- Update to upstream 2.1.2
- New upstream has entirely different build system

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Jan 18 2013 Adam Tkac <atkac redhat com> - 1.11.3-2
- rebuild due to "jpeg8-ABI" feature drop

* Fri Dec 07 2012 <mycae(a!t)yahoo.com> - 1.11.3-1
- Update to 1.11.3

* Mon Dec 03 2012 Orion Poplawski <orion@cora.nwra.com> - 1.11.2-9
- Rebuild for hdf5 1.8.10

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Fri Dec 09 2011 <mycae(a!t)yahoo.com> - 1.11.2-6
- Fix build fail due to libpng no longer including zlib
- Remove no longer needed libtool hack

* Tue Dec 06 2011 Adam Jackson <ajax@redhat.com> - 1.11.2-5
- Rebuild for new libpng

* Thu Jun 23 2011 <mycae(a!t)yahoo.com> - 1.11.2-4
- Recall why we needed hdf-devel. Its to keep configure happy.

* Thu Jun 23 2011 <mycae(a!t)yahoo.com> - 1.11.2-3
- Bump for build

* Thu Jun 23 2011 <mycae(a!t)yahoo.com> - 1.11.2-2
- Fix bug 678856, add hdf-static as buildrequire

* Wed Jun 01 2011 <mycae(a!t)yahoo.com> - 1.11.2-1
- Update to upstream 1.11.2

* Tue May 31 2011 Ralf Corsépius <corsepiu@fedoraproject.org> - 1.11.0.1-6
- Reflect fltk having changed its include directory (Fix FTBS).
- Fix German %%summary.

* Tue May 17 2011 Orion Poplawski <orion@cora.nwra.com> - 1.11.0.1-5
- Rebuild for hdf5 1.8.7 

* Sun Feb 27 2011 <mycae(a!t)yahoo.com> - 1.11.0.1-4
- Remove octave for Bug 679948, and dynamic patch non-functional due
  to swig covariant return type problems with octave_map

* Sat Feb 12 2011 <mycae(a!t)yahoo.com> - 1.11.0.1-3
- Request rebuild -- octave-config needs to emit correct api. 

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat Nov 27 2010 <mycae(a!t)yahoo.com> - 1.11.0.1-1
- Update to 1.11.0.1

* Sun Aug 08 2010 <mycae(a!t)yahoo.com> - 1.10.2.1-3
- Add gsl-devel to requires

* Wed Jul 14 2010 Dan Horák <dan@danny.cz> - 1.10.2.1-2.1
- rebuilt against wxGTK-2.8.11-2

* Wed Apr 14 2010 <mycae(a!t)yahoo.com> - 1.10.2.1-1.1
- tag bump

* Wed Apr 14 2010 <mycae(a!t)yahoo.com> - 1.10.2.1-1
- Update to 1.10.2.1
- Fix linker error due to DSO change (Bug #564982)

* Sat Jan 02 2010 <mycae(a!t)yahoo.com> - 1.10-2
- Fix octave interface to load on startup
- Fix texinfo insatll

* Sat Jan 02 2010 <mycae(a!t)yahoo.com> - 1.10-1
- Update to 1.10

* Wed Nov 25 2009 Kevin Kofler <Kevin@tigcc.ticalc.org> - 1.9-8
- Rebuild for Qt 4.6.0 RC1 in F13 (was built against Beta 1 with unstable ABI)

* Sun Oct 25 2009 Milos Jakubicek <xjakub@fi.muni.cz> - 1.9-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Mon Sep 14 2009 <mycae(a!t)yahoo.com> 1.9-6
- Add COPYING to doc

* Sat Sep 12 2009 <mycae(a!t)yahoo.com> 1.9-5
- Removed the word "static" from devel description, as doesn't have static
- Fonts now owned at datadir/name level
- Added COPYRIGHT NEWS and TODO

* Sat Aug 15 2009 <mycae(a!t)yahoo.com> 1.9-4
- Fix octave installation method
- Remove wx lib, which doesn't have meaningful code.

* Sun Aug 02 2009  <mycae(a!t)yahoo.com> 1.9-3
- Fix texinfo install (mv to main & add pre/post)
- Remove chrpath, as we now autoreconf
- Add octave pkg rebuild commands

* Tue Jul 21 2009  <mycae(a!t)yahoo.com> 1.9-2 
- Fix rpath for build on x86_64. 
- remove unrecognized configure options: --enable-tiff, --disable-ltdl-install
- Switch to --enable-all --enable-octave
- Add hdf5 patch
- Add doc subpackage

* Thu Jul 09 2009 <mycae(a!t)yahoo.com> 1.9-1
- Update to 1.9
- Drop explicit Requires
- Perserve timestamps on EOL conversion
- Added patch to disable unused gsl cblas link

* Sat May 02 2009 <mycae(a!t)yahoo.com> 1.8.1-1
- Update to 1.8.1

* Wed Jan 28 2009 <mycae(a!t)yahoo.com> 1.8-3
- Ensure timestamps are preserved during make install
- Modify defattr
- Remove UDAV from package summary

* Mon Dec 29 2008 <mycae(a!t)yahoo.com> 1.8-2
- Remove redundant and erroneous licence field in devel section
- Fix files from mgl/*h to mgl/
- Removed Requires, per bugzilla recommendation.
- Disabled static library generation
- Removed libltdl from build 
- Added libtool-ltdl as BuildRequires

* Mon Dec 29 2008 <mycae(a!t)yahoo.com> 1.8-1
- Updated to version 1.8
- Added QT env. vars for fedora
- Cleaned up description
- Change licence field from GPL to GPLv2

* Wed Jun 4 2008 Nik <niktr@mail.ru> 
- disabled hdf5 support according to developer request

* Tue Jun 3 2008 Nik <niktr@mail.ru> 
- updated to version 1.7.1

* Mon Jun 2 2008 Nik <niktr@mail.ru> 
- updated to version 1.7

* Sat Apr 5 2008 Nik <niktr@mail.ru> 
- updated to version 1.6.2

* Thu Mar 13 2008 Nik <niktr@mail.ru>
- updated to version 1.6
- added fltk(-devel) to requres list

* Tue Mar 11 2008 Nik <niktr@mail.ru>
- tiff bug fixed
- enable-all option added

* Sat Mar 1 2008 Nik <niktr@mail.ru>
- spec cleanup
- --enable(jpeg, tiff, hdf5) features added
- enable-tiff leads to make error, submitted to author. Feature disabled.

* Fri Feb 29 2008 Nik <niktr@mail.ru>
- initial build of version 1.5