Sync from SUSE:ALP:Source:Standard:1.0 netpbm revision 199457418c3c2a398058c6f3d8ffbc9c

This commit is contained in:
Adrian Schröter 2024-02-21 14:21:31 +01:00
commit ee8038cdba
14 changed files with 3246 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
baselibs.conf Normal file
View File

@ -0,0 +1 @@
libnetpbm11

10
makeman-py3.patch Normal file
View File

@ -0,0 +1,10 @@
Index: netpbm-10.80.1/buildtools/makeman
===================================================================
--- netpbm-10.80.1.orig/buildtools/makeman
+++ netpbm-10.80.1/buildtools/makeman
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# makeman -- compile netpbm's stereotyped HTML to troff markup
#

BIN
netpbm-11.5.2-documentation.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

BIN
netpbm-11.5.2-nohpcdtoppm-noppmtompeg.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,13 @@
Index: netpbm-10.93.0/config.mk.in
===================================================================
--- netpbm-10.93.0.orig/config.mk.in 2020-12-29 10:52:17.176428400 +0100
+++ netpbm-10.93.0/config.mk.in 2020-12-29 10:52:17.328429333 +0100
@@ -482,7 +482,7 @@ JBIGLIB = $(INTERNAL_JBIGLIB)
JBIGHDR_DIR = $(INTERNAL_JBIGHDR_DIR)
# The Jasper JPEG-2000 image compression library (aka JasPer):
-JASPERLIB = -ljasper
+JASPERLIB = NONE
JASPERHDR_DIR = /usr/include/jasper
# JASPERDEPLIBS is the libraries (-l options or file names) on which
# The Jasper library depends -- i.e. what you have to link into any

45
netpbm-gcc-warnings.patch Normal file
View File

@ -0,0 +1,45 @@
Index: netpbm-11.5.2/converter/other/pngx.c
===================================================================
--- netpbm-11.5.2.orig/converter/other/pngx.c
+++ netpbm-11.5.2/converter/other/pngx.c
@@ -370,6 +370,7 @@ pngx_srgbIntentDesc(pngx_srgbIntent cons
case PNGX_ABSOLUTE_COLORIMETRIC: return "ABSOLUTE_COLORIMETRIC";
}
assert(false);
+ return NULL;
}
@@ -385,6 +386,7 @@ const libpngSrgbIntentCode(pngx_srgbInte
}
assert(false); /* All cases above return */
+ return -1;
}
Index: netpbm-11.5.2/lib/libpm.c
===================================================================
--- netpbm-11.5.2.orig/lib/libpm.c
+++ netpbm-11.5.2/lib/libpm.c
@@ -440,6 +440,7 @@ pm_maxvaltobits(int const maxval) {
pm_error( "maxval of %d is too large!", maxval );
assert(false);
+ return 0;
}
Index: netpbm-11.5.2/lib/libpnm3.c
===================================================================
--- netpbm-11.5.2.orig/lib/libpnm3.c
+++ netpbm-11.5.2/lib/libpnm3.c
@@ -446,6 +446,8 @@ pnm_bittoxel(bit const inputBit,
case PBM_WHITE: return pnm_whitexel(maxval, PBM_TYPE); break;
default:
assert(false);
+ pixel const black = {0, 0, 0};
+ return black;
}
}

60
netpbm-make.patch Normal file
View File

@ -0,0 +1,60 @@
Index: netpbm-10.93.0/config.mk.in
===================================================================
--- netpbm-10.93.0.orig/config.mk.in 2020-12-29 11:04:16.164846967 +0100
+++ netpbm-10.93.0/config.mk.in 2020-12-29 11:04:21.900882283 +0100
@@ -124,7 +124,7 @@ INSTALL = $(SRCDIR)/buildtools/install.s
#OSF1:
#INSTALL = $(SRCDIR)/buildtools/installosf
#Red Hat Linux:
-#INSTALL = install
+INSTALL = install
# STRIPFLAG is the option you pass to the above install program to make it
# strip unnecessary information out of binaries.
@@ -316,7 +316,7 @@ LDRELOC = NONE
CFLAGS_SHLIB =
# Gcc:
#CFLAGS_SHLIB = -fpic
-#CFLAGS_SHLIB = -fPIC
+CFLAGS_SHLIB = -fPIC
# Sun compiler:
#CFLAGS_SHLIB = -Kpic
#CFLAGS_SHLIB = -KPIC
@@ -383,7 +383,7 @@ NETPBMLIB_RUNTIME_PATH =
# The TIFF library. See above. If you want to build the tiff
# converters, you must have the tiff library already installed.
-TIFFLIB = NONE
+TIFFLIB = libtiff.so
TIFFHDR_DIR =
#TIFFLIB = libtiff.so
@@ -414,7 +414,7 @@ TIFFLIB_NEEDS_Z = Y
# JPEG stuff statically linked in, in which case you won't need
# JPEGLIB in order to build the Tiff converters.
-JPEGLIB = NONE
+JPEGLIB = libjpeg.so
JPEGHDR_DIR =
#JPEGLIB = libjpeg.so
#JPEGHDR_DIR = /usr/include/jpeg
@@ -472,7 +472,7 @@ PNGVER =
#
# If you have 'libpng-config' (see above), these are irrelevant.
-ZLIB = NONE
+ZLIB = libz.so
ZHDR_DIR =
#ZLIB = libz.so
@@ -482,8 +482,8 @@ JBIGLIB = $(INTERNAL_JBIGLIB)
JBIGHDR_DIR = $(INTERNAL_JBIGHDR_DIR)
# The Jasper JPEG-2000 image compression library (aka JasPer):
-JASPERLIB = $(INTERNAL_JASPERLIB)
-JASPERHDR_DIR = $(INTERNAL_JASPERHDR_DIR)
+JASPERLIB = -ljasper
+JASPERHDR_DIR = /usr/include/jasper
# JASPERDEPLIBS is the libraries (-l options or file names) on which
# The Jasper library depends -- i.e. what you have to link into any
# executable that links in the Jasper library.

1187
netpbm-security-code.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
Index: netpbm-11.2.0/editor/ppmshadow
===================================================================
--- netpbm-11.2.0.orig/editor/ppmshadow
+++ netpbm-11.2.0/editor/ppmshadow
@@ -194,9 +194,10 @@ my $tmpdir = $ENV{TMPDIR} || "/tmp";
my $ourtmp;
if ($keeptemp) {
- $ourtmp = "$tmpdir/ppmshadow$$";
- mkdir($ourtmp, 0777) or
- die("Unable to create directory for temporary files '$ourtmp");
+ chomp($ourtmp = `mktemp -d -t PPMshadow.XXXXXX`);
+ if ($? >> 8) {
+ die "Can't create directory for temporary files";
+ }
} else {
$ourtmp = File::Temp::tempdir("$tmpdir/ppmshadowXXXX", CLEANUP=>1);
}

View File

@ -0,0 +1,77 @@
Index: netpbm-11.5.2/converter/other/tifftopnm.c
===================================================================
--- netpbm-11.5.2.orig/converter/other/tifftopnm.c
+++ netpbm-11.5.2/converter/other/tifftopnm.c
@@ -1393,7 +1393,7 @@ convertRasterByRows(pnmOut * const
-static void
+static int
warnBrokenTiffLibrary(TIFF * const tiffP) {
/* TIFF library bug:
@@ -1423,6 +1423,7 @@ warnBrokenTiffLibrary(TIFF * const tiffP
unsigned short tiffOrientation;
int fldPresent;
+ int broken = false;
fldPresent = TIFFGetField(tiffP, TIFFTAG_ORIENTATION, &tiffOrientation);
if (fldPresent) {
switch (tiffOrientation) {
@@ -1432,10 +1433,12 @@ warnBrokenTiffLibrary(TIFF * const tiffP
case ORIENTATION_LEFTBOT:
pm_message("WARNING: This TIFF image has an orientation that "
"most TIFF libraries convert incorrectly. "
- "Use -byrow to circumvent.");
+ "Using -byrow to circumvent.");
+ broken = true;
break;
}
}
+ return broken;
}
@@ -1562,8 +1565,6 @@ convertRasterInMemory(pnmOut *
if (verbose)
pm_message("Converting in memory ...");
- warnBrokenTiffLibrary(tif);
-
ok = TIFFRGBAImageOK(tif, emsg);
if (!ok) {
pm_message("%s", emsg);
@@ -1662,7 +1663,7 @@ convertImage(TIFF * const ti
xelval maxval;
xel colormap[MAXCOLORS];
unsigned short fillorder;
- bool flipOk, noflipOk;
+ bool flipOk, noflipOk, byrow;
pnmOut pnmOut;
readDirectory(tifP, cmdline.headerdump, &tiffDir);
@@ -1674,15 +1675,21 @@ convertImage(TIFF * const ti
pm_message("writing %s file", pnm_formattypenm(format));
+ byrow = cmdline.byrow;
+ if (warnBrokenTiffLibrary(tifP)) {
+ /* force byrow true: http://bugzilla.maptools.org/show_bug.cgi?id=2654#c9 */
+ byrow = true;
+ }
+
pnmOut_init(imageoutFileP, alphaFileP, tiffDir.width, tiffDir.height,
tiffDir.orientation, maxval, format, maxval,
- cmdline.byrow, cmdline.orientraw,
+ byrow, cmdline.orientraw,
cmdline.verbose,
&flipOk, &noflipOk,
&pnmOut);
convertRaster(&pnmOut, tifP, tiffDir, maxval,
- fillorder, colormap, cmdline.byrow, flipOk, noflipOk,
+ fillorder, colormap, byrow, flipOk, noflipOk,
cmdline.verbose);
pnmOut_term(&pnmOut, cmdline.verbose);

1578
netpbm.changes Normal file

File diff suppressed because it is too large Load Diff

190
netpbm.spec Normal file
View File

@ -0,0 +1,190 @@
#
# 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 ubsan_build 0
%define libmaj 11
%define libmin 105
%define libver %{libmaj}.%{libmin}
Name: netpbm
Version: 11.5.2
Release: 0
Summary: A 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.sh
# SUSE specific
Patch0: %{name}-make.patch
# neccessary for running with ASAN
Patch2: %{name}-security-code.patch
Patch3: %{name}-security-scripts.patch
Patch4: %{name}-gcc-warnings.patch
Patch5: makeman-py3.patch
# bsc#1144255 disable jpeg2k support due to removal of jasper
Patch8: netpbm-disable-jasper.patch
# CVE-2017-5849 [bsc#1022790], CVE-2017-5849 [bsc#1022791]
Patch9: netpbm-use-byrow-when-needed.patch
BuildRequires: flex
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: libxml2-devel
BuildRequires: pkgconfig
# needed for the makeman
BuildRequires: python3-base
BuildRequires: pkgconfig(x11)
Provides: pbmplus
%description
These are the Portable Bitmap Plus Utilities.
This package 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.
%package -n libnetpbm%{libmaj}
Summary: Libraries for the NetPBM (NetPortableBitmap) Graphic Formats
Group: System/Libraries
Provides: libnetpbm = %{version}
Obsoletes: libnetpbm < %{version}
%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.
%package -n libnetpbm-devel
Summary: Header files for the NetPBM libraries
Group: Development/Libraries/C and C++
Requires: libnetpbm%{libmaj} = %{version}
%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 -q -D -a 1
%autopatch -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="%{optflags} -flax-vector-conversions -Wno-return-type"
%if %{debug_build}
export CFLAGS="$CFLAGS -O0"
%endif
%if %{asan_build}
export CFLAGS="$CFLAGS -fsanitize=address -fno-sanitize-recover=all"
export LDFLAGS="$LDFLAGS -fsanitize=address"
%endif
%if %{ubsan_build}
export CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize-recover=all"
export LDFLAGS="$LDFLAGS -fsanitize=undefined"
%endif
make %{?_smp_mflags} 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=
#
mkdir -p %{buildroot}%{_prefix}/{bin,include,%{_lib},share/man,share/%{name}}
cp -pd package/bin/* %{buildroot}%{_bindir}
cp -pd package/lib/*.so* %{buildroot}%{_libdir}
ln -s libnetpbm.so.%{libver} %{buildroot}%{_libdir}/libnetpbm.so
cp -prd package/include/netpbm %{buildroot}%{_includedir}
cp -prd man/* %{buildroot}%{_mandir}
install -m 644 converter/other/pnmtopalm/*.map \
%{buildroot}%{_datadir}/%{name}
rm %{buildroot}%{_bindir}/g3topbm # conflict with g3utils
rm %{buildroot}%{_bindir}/pstopnm # disable due security reasons, e. g. [bsc#1105592]
%post -n libnetpbm%{libmaj} -p /sbin/ldconfig
%postun -n libnetpbm%{libmaj} -p /sbin/ldconfig
%check
%if %{asan_build}
export LSAN_OPTIONS="detect_leaks=0"
%endif
%if %{ubsan_build}
export UBSAN_OPTIONS="print_stacktrace=1"
%endif
# do not run unneccesary tests
sed -i '/all-in-place/d' test/Test-Order
sed -i '/legacy-names/d' test/Test-Order
# picttoppm.c: #error "Unfixable. Don't ship me"
sed -i '/pict-roundtrip/d' test/Test-Order
sed -i '/stdin-ppm3.test/d' test/Test-Order
# pstopnm is not shipped
sed -i '/^l\?ps.*\.test/d' test/Test-Order
# new winicon-roundtrip2.test failure reported to bryanh@giraffe-data.com on 2020-12-29
# $ LD_LIBRARY_PATH=lib PATH=package/bin pamtowinicon -pngthreshold=1 package-test-tmp/testimg1.pam
# pamtowinicon: bad magic number 0xf0f - not a PAM, PPM, PGM, or PBM file
# $
sed -i '/winicon-roundtrip2.test/d' test/Test-Order
# Unable to exec 'gs'
sed -i '/pbmtextps.test/d' test/Test-Order
sed -i '/stdin-pnm2.test/d' test/Test-Order
mkdir package-test-{tmp,results}
make pkgdir=`pwd`/package tmpdir=`pwd`/package-test-tmp RESULTDIR=`pwd`/package-test-results check-package
%files
%doc README doc/* netpbm.sourceforge.net/doc
%doc pnmtopalm/
%{_mandir}/man1/*%{ext_man}
%{_mandir}/man5/*%{ext_man}
%{_bindir}/*
%{_datadir}/%{name}
%files -n libnetpbm%{libmaj}
%{_libdir}/lib*.so.%{libmaj}
%{_libdir}/lib*.so.%{libver}
%files -n libnetpbm-devel
%{_includedir}/%{name}
%{_libdir}/lib*.so
%{_mandir}/man3/*%{ext_man}
%changelog

38
prepare-src-tarball.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh -x
#This script is used to create netpbm-$VER-nohpcdtoppm-nojbig.tar.bz2
#from upstream svn, http://sourceforge.net/projects/netpbm/
rm -rf REMOVE
mkdir REMOVE
cd REMOVE
svn checkout https://svn.code.sf.net/p/netpbm/code/advanced/ netpbm
VER=`echo \`cut -f2 -d= netpbm*/version.mk \`|sed -e "s| |.|g"`
mv netpbm* netpbm-$VER
find . -name ".svn" -exec rm -rf {} \;
cd netpbm*/converter/ppm/hpcdtoppm || exit 1
rm -rf *
echo all: >> Makefile
echo install.bin: >> Makefile
echo install.man: >> Makefile
echo install.data: >> Makefile
echo clean: >> Makefile
cd ../../../..
cd netpbm*/converter/ppm/ppmtompeg || exit 1
rm -rf *
echo all: >> Makefile
echo install.bin: >> Makefile
echo install.man: >> Makefile
echo install.data: >> Makefile
echo clean: >> Makefile
cd ../../../..
tar cjf ../netpbm-$VER-nohpcdtoppm-noppmtompeg.tar.bz2 *
wget -m netpbm.sourceforge.net
tar cjf ../netpbm-$VER-documentation.tar.bz2 netpbm.sourceforge.net