Similar to gzip in base, further drop promises (de)compressing to stdout
except for "cpath" which is needed for unlink(2) in pigz.c:cut_short()
which handles internal errors and SIGINT.

I also tested this with several regress/usr.bin/gzip runs on both amd64
and sparc64.

While here, do some cleanup and install unpigz as symlink since it's the
same binary.

Feedback? OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/archivers/pigz/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- Makefile    25 Jan 2018 10:34:49 -0000      1.6
+++ Makefile    30 Jun 2018 16:13:03 -0000
@@ -5,7 +5,8 @@ NOT_FOR_ARCHS=  ${GCC3_ARCHS}
 
 COMMENT =      parallel implementation of gzip utilizing multiple cores
 
-DISTNAME =     pigz-2.4
+DISTNAME =     pigz-2.4
+REVISION =     0
 CATEGORIES =   archivers
 HOMEPAGE =     https://zlib.net/pigz/
 
@@ -14,17 +15,19 @@ MAINTAINER =        Thomas Pfaff <[email protected]
 # zlib + Apache
 PERMIT_PACKAGE_CDROM =         Yes
 
+# uses pledge()
 WANTLIB =      c m pthread z
 
-MASTER_SITES = ${HOMEPAGE}
+MASTER_SITES = https://zlib.net/pigz/
 
-MAKE_FLAGS =   CC="${CC}" CFLAGS="${CFLAGS} -Wall -Wextra"
+MAKE_FLAGS =   CC="${CC}" \
+               CFLAGS="${CFLAGS}"
 
 ALL_TARGET =   pigz
 
 do-install:
-       ${INSTALL_PROGRAM} ${WRKSRC}/pigz ${PREFIX}/bin
-       ${INSTALL_PROGRAM} ${WRKSRC}/unpigz ${PREFIX}/bin
+       ${INSTALL_PROGRAM} ${WRKBUILD}/pigz ${PREFIX}/bin
+       ln -sf pigz ${PREFIX}/bin/unpigz
        ${INSTALL_MAN} ${WRKSRC}/pigz.1 ${PREFIX}/man/man1
 
 .include <bsd.port.mk>
Index: patches/patch-pigz_c
===================================================================
RCS file: patches/patch-pigz_c
diff -N patches/patch-pigz_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-pigz_c        30 Jun 2018 15:37:37 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+
+Index: pigz.c
+--- pigz.c.orig
++++ pigz.c
+@@ -4307,6 +4307,11 @@ int main(int argc, char **argv) {
+     char *opts, *p;                 // environment default options, marker
+     ball_t err;                     // error information from throw()
+ 
++    if (pledge("stdio rpath wpath cpath fattr chown", NULL) == -1) {
++        complain("pledge");
++        exit(1);
++    }
++
+     g.ret = 0;
+     try {
+         // initialize globals
+@@ -4408,6 +4413,12 @@ int main(int argc, char **argv) {
+             else if (option(argv[n]))   // process argument
+                 argv[n] = NULL;         // remove if option
+         option(NULL);                   // check for missing parameter
++
++        if (g.pipeout || g.decode == 2)
++            if (pledge("stdio rpath cpath", NULL) == -1) {
++                complain("pledge");
++                exit(1);
++            }
+ 
+         // process command-line filenames
+         done = 0;
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/archivers/pigz/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST
--- pkg/PLIST   1 Dec 2013 03:19:13 -0000       1.1.1.1
+++ pkg/PLIST   30 Jun 2018 16:13:03 -0000
@@ -1,4 +1,4 @@
 @comment $OpenBSD: PLIST,v 1.1.1.1 2013/12/01 03:19:13 brad Exp $
 @bin bin/pigz
-@bin bin/unpigz
+bin/unpigz
 @man man/man1/pigz.1

Reply via email to