%define pkg_name    plotutils
%define pkg_version 2.6
%define pkg_release 1%{?_dist_release}

Summary:     Plotting utilities and library for 2D-graphics
Summary(ja): 2Dグラフィックスのプロッティングと作業のためのパッケージ
Name:        %{pkg_name}
Version:     %{pkg_version}
Release:     %{pkg_release}

License: GPLv3
Group:   Applications/Graphics
URL:     http://www.gnu.org/software/plotutils/
Source0: http://ftp.jaist.ac.jp/pub/GNU/%{name}/%{name}-%{version}.tar.gz

# patches from Debian package
Patch1: 01_AC_PROG_CXX.diff
Patch2: 10_repair_postscript
Patch3: 20_svg_attribute_syntax
Patch4: 21_plot2svg_test.diff
Patch5: 25_libpng15
Patch6: 30_hershey_glyphs
Patch7: 35_spline.test.error.diff

Buildroot: %{_tmppath}/%{name}-%{version}-root

BuildRequires: libXaw-devel
BuildRequires: libXt-devel
BuildRequires: libpng-devel
BuildRequires: libsvg-devel

Requires: libpng
Requires: libsvg


Vendor: Project Vine
Distribution: Vine Linux


%description
The GNU plotutils package contains software for both programmers and
technical users. Its centerpiece is libplot, a powerful C/C++ function
library for exporting 2-D vector graphics in many file formats, both
vector and bitmap. On the X Window System, it can also do 2-D vector
graphics animations.

libplot is device-independent, in the sense that its API
(application programming interface) does not depend on the type of
graphics file to be exported. A Postscript-like API is used both for
file export and for graphics animations. A libplot programmer needs to
learn only one API: not the details of many graphics file formats.

The package also contains command-line programs for plotting scientific
data, such as GNU graph for XY plotting. Many of them use libplot to
export graphics. So, they can export graphics in any of libplot's
supported formats, such as

- SVG (Scalable Vector Graphics format), the XML-based format for Web
  graphics, which is standardized by the W3 Consortium.
- PNG, the open format for bitmap graphics. (Whenever a bitmap output
  format is being generated, libplot converts Postscript-style paths to
  bitmaps.)
- The format used by the free xfig drawing editor. (Edit a 2-D drawing
  with a mouse, after generating it programmatically!)
- Postscript itself.
#'

%description -l ja
GNU Plotutilsは2Dグラフィックスのプロッティングと作業のためのパッケージです。
さまざまなファイル・フォーマットの2Dベクタ・グラフィックスにエクスポートする
ためのCあるいはC++のライブラリlibplotを含みます。2Dベクタ・グラフィックスの
アニメーションもサポートします。科学データのプロッティングのためのコマンド
ライン・プログラムも含みます。

%package devel
Summary: Header files for plotutils
Group: Development/Libraries
Requires: plotutils = %{version}-%{release}

%description devel
Header files for plotutils.


%prep
%{__rm} -rf ${RPM_BUILD_ROOT}
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

%build
%{configure} \
 --disable-static \
 --enable-libplotter \
 --enable-libxmi

%{__make} %{?_smp_mflags}

%check
%{__make} check

%install
%{make_install}
%{__rm} ${RPM_BUILD_ROOT}%{_libdir}/*.la
%{__rm} ${RPM_BUILD_ROOT}%{_infodir}/dir

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post
/sbin/install-info %{_infodir}/plotutils.info.gz \
                   %{_infodir}/dir 2>/dev/null
%{_syssbindir}/ldconfig

%preun
if [ $1 = 0 ]; then
    /sbin/install-info --delete %{_infodir}/plotutils.info.gz \
                       %{_infodir}/dir 2>/dev/null
fi

%postun -p %{_syssbindir}/ldconfig


%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog KNOWN_BUGS NEWS ONEWS
%doc PROBLEMS README THANKS TODO
%{_bindir}/
%{_libdir}/lib*.so.*
%{_datadir}/libplot
%{_datadir}/ode
%{_datadir}/pic2plot
%{_datadir}/tek2plot
%{_infodir}/
%{_mandir}/man1/

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


%changelog
* Sun Oct 15 2017 Toshiaki Ara <ara_t@384.jp> 2.6-1
- new package

