File netpbm.spec of Package netpbm.32454
#
# spec file for package netpbm
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define debug_build 0
%define asan_build 0
%define libmaj 11
%define libmin 66
%define libver %{libmaj}.%{libmin}
Name: netpbm
Version: 10.66.3
Release: 0
Summary: A Powerful Graphics Conversion Package
License: BSD-3-Clause AND GPL-2.0-or-later AND IJG AND MIT AND SUSE-Public-Domain
Group: Productivity/Graphics/Convertors
URL: http://netpbm.sourceforge.net/
Source: netpbm-%{version}-nohpcdtoppm-noppmtompeg.tar.bz2
Source1: netpbm-%{version}-documentation.tar.bz2
Source2: baselibs.conf
Source3: prepare-src-tarball
# SUSE specific
Patch0: %{name}-make.patch
# SUSE specific: no build date
Patch1: %{name}-no-build-date.patch
# upstreamed in development version
Patch2: %{name}-missing-file-close.patch
Patch3: %{name}-tmpfile.patch
Patch4: %{name}-security-code.patch
Patch5: %{name}-security-scripts.patch
Patch6: netpbm-CVE-2017-2586.patch
Patch7: netpbm-CVE-2017-2581.patch
Patch8: netpbm-CVE-2017-2587.patch
Patch9: netpbm-CVE-2018-8975.patch
# neccessary for running with ASAN
Patch10: netpbm-asan.patch
# CVE-2017-2579 [bsc#1024288], CVE-2017-2580 [bsc#1024291]
Patch11: netpbm-CVE-2017-2579,2580.patch
# CVE-2017-5849 [bsc#1022790], CVE-2017-5849 [bsc#1022791]
Patch12: netpbm-use-byrow-when-needed.patch
BuildRequires: flex
BuildRequires: libjasper-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: libxml2-devel
BuildRequires: python
%if 0%{?suse_version} >= 1140
BuildRequires: pkgconfig(x11)
%else
BuildRequires: xorg-x11-devel
%endif
Provides: pbmplus
# bug437293
%ifarch ppc64
Obsoletes: netpbm-64bit
%endif
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%package vulnerable
Summary: Utilities with (Potential) Security Issues
Group: Productivity/Graphics/Convertors
Requires: %{name} = %{version}
%description vulnerable
Provides utilities that have been shipped with main package along
others, but was considered vulnerable.
%package -n libnetpbm%{libmaj}
Summary: Libraries for the NetPBM (NetPortableBitmap) Graphic Formats
# bug437293
Group: System/Libraries
%ifarch ppc64
Obsoletes: libnetpbm-64bit
%endif
#
Provides: libnetpbm = %{version}
Obsoletes: libnetpbm < %{version}
%package -n libnetpbm-devel
Summary: Libraries for the NetPBM Graphic Formats - files mandatory for development
# bug437293
Group: Development/Libraries/C and C++
%ifarch ppc64
Obsoletes: libnetpbm-devel-64bit
%endif
#
Requires: libnetpbm%{libmaj} = %{version}
Provides: libnetpbm:/usr/include/pbm.h
%description
The latest version of the Portable Bitmap Plus Utilities. This large
package, which is by now available for all hardware platforms, provides
tools for graphics conversion. Using these tools, images can be
converted from virtually any format into any other format. A few of the
supported formats include: GIF, PC-Paintbrush, IFF ILBM, Gould Scanner
file, MTV ray tracer, Atari Degas .pi1 and .pi3, Macintosh PICT, HP
Paintjet file, QRT raytracer, AUTOCAD slide, Atari Spectrum (compressed
and uncompressed), Andrew Toolkit raster object, and many more. On top
of that, man pages are included for all tools.
%description -n libnetpbm%{libmaj}
These are the libs for the netpbm graphic formats. The tools can be
found in the netpbm package. The sources are contained in the netpbm
source package.
%description -n libnetpbm-devel
These are the libs for the netpbm graphic formats. The tools can be
found in the netpbm package. The sources are contained in the netpbm
source package.
%prep
%setup
%setup -D -q -a 1
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch11 -p1
%patch12 -p1
mkdir pnmtopalm # for %%doc pnmtopalm
cp -p converter/other/pnmtopalm/{LICENSE,README} pnmtopalm
%build
# netpbm has _interactive_ configure perl script
cp config.mk.in config.mk # recomended by upstream, see doc/INSTALL
sed -i "s:STATICLIB_TOO = y:STATICLIB_TOO = n:" config.mk
# following two added 10.66.0, reported upstream
# recipe for target 'converter/install.manweb' failed
echo 'install.manweb:' >> converter/ppm/hpcdtoppm/Makefile
# dtto for ppmtompeg
echo 'install.manweb:' >> converter/ppm/ppmtompeg/Makefile
export CFLAGS="$RPM_OPT_FLAGS -flax-vector-conversions"
%if %{debug_build}
export CFLAGS="$CFLAGS -O0"
%endif
%if %{asan_build}
export CFLAGS="$CFLAGS -fsanitize=address"
export LADD='-lasan'
patch -p1 < %{PATCH10}
%endif
make CFLAGS="$CFLAGS"
rm doc/INSTALL
#
# convert html to man pages
cd netpbm.sourceforge.net/doc
../../buildtools/makeman *.html
for i in 1 3 5 ; do
mkdir -p ../../man/man${i}
mv *.${i} ../../man/man${i}
done
%install
# netpbm has _interactive_ install perl script, see doc/INSTALL
make pkgdir=`pwd`/package package STRIPFLAG=
rm package/bin/doc.url
#
mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,include,%_lib,share/man,share/%{name}}
cp -pd package/bin/* $RPM_BUILD_ROOT%{_bindir}
cp -pd package/lib/*.so* $RPM_BUILD_ROOT%{_libdir}
ln -s libnetpbm.so.%{libver} $RPM_BUILD_ROOT%{_libdir}/libnetpbm.so
ln -s libnetpbm.so $RPM_BUILD_ROOT%{_libdir}/libpbm.so
ln -s libnetpbm.so $RPM_BUILD_ROOT%{_libdir}/libpgm.so
ln -s libnetpbm.so $RPM_BUILD_ROOT%{_libdir}/libpnm.so
ln -s libnetpbm.so $RPM_BUILD_ROOT%{_libdir}/libppm.so
cp -prd package/include/netpbm $RPM_BUILD_ROOT%{_includedir}
cp -prd man/* $RPM_BUILD_ROOT%{_mandir}
install -m 644 converter/other/pnmtopalm/*.map \
$RPM_BUILD_ROOT%{_datadir}/%{name}
rm %{buildroot}%{_bindir}/g3topbm # conflict with g3utils
%post -n libnetpbm%{libmaj} -p /sbin/ldconfig
%postun -n libnetpbm%{libmaj} -p /sbin/ldconfig
%check
# do not run unneccesary tests
sed -i '/all-in-place/d' test/Test-Order
# do not build require ghostscript just to test vulnerable utility
sed -i '/^ps.*\.test/d' test/Test-Order
# following tests fail, however they fail also without
# any our patch; ignore them
for i in ppmcie pamflip symmetry pamflip-roundtrip; do
sed -i "/$i/d" test/Test-Order
done
mkdir -p package-test-{tmp,results}
make pkgdir=`pwd`/package tmpdir=`pwd`/package-test-tmp RESULTDIR=`pwd`/package-test-results check
%files
%defattr(-,root,root)
%doc README doc/* netpbm.sourceforge.net/doc
%doc pnmtopalm/
%doc %{_mandir}/man1/*.gz
%exclude %{_mandir}/man1/pstopnm.1%{ext_man}
%doc %{_mandir}/man3/*.gz
%doc %{_mandir}/man5/*.gz
%{_bindir}/*
%exclude %{_bindir}/pstopnm
%{_datadir}/%{name}
%files vulnerable
%defattr(-,root,root)
%{_bindir}/pstopnm
%{_mandir}/man1/pstopnm.1%{ext_man}
%files -n libnetpbm%{libmaj}
%defattr(-,root,root)
%{_libdir}/lib*.so.%{libmaj}
%{_libdir}/lib*.so.%{libver}
%files -n libnetpbm-devel
%defattr(-,root,root)
%{_includedir}/%{name}
%{_libdir}/lib*.so
%changelog