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 http://bugs.opensuse.org/
#


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
Url:            http://www.gle-graphics.org/
Source:         http://prdownloads.sourceforge.net/glx/gle-graphics-%{version}f-src.tar.gz
Source1:        gle.vim
#Source2:    GLE-4.0.13-manual.pdf
Source3:        GLEusersguide.pdf
Source4:        makeani.pl
Source5:        bbox_gle.sh
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 zaitor@opensuse.org -- 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
%endif

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

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

%prep
%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/join.gle \
        gle-refman/primitives/fig/gc_arrstyle.gle \
        gle-refman/appendix/fig/color_sample.gle \
        gle-refman/graph/fig/gc_loglabels.gle \
        gle-refman/prog/fig/axisformat.gle \
        src/samples/sample_compare.eps \
        src/samples/qgle_keyboard.gle 

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

%build
%{configure} \
  --with-extrafonts 
#make %{?_smp_mflags}
make 
make doc

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

%install
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
%endif

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

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

%files
%defattr(-,root,root,0755)
%doc README.txt LICENSE.txt
%dir %{_datadir}/%{name}/
%dir %{_datadir}/%{name}/%{version}
%dir %{_datadir}/%{name}/%{version}/font
%dir %{_datadir}/%{name}/%{version}/gleinc
%{_bindir}/gle
%{_bindir}/glebtool
%{_bindir}/manip
%{_bindir}/makeani.pl
%{_bindir}/bbox_gle.sh
%{_datadir}/%{name}/%{version}/font/*
%{_datadir}/%{name}/%{version}/gleinc/*
%{_datadir}/%{name}/%{version}/glerc
%{_datadir}/vim/
%{_datadir}/%{name}/%{version}/init.tex
%{_datadir}/%{name}/%{version}/inittex.ini
%{_datadir}/%{name}/%{version}/manip.hlp
%{_mandir}/man1/gle.1.gz
%{_libdir}/libgle-graphics-%{version}.so

%files -n qgle
%defattr(-,root,root,0755)
%{_bindir}/qgle
%{_datadir}/applications/*
%{_datadir}/pixmaps/qgle.png
%{_datadir}/mime/application

%files doc
%defattr(-,root,root,0755)
%doc GLEusersguide.pdf gle-refman/gle-manual.pdf
%doc src/samples/

%changelog