graphics/netpbm: update to 10.97.04

Numerous bug fixes.
New programs: pamhomography, pbmnoise

Replace GNU head(1) from coreutils with a local copy of FreeBSD's head(1)
for "head -c" in tests.
This commit is contained in:
naddy 2022-02-26 22:36:48 +00:00
parent 09001b3c63
commit cd0d0dc579
9 changed files with 198 additions and 160 deletions

View File

@ -1,18 +1,14 @@
# $OpenBSD: Makefile,v 1.93 2022/02/23 15:17:29 naddy Exp $
# $OpenBSD: Makefile,v 1.94 2022/02/26 22:36:48 naddy Exp $
COMMENT= toolkit for manipulation and conversion of graphic images
REVISION= 0
DISTNAME= netpbm-10.91.00
SHARED_LIBS= netpbm 5.2
DISTNAME= netpbm-10.97.04
SHARED_LIBS= netpbm 5.3
CATEGORIES= graphics
HOMEPAGE= http://netpbm.sourceforge.net/
PERMIT_PACKAGE= Yes
WANTLIB += X11 c iconv jasper jbig jpeg lzma m png pthread tiff xml2 z
MASTER_SITES= https://shell.uugrn.org/~naddy/
EXTRACT_SUFX= .tar.xz
@ -23,6 +19,8 @@ LIB_DEPENDS= graphics/tiff \
graphics/jasper \
textproc/libxml
WANTLIB= X11 c jasper jbig jpeg m png tiff xml2 z
DEBUG_PACKAGES= ${BUILD_PACKAGES}
USE_GMAKE= Yes
@ -32,8 +30,6 @@ INSTALL_TARGET= install.bin install.lib install.data \
MAKE_FLAGS= CC="${CC}" \
LIBnetpbm_VERSION=${LIBnetpbm_VERSION}
# programs can take seed on command line
MAKE_FLAGS+= CFLAGS_CONFIG="-Dsrand=srand_deterministic"
FAKE_FLAGS= pkgdir="${WRKINST}${TRUEPREFIX}"
@ -41,18 +37,15 @@ do-configure:
cp ${FILESDIR}/config.mk ${WRKSRC}
TEST_DEPENDS= print/ghostscript/gnu \
shells/bash \
sysutils/coreutils
shells/bash
TEST_TARGET= check
TEST_FLAGS= pkgdir="${WRKINST}${PREFIX}" \
resultdir="${WRKDIR}/tests" \
RGBDEF="${WRKINST}${PREFIX}/share/netpbm/rgb.txt"
# head -c, mv -T
pre-test:
@for i in head mv; do \
ln -sf ${LOCALBASE}/bin/g$$i ${WRKDIR}/bin/$$i; \
done
# head -c
${CC} ${CFLAGS} -o ${WRKDIR}/bin/head ${FILESDIR}/head.c
@sed -i '1 s:^.*bin/bash:#!${LOCALBASE}/bin/bash:' \
${WRKSRC}/test/Available-Testprog \
${WRKSRC}/test/Execute-Tests \
@ -61,9 +54,6 @@ pre-test:
# must run after fake
test: fake
# The pamdice, pamvalidate, pamexec, pj-roundtrip tests are known to be
# broken and will be fixed in 10.92
# Get the latest release in a release series from Netpbm Subversion.
# Requires devel/subversion.
distfile:

View File

@ -1,2 +1,2 @@
SHA256 (netpbm-10.91.00.tar.xz) = htf3s8rG9vXRnTYqkvU75Yh+J5AeaNEizbJE0O93f/I=
SIZE (netpbm-10.91.00.tar.xz) = 2100180
SHA256 (netpbm-10.97.04.tar.xz) = 2CLS5qf6DiM8tjGLrtQvpX5CWXaGZcbw1NqQitq79uk=
SIZE (netpbm-10.97.04.tar.xz) = 2145100

View File

@ -1,4 +1,4 @@
# $OpenBSD: config.mk,v 1.2 2020/07/07 20:15:03 naddy Exp $
# $OpenBSD: config.mk,v 1.3 2022/02/26 22:36:48 naddy Exp $
# Indented variables are unchanged from the defaults in config.mk.in.
# Commented out variables are set in MAKE_FLAGS.
#
@ -79,5 +79,4 @@ INSTALL_PERM_DATA = $(NONBINMODE)
SHLIBPREFIXLIST = lib
NETPBMSHLIBPREFIX = $(firstword $(SHLIBPREFIXLIST))
DLLVER =
NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/
RGB_DB_PATH = $(PREFIX)/share/netpbm/rgb.txt:/usr/X11R6/share/X11/rgb.txt

View File

@ -0,0 +1,171 @@
/* $OpenBSD: head.c,v 1.1 2022/02/26 22:36:48 naddy Exp $ */
/* FreeBSD usr.bin/head/head.c fbbd9655e5107c68e4e0146ff22b73d7350475bc */
/*
* Copyright (c) 1980, 1987, 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <ctype.h>
#include <err.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* head - give the first few lines of a stream or of each of a set of files
*
* Bill Joy UCB August 24, 1977
*/
static void head(FILE *, int);
static void head_bytes(FILE *, off_t);
static void obsolete(char *[]);
static void usage(void);
int
main(int argc, char *argv[])
{
int ch;
FILE *fp;
int first, linecnt = -1, eval = 0;
off_t bytecnt = -1;
char *ep;
obsolete(argv);
while ((ch = getopt(argc, argv, "n:c:")) != -1)
switch(ch) {
case 'c':
bytecnt = strtoimax(optarg, &ep, 10);
if (*ep || bytecnt <= 0)
errx(1, "illegal byte count -- %s", optarg);
break;
case 'n':
linecnt = strtol(optarg, &ep, 10);
if (*ep || linecnt <= 0)
errx(1, "illegal line count -- %s", optarg);
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
if (linecnt != -1 && bytecnt != -1)
errx(1, "can't combine line and byte counts");
if (linecnt == -1 )
linecnt = 10;
if (*argv) {
for (first = 1; *argv; ++argv) {
if ((fp = fopen(*argv, "r")) == NULL) {
warn("%s", *argv);
eval = 1;
continue;
}
if (argc > 1) {
(void)printf("%s==> %s <==\n",
first ? "" : "\n", *argv);
first = 0;
}
if (bytecnt == -1)
head(fp, linecnt);
else
head_bytes(fp, bytecnt);
(void)fclose(fp);
}
} else if (bytecnt == -1)
head(stdin, linecnt);
else
head_bytes(stdin, bytecnt);
exit(eval);
}
static void
head(FILE *fp, int cnt)
{
char *cp;
size_t error, readlen;
while (cnt && (cp = fgetln(fp, &readlen)) != NULL) {
error = fwrite(cp, sizeof(char), readlen, stdout);
if (error != readlen)
err(1, "stdout");
cnt--;
}
}
static void
head_bytes(FILE *fp, off_t cnt)
{
char buf[4096];
size_t readlen;
while (cnt) {
if ((uintmax_t)cnt < sizeof(buf))
readlen = cnt;
else
readlen = sizeof(buf);
readlen = fread(buf, sizeof(char), readlen, fp);
if (readlen == 0)
break;
if (fwrite(buf, sizeof(char), readlen, stdout) != readlen)
err(1, "stdout");
cnt -= readlen;
}
}
static void
obsolete(char *argv[])
{
char *ap;
while ((ap = *++argv)) {
/* Return if "--" or not "-[0-9]*". */
if (ap[0] != '-' || ap[1] == '-' || !isdigit(ap[1]))
return;
if ((ap = malloc(strlen(*argv) + 2)) == NULL)
err(1, NULL);
ap[0] = '-';
ap[1] = 'n';
(void)strcpy(ap + 2, *argv + 1);
*argv = ap;
}
}
static void
usage(void)
{
(void)fprintf(stderr, "usage: head [-n lines | -c bytes] [file ...]\n");
exit(1);
}

View File

@ -1,99 +0,0 @@
$OpenBSD: patch-converter_ppm_hpcdtoppm_pcdovtoppm,v 1.1 2020/07/07 20:15:03 naddy Exp $
Fix garbage conversion from csh arrays
https://sourceforge.net/p/netpbm/code/3891/
Index: converter/ppm/hpcdtoppm/pcdovtoppm
--- converter/ppm/hpcdtoppm/pcdovtoppm.orig
+++ converter/ppm/hpcdtoppm/pcdovtoppm
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# pcdovtoppm - generate a single PPM file from a PCD overview file
#
@@ -136,7 +136,7 @@ done
if [ $versionopt -eq 1 ] ; then
version
-elif [ $# = 0 ] ; then
+elif [ $# -eq 0 ] ; then
usage
fi
@@ -146,12 +146,6 @@ trap 'rm -rf $tempdir' 0
tmpfile=`tempfile -p pi -m 600`
-rowfiles=()
-imagefiles=()
-row=1
-col=1
-width=$size
-
# Convert the PCD overview file to many PPM images
if [ -f $1 ] ; then
hpcdtoppm -Overview $1 $tmpfile ||
@@ -162,14 +156,20 @@ else
usage
fi
+imagefiles=
+rowfiles=
+row=1
+col=1
+width=$size
+
for i in "$tmpfile"*
do
if [ -f $i ] ; then
- description=`pnmfile $i`
- if [ "${description[4]}" -le $size -a \
- "${description[6]}" -le $size ] ; then
+ thiswidth=$(pamfile -machine $i | cut -f 4 -d ' ')
+ thisheight=$(pamfile -machine $i | cut -f 5 -d ' ')
+ if [ "$thiswidth" -le $size -a "$thisheight" -le $size ] ; then
cat $i > $tmpfile
- else
+ else
if [ "$colors" = "n" ] ; then
pnmscale -quiet -xysize $size $size $i > $tmpfile
else
@@ -191,8 +191,8 @@ do
fi
rm -f $tmpfile
- description=`pnmfile $imagefile`
- width=$(( $width + ${description[4]} ))
+ thisWidth=$(pamfile -machine $i | cut -f 4 -d ' ')
+ width=$(( $width + $thisWidth ))
imagefiles="$imagefiles $imagefile"
if [ $col -ge $across -o $width -gt $maxwidth ] ; then
@@ -205,7 +205,7 @@ do
ppmquant -quiet $colors > $rowfile
fi
rm -f $imagefiles
- imagefiles=()
+ imagefiles=
rowfiles="$rowfiles $rowfile"
col=1
row=$(( $row + 1 ))
@@ -215,7 +215,7 @@ do
fi
done
-if [ ${#imagefiles[*]} -gt 0 ] ; then
+if [ -n $imagefiles ] ; then
rowfile=${tempdir}/pi.${row}
rm -f $rowfile
if [ "$colors" = "n" ] ; then
@@ -228,7 +228,7 @@ if [ ${#imagefiles[*]} -gt 0 ] ; then
rowfiles="$rowfiles $rowfile"
fi
-if [ ${#rowfiles[*]} = 1 ] ; then
+if [ $(echo $rowfiles|wc -w) -eq 1 ] ; then
ppmtoppm $plainopt < $rowfiles
else
if [ "$colors" = "n" ] ; then

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-lib_Makefile,v 1.9 2019/08/25 20:29:40 naddy Exp $
$OpenBSD: patch-lib_Makefile,v 1.10 2022/02/26 22:36:48 naddy Exp $
Index: lib/Makefile
--- lib/Makefile.orig
+++ lib/Makefile
@@ -53,6 +53,9 @@ LIBOBJECTS_X = \
@@ -57,6 +57,9 @@ LIBOBJECTS_X = \
util/token.o \
util/vasprintf.o \
@ -12,7 +12,7 @@ Index: lib/Makefile
MANUALS3 = libnetpbm
MANUALS5 = pbm pgm ppm pnm pam
@@ -89,13 +92,16 @@ extra_staticlib: $(EXTRA_STATICLIB)
@@ -93,13 +96,16 @@ extra_staticlib: $(EXTRA_STATICLIB)
# type, but request a static library in addition.
#----------------------------------------------------------------------------
@ -30,7 +30,7 @@ Index: lib/Makefile
MAJ = 11
MIN = $(NETPBM_MINOR_RELEASE)
@@ -120,7 +126,7 @@ endif
@@ -124,7 +130,7 @@ endif
ifeq ($(NETPBMLIBTYPE),unixshared)
# The libxxx.so link is needed to link the executables.
@ -39,7 +39,7 @@ Index: lib/Makefile
rm -f $@
$(SYMLINK) $< $@
# The $(SONAME) link is needed only to test the programs without
@@ -129,8 +135,8 @@ libnetpbm.$(NETPBMLIBSUFFIX): $(SONAME)
@@ -133,8 +139,8 @@ libnetpbm.$(NETPBMLIBSUFFIX): $(SONAME)
$(SONAME): libnetpbm.$(NETPBMLIBSUFFIX).$(MAJ).$(MIN)
rm -f $@
$(SYMLINK) $< $@
@ -50,7 +50,7 @@ Index: lib/Makefile
$(SHLIB_CLIB) -lm $(LADD)
endif
@@ -209,25 +215,21 @@ standardppmdfont.c:
@@ -213,25 +219,21 @@ standardppmdfont.c:
compile.h:
$(SRCDIR)/buildtools/stamp-date >$@ || rm $@
@ -80,7 +80,7 @@ Index: lib/Makefile
endif
ifeq ($(NETPBMLIBTYPE),dll)
#install a Windows DLL shared library
@@ -263,9 +265,9 @@ $(INTERFACE_HEADERS:%=%_installhdr): $(PKGDIR)/include
@@ -267,9 +269,9 @@ $(INTERFACE_HEADERS:%=%_installhdr): $(PKGDIR)/include
$(SRCDIR)/lib/$(@:%_installhdr=%) $(PKGDIR)/include/netpbm/
.PHONY: install.staticlib

View File

@ -1,26 +0,0 @@
$OpenBSD: patch-lib_libpbmfont0_c,v 1.1 2020/07/23 16:53:15 jcs Exp $
Fix a double-free, from upstream
Index: lib/libpbmfont0.c
--- lib/libpbmfont0.c.orig
+++ lib/libpbmfont0.c
@@ -253,9 +253,6 @@ pbm_destroybdffont2_base(struct font2 * const font2P)
free(font2P->glyph);
- if (font2P->selectorP)
- pm_selector_destroy(font2P->selectorP);
-
if (font2P->oldfont)
pbm_freearray(font2P->oldfont, font2P->frows);
@@ -275,7 +272,7 @@ pbm_destroybdffont2(struct font2 * const font2P) {
if (font2P->load_fn != FIXED_DATA) {
destroyGlyphData(font2P->glyph, font2P->maxglyph, font2P->selectorP);
- pbm_destroybdffont2_base(font2P);
+ pbm_destroybdffont2_base(font2P);
}
}

View File

@ -1,7 +1,8 @@
$OpenBSD: patch-lib_util_Makefile,v 1.4 2016/04/26 17:59:51 naddy Exp $
--- lib/util/Makefile.orig Sat Sep 26 21:59:25 2015
+++ lib/util/Makefile Mon Apr 25 19:43:02 2016
@@ -24,15 +24,20 @@ UTILOBJECTS = \
$OpenBSD: patch-lib_util_Makefile,v 1.5 2022/02/26 22:36:48 naddy Exp $
Index: lib/util/Makefile
--- lib/util/Makefile.orig
+++ lib/util/Makefile
@@ -28,15 +28,20 @@ UTILOBJECTS = \
token.o \
vasprintf.o \

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.17 2019/12/14 22:03:16 naddy Exp $
@comment $OpenBSD: PLIST,v 1.18 2022/02/26 22:36:48 naddy Exp $
@bin bin/411toppm
bin/anytopnm
@bin bin/asciitopgm
@ -69,6 +69,7 @@ bin/pamfixtrunc
@bin bin/pamgauss
@bin bin/pamgetcolor
@bin bin/pamgradient
@bin bin/pamhomography
@bin bin/pamhue
@bin bin/pamlevels
@bin bin/pamlookup
@ -133,6 +134,7 @@ bin/pamstretch-gen
@bin bin/pbmmake
@bin bin/pbmmask
@bin bin/pbmminkowski
@bin bin/pbmnoise
@bin bin/pbmpage
@bin bin/pbmpscale
@bin bin/pbmreduce
@ -272,7 +274,7 @@ bin/pnmtotiff
@bin bin/pnmtotiffcmyk
@bin bin/pnmtoxwd
@bin bin/ppm3d
@bin bin/ppmbrighten
bin/ppmbrighten
@bin bin/ppmchange
@bin bin/ppmcie
@bin bin/ppmcolormask