File gle-graphics.spec of Package gle-graphics

# spec file for package gle-graphics
# 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

Name:           gle-graphics
Version:        4.2.4b
Release:        0
Summary:        GLE is a graphics scripting language
License:        BSD-3-Clause
Group:          Productivity/Graphics/Visualization/Graph
Source1:        gle.vim
#Source2:    GLE-4.0.13-manual.pdf
Source3:        GLEusersguide.pdf
Source6:        %{name}.xml
Source7:        qgle.desktop
Source1000:     gle-graphics-rpmlintrc
# PATCH-UPSTREAM: needs for build with gcc4.4 - was sent to upstream
Patch0:         gle-graphics-gcc44.patch
# PATCH-FIX-UPSTREAM gle-graphics-gcc47.patch -- Fix build for gcc4.7
Patch1:         gle-graphics-gcc47.patch
Patch2:         overflow.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  c++_compiler
BuildRequires:  cairo-devel
BuildRequires:  dos2unix
BuildRequires:  ghostscript-library
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libqt4-devel
BuildRequires:  libtiff-devel
BuildRequires:  ncurses-devel
BuildRequires:  perl
BuildRequires:  texlive-latex
BuildRequires:  unzip
BuildRequires:  xorg-x11-libs

%if %defined suse_version
BuildRequires:  update-desktop-files

Requires:       ghostscript
Requires:       lib%{name} = %{version}
Requires:       perl

# The old libgle-graphics package
Provides:       libgle-graphics = %{version}
Obsoletes:      libgle-graphics < %{version}
Provides:       libgle-graphics-4_1_1 = %{version}
Obsoletes:      libgle-graphics-4_1_1 < %{version}
Provides:       libgle-graphics-4_2_0 = %{version}
Obsoletes:      libgle-graphics-4_2_0 < %{version}

%if %defined suse_version
Suggests:       LaTeX

GLE (Graphics Layout Engine) is a graphics scripting language designed for
creating publication quality graphs, plots, diagrams, figures and slides. GLE
supports various graph types (function plots, histograms, bar graphs, scatter
plots, contour lines, color maps, surface plots, ...) through a simple but
flexible set of graphing commands. More complex output can be created by
relying on GLE's scripting language, which is full featured with subroutines,
variables, and logic control. GLE relies on LaTeX for text output and supports
mathematical formulea in graphs and figures. GLE's output formats include EPS,
PS, PDF, JPEG, and PNG. GLE is licenced under the BSD license.

A suggested dependency is a LaTeX package.

%package -n qgle

Summary:        User interface for %{name}
License:        GPL-2.0
Group:          Productivity/Graphics/Visualization/Graph
Requires:       %{name} = %{version}

%description -n qgle
QGLE, the GLE user interface, is licenced under the GPL license.

%package doc

Summary:        Documentation for %{name}
License:        BSD-3-Clause
Group:          Documentation/Other

%description doc
User guide and reference manual for GLE

%setup -q

%patch0 -b .gcc44
%patch1 -b .gcc47
%patch2 -b .overflow

cp %{SOURCE3} .

# wrong end of line encoding
dos2unix \
        gle-refman/utilities/fig/volcano.z \
        gle-refman/advanced/fig/ \
        gle-refman/primitives/fig/ \
        gle-refman/appendix/fig/ \
        gle-refman/graph/fig/ \
        gle-refman/prog/fig/ \
        src/samples/sample_compare.eps \

for mk in $(find -name 'Makefile*.in') ; do
    if ! grep -q '^CXXFLAGS=@CXXFLAGS@' $mk ; then
	sed -ri 's/^(CXX=@CXX@)/\1 %optflags/' $mk
(cat >> src/gui/<<-'EOF'
	unix {
	    QMAKE_CXXFLAGS += %optflags
	    QMAKE_CFLAGS += %optflags

%{configure} \
#make %{?_smp_mflags}
make doc

cd src/samples/
make -f Makefile.gcc
find . -type 'd' -iname '.gle' | xargs rm -rf
rm Makefile.{os2,vc}
cd ..

make DESTDIR=%{buildroot} install

rm -f %{buildroot}/%{_libdir}/pkgconfig/%{name}.pc
# will be handled via %doc in filelist
rm -rf %{buildroot}/%{_datadir}/doc/%{name}/

# vim syntax file
install -d -m755 %{buildroot}/%{_datadir}/vim/site/syntax/
install -m644 %{SOURCE1} %{buildroot}/%{_datadir}/vim/site/syntax/

# tools
install -d -m755 %{buildroot}/%{_bindir}
install -m755 %{SOURCE4} %{SOURCE5} %{buildroot}/%{_bindir}

# mime type
install -d -m 755 %{buildroot}%{_datadir}/mime/application
install -m 644 %{SOURCE6} %{buildroot}%{_datadir}/mime/application/%{name}.xml

# icon
install -d -m755 %{buildroot}/%{_datadir}/pixmaps/
install -m644 src/gui/images/gle.png %{buildroot}/%{_datadir}/pixmaps/qgle.png

# menu
%if %defined suse_version
%suse_update_desktop_file -i qgle

if [ -f /usr/bin/update-mime-database ]; then
  /usr/bin/update-mime-database /usr/share/mime > /dev/null

if [ -f /usr/bin/update-mime-database ]; then
  /usr/bin/update-mime-database /usr/share/mime > /dev/null

%doc README.txt LICENSE.txt
%dir %{_datadir}/%{name}/
%dir %{_datadir}/%{name}/%{version}
%dir %{_datadir}/%{name}/%{version}/font
%dir %{_datadir}/%{name}/%{version}/gleinc

%files -n qgle

%files doc
%doc GLEusersguide.pdf gle-refman/gle-manual.pdf
%doc src/samples/