Rafael Sadowski wrote:
> Looks like scrot has found a new home, so please find below a simple
> update diff. Used on amd64 for a while.

Hi,

I had it updated already to 1.4, but it was not imported:
https://marc.info/?l=openbsd-ports&m=161139638513700&w=2

You OK'd it even :)

I see that upstream now provides release tarballs which is much better.
So it's good to ditch the autoconf stuff and use MASTER_SITES.

My version also contained some fixes and pledge. Would you mind taking
these over?

I updated my diff now as well.

Best Regards,
Stefan

Index: graphics/scrot/Makefile
===================================================================
RCS file: /cvs/ports/graphics/scrot/Makefile,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 Makefile
--- graphics/scrot/Makefile     12 Jul 2019 20:47:10 -0000      1.17
+++ graphics/scrot/Makefile     15 Aug 2021 17:00:15 -0000
@@ -2,25 +2,28 @@
 
 COMMENT=               commandline screen capture util
 
-DISTNAME=              scrot-0.8
-REVISION =             4
-CATEGORIES=            graphics
+GH_ACCOUNT =           resurrecting-open-source-projects
+GH_PROJECT =           scrot
+GH_TAGNAME =           1.6
 
-HOMEPAGE=              http://www.linuxbrit.co.uk/scrot/
+CATEGORIES =           graphics
+
+HOMEPAGE =             
https://github.com/resurrecting-open-source-projects/scrot
+
+MASTER_SITES =         
https://github.com/resurrecting-open-source-projects/scrot/releases/download/${GH_TAGNAME}/
+DISTFILES =            ${GH_PROJECT}-${GH_TAGNAME}${EXTRACT_SUFX}
 
 # BSD
 PERMIT_PACKAGE=        Yes
 
-WANTLIB=               X11 Xext c freetype m z \
-                       giblib>=1 Imlib2>=1
-
-MASTER_SITES=          http://www.linuxbrit.co.uk/downloads/
+# pledge
+WANTLIB =              c Imlib2 X11 Xcomposite Xext Xfixes
 
-LIB_DEPENDS=            devel/giblib \
+LIB_DEPENDS =          devel/giblib \
                        graphics/imlib2
 
 CONFIGURE_STYLE=       gnu
 
-FAKE_FLAGS+=           docsdir=${PREFIX}/share/doc/scrot/
+BUILD_DEPENDS =                devel/autoconf-archive
 
 .include <bsd.port.mk>
Index: graphics/scrot/distinfo
===================================================================
RCS file: /cvs/ports/graphics/scrot/distinfo,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 distinfo
--- graphics/scrot/distinfo     18 Jan 2015 03:14:14 -0000      1.4
+++ graphics/scrot/distinfo     15 Aug 2021 17:00:15 -0000
@@ -1,2 +1,2 @@
-SHA256 (scrot-0.8.tar.gz) = YT0c9STCtizjxl8SMupPBcfa8kjV6C/ypoksmAk5lPI=
-SIZE (scrot-0.8.tar.gz) = 74324
+SHA256 (scrot-1.6.tar.gz) = QvZNOPBOxTDItOva4EzOi2iTsvjTBic5HTkO3LqRcJA=
+SIZE (scrot-1.6.tar.gz) = 182032
Index: graphics/scrot/patches/patch-Makefile_am
===================================================================
RCS file: graphics/scrot/patches/patch-Makefile_am
diff -N graphics/scrot/patches/patch-Makefile_am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ graphics/scrot/patches/patch-Makefile_am    15 Aug 2021 17:00:15 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Index: Makefile.am
+--- Makefile.am.orig
++++ Makefile.am
+@@ -31,8 +31,8 @@ AUTOMAKE_OPTIONS = 1.4 foreign
+ # A list of all the files in the current directory which can be regenerated
+ MAINTAINERCLEANFILES = Makefile.in
+ 
+-AM_LDFLAGS        = -L/usr/X11R6/lib -L/usr/lib -L/usr/local/lib
+-AM_CPPFLAGS       = -I/usr/X11R6/include \
++AM_LDFLAGS        = -L${X11BASE}/lib -L/usr/lib -L/usr/local/lib
++AM_CPPFLAGS       = -I${X11BASE}/include \
+ $(X_CFLAGS) -I$(prefix)/include -I$(includedir) -I.
+ 
+ man_MANS = man/scrot.1
Index: graphics/scrot/patches/patch-src_Makefile_in
===================================================================
RCS file: graphics/scrot/patches/patch-src_Makefile_in
diff -N graphics/scrot/patches/patch-src_Makefile_in
--- graphics/scrot/patches/patch-src_Makefile_in        8 Jul 2011 11:25:47 
-0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-$OpenBSD: patch-src_Makefile_in,v 1.2 2011/07/08 11:25:47 jasper Exp $
---- src/Makefile.in.orig       Mon Jun 23 14:13:34 2003
-+++ src/Makefile.in    Fri Jul  8 13:22:30 2011
-@@ -73,13 +73,13 @@ VERSION = @VERSION@
- 
- MAINTAINERCLEANFILES = Makefile.in                            
- 
--LDFLAGS = -L/usr/X11R6/lib
--INCLUDES = -g -O3 -Wall -I/usr/X11R6/include $(X_CFLAGS) -I$(prefix)/include 
-I$(includedir) -I. -DPREFIX=\""$(prefix)"\" @GIBLIB_CFLAGS@
-+LDFLAGS = -L${X11BASE}/lib
-+INCLUDES = -Wall -I${X11BASE}/include $(X_CFLAGS) -I$(prefix)/include 
-I$(includedir) -I. -DPREFIX=\""$(prefix)"\" @GIBLIB_CFLAGS@
- 
- LIBOBJS = @LIBOBJS@
- 
- bin_PROGRAMS = scrot
--scrot_SOURCES = main.c getopt.c getopt1.c getopt.h scrot.h options.c 
options.h debug.h imlib.c structs.h
-+scrot_SOURCES = main.c scrot.h options.c options.h debug.h imlib.c structs.h
- 
- scrot_LDADD = -lX11 @GIBLIB_LIBS@
- mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-@@ -91,7 +91,7 @@ PROGRAMS =  $(bin_PROGRAMS)
- DEFS = @DEFS@ -I. -I$(srcdir) -I.
- CPPFLAGS = @CPPFLAGS@
- LIBS = @LIBS@
--scrot_OBJECTS =  main.o getopt.o getopt1.o options.o imlib.o
-+scrot_OBJECTS =  main.o options.o imlib.o
- scrot_DEPENDENCIES = 
- scrot_LDFLAGS = 
- CFLAGS = @CFLAGS@
-@@ -239,11 +239,9 @@ distdir: $(DISTFILES)
-           || cp -p $$d/$$file $(distdir)/$$file || :; \
-         fi; \
-       done
--getopt.o: getopt.c config.h
--getopt1.o: getopt1.c config.h getopt.h
--imlib.o: imlib.c scrot.h getopt.h config.h structs.h debug.h options.h
--main.o: main.c scrot.h getopt.h config.h structs.h debug.h options.h
--options.o: options.c scrot.h getopt.h config.h structs.h debug.h \
-+imlib.o: imlib.c scrot.h config.h structs.h debug.h options.h
-+main.o: main.c scrot.h config.h structs.h debug.h options.h
-+options.o: options.c scrot.h config.h structs.h debug.h \
-       options.h
- 
- info-am:
Index: graphics/scrot/patches/patch-src_main_c
===================================================================
RCS file: /cvs/ports/graphics/scrot/patches/patch-src_main_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-src_main_c
--- graphics/scrot/patches/patch-src_main_c     8 Jul 2011 11:25:47 -0000       
1.2
+++ graphics/scrot/patches/patch-src_main_c     15 Aug 2021 17:00:15 -0000
@@ -1,75 +1,26 @@
-$OpenBSD: patch-src_main_c,v 1.2 2011/07/08 11:25:47 jasper Exp $
---- src/main.c.orig    Mon Jun 23 14:05:48 2003
-+++ src/main.c Fri Jul  8 13:22:30 2011
-@@ -426,28 +426,28 @@ im_printf(char *str, struct tm *tm,
-       switch (*c) {
-         case 'f':
-           if (filename_im)
--            strcat(ret, filename_im);
-+            strlcat(ret, filename_im, sizeof(ret));
-           break;
-         case 'm': /* t was allready taken, so m as in mini */
-           if (filename_thumb)
--            strcat(ret, filename_thumb);
-+            strlcat(ret, filename_thumb, sizeof(ret));
-           break;
-         case 'n':
-           if (filename_im) {
-             tmp = strrchr(filename_im, '/');
-             if (tmp)
--              strcat(ret, tmp + 1);
-+              strlcat(ret, tmp + 1, sizeof(ret));
-             else
--              strcat(ret, filename_im);
-+              strlcat(ret, filename_im, sizeof(ret));
-           }
-           break;
-         case 'w':
-           snprintf(buf, sizeof(buf), "%d", gib_imlib_image_get_width(im));
--          strcat(ret, buf);
-+          strlcat(ret, buf, sizeof(ret));
-           break;
-         case 'h':
-           snprintf(buf, sizeof(buf), "%d", gib_imlib_image_get_height(im));
--          strcat(ret, buf);
-+          strlcat(ret, buf, sizeof(ret));
-           break;
-         case 's':
-           if (filename_im) {
-@@ -456,22 +456,22 @@ im_printf(char *str, struct tm *tm,
+$OpenBSD$
+
+Add pledge
+
+Index: src/main.c
+--- src/main.c.orig
++++ src/main.c
+@@ -116,6 +116,18 @@ main(int argc,
+     exit(EXIT_FAILURE);
+   }
+ 
++  if(opt.exec) {
++    if (pledge("cpath exec prot_exec rpath stdio wpath proc", NULL) == -1) {
++      fprintf ( stderr, "scrot: pledge\n" );
++      exit ( 1 );
++    }
++  } else {
++    if (pledge("cpath prot_exec rpath stdio wpath", NULL) == -1) {
++      fprintf ( stderr, "scrot: pledge\n" );
++      exit ( 1 );
++    }
++  }
++
+   time(&t); /* Get the time directly after the screenshot */
+   tm = localtime(&t);
  
-               size = st.st_size;
-               snprintf(buf, sizeof(buf), "%d", size);
--              strcat(ret, buf);
-+              strlcat(ret, buf, sizeof(ret));
-             } else
--              strcat(ret, "[err]");
-+              strlcat(ret, "[err]", sizeof(ret));
-           }
-           break;
-         case 'p':
-           snprintf(buf, sizeof(buf), "%d",
-                    gib_imlib_image_get_width(im) *
-                    gib_imlib_image_get_height(im));
--          strcat(ret, buf);
-+          strlcat(ret, buf, sizeof(ret));
-           break;
-         case 't':
--          strcat(ret, gib_imlib_image_format(im));
-+          strlcat(ret, gib_imlib_image_format(im), sizeof(ret));
-           break;
-         case '$':
--          strcat(ret, "$");
-+          strlcat(ret, "$", sizeof(ret));
-           break;
-         default:
-           strncat(ret, c, 1);
-@@ -482,7 +482,7 @@ im_printf(char *str, struct tm *tm,
-       switch (*c) {
-         case 'n':
-           if (filename_im)
--            strcat(ret, "\n");
-+            strlcat(ret, "\n", sizeof(ret));
-           break;
-         default:
-           strncat(ret, c, 1);
Index: graphics/scrot/patches/patch-src_options_c
===================================================================
RCS file: /cvs/ports/graphics/scrot/patches/patch-src_options_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-src_options_c
--- graphics/scrot/patches/patch-src_options_c  8 Jul 2011 11:25:47 -0000       
1.2
+++ graphics/scrot/patches/patch-src_options_c  15 Aug 2021 17:00:15 -0000
@@ -1,15 +1,19 @@
 $OpenBSD: patch-src_options_c,v 1.2 2011/07/08 11:25:47 jasper Exp $
---- src/options.c.orig Mon Jun 23 14:09:08 2003
-+++ src/options.c      Fri Jul  8 13:22:30 2011
-@@ -141,6 +141,7 @@ name_thumbnail(char *name)
+
+Initialize memory and secure strcat
+
+Index: src/options.c
+--- src/options.c.orig
++++ src/options.c
+@@ -369,6 +369,7 @@ name_thumbnail(char *name)
  
     length = strlen(name) + 7;
-    new_title = gib_emalloc(length);
-+   memset(new_title, 0, sizeof(new_title));
- 
-    dot_pos = strrchr(name, '.');
-    if (dot_pos)
-@@ -148,11 +149,11 @@ name_thumbnail(char *name)
+    new_title = malloc(length);
++   memset(new_title, 2, length);
+    if (! new_title) {
+      fprintf(stderr, "Unable to allocate thumbnail: %s", strerror(errno));
+      exit(EXIT_FAILURE);
+@@ -380,8 +381,8 @@ name_thumbnail(char *name)
        diff = (dot_pos - name) / sizeof(char);
  
        strncpy(new_title, name, diff);
@@ -18,9 +22,5 @@ $OpenBSD: patch-src_options_c,v 1.2 2011
 +      strlcat(new_title, "-thumb", length);
 +      strlcat(new_title, dot_pos, length);
     }
-    else
--      sprintf(new_title, "%s-thumb", name);
-+      snprintf(new_title, length, "%s-thumb", name);
- 
-    return new_title;
- }
+    else {
+       snprintf(new_title, length, "%s-thumb", name);
Index: graphics/scrot/pkg/PLIST
===================================================================
RCS file: /cvs/ports/graphics/scrot/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 PLIST
--- graphics/scrot/pkg/PLIST    8 Jul 2011 12:20:49 -0000       1.3
+++ graphics/scrot/pkg/PLIST    15 Aug 2021 17:00:15 -0000
@@ -1,8 +1,8 @@
-@comment $OpenBSD: PLIST,v 1.3 2011/07/08 12:20:49 jasper Exp $
+@comment $OpenBSD: PLIST,v$
 @bin bin/scrot
 @man man/man1/scrot.1
 share/doc/scrot/
 share/doc/scrot/AUTHORS
 share/doc/scrot/ChangeLog
-share/doc/scrot/README
-share/doc/scrot/TODO
+share/doc/scrot/README.md
+share/doc/scrot/scrot.png

Reply via email to