Name:            plotutils
Version:         2.6
Release:         22
Summary:         Tools for generating 2D plot graphics based on data sets
License:         GPLv2+ and GPLv3+
URL:             http://www.gnu.org/software/plotutils/
Source0:         ftp://ftp.gnu.org/gnu/plotutils/plotutils-%{version}.tar.gz
Patch0000:       plotutils-2.6-png15.patch
Patch0001:       plotutils-aarch64.patch
Patch0002:       plotutils-werror-format-security.patch

BuildRequires:   gcc-c++ make flex libpng-devel xorg-x11-proto-devel
BuildRequires:   libX11-devel libXaw-devel libXt-devel libXext-devel byacc

Requires(post):  /sbin/install-info
Requires(post):  /sbin/ldconfig
Requires(preun): /sbin/install-info

%description
The GNU plotutils package contains software for both programmers and technical users.

%package devel
Summary:     Header files and libraries that use plotutils
Requires:    %{name} = %{version}-%{release}

%description devel
This package contains the header files and libraries that use plotutils.

%package help
Summary:     man info for plotutils

%description help
The package contains man information for plotutils.

%prep
%autosetup %{name}-%{version} -p1

%build
%configure --disable-static --enable-libplotter --enable-libxmi --enable-ps-fonts-in-pcl

sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

%make_build

%install
rm -rf docs-plot
%make_install
mkdir docs-plot
mv ${RPM_BUILD_ROOT}%{_datadir}/{ode,pic2plot,libplot,tek2plot} docs-plot
%delete_la

%post
/sbin/install-info %{_infodir}/libxmi.info %{_infodir}/dir || :
/sbin/install-info %{_infodir}/plotutils.info %{_infodir}/dir || :
/sbin/ldconfig

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

%postun
/sbin/ldconfig

%files
%doc AUTHORS COMPAT COPYING
%doc docs-plot/*
%{_bindir}/*
%{_libdir}/*.so.*
%{_infodir}/*.info*
%exclude %{_infodir}/dir

%files devel
%doc TODO
%{_includedir}/*.h
%{_libdir}/*.so

%files help
%doc NEWS THANKS README PROBLEMS KNOWN_BUGS
%{_mandir}/man1/*

%changelog
* Mon Dec 16 2019 lijin Yang <yanglijin@huawei.com> - 2.6-22
- init package

