Theo Buehler wrote:
> rsadowski, I think the X11BASE patch is worth considering.
>
> > 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.
>
> Probably some confusion in terminology, but what does autoconf have to
> do with release tarballs?
Nothing in general. But scrot in the tarball comes with a configure
file. Scrot in the github archive does not and you need to generate it
with autoconf.
> > +GH_ACCOUNT = resurrecting-open-source-projects
> > +GH_PROJECT = scrot
> > +GH_TAGNAME = 1.6
>
> From Makefile.template:
>
> # /releases/ -> preferred. ignore GH_*, just use MASTER_SITES and DISTNAME.
TIL.
> > ++ if(opt.exec) {
> > ++ if (pledge("cpath exec prot_exec rpath stdio wpath proc", NULL) ==
> > -1) {
>
> This update should remain decoupled from adding pledge, IMO.
>
> I'm generally skeptical of ports pledges that add prot_exec (except for
> the monsters where it's unavoidable). Can this be reduced to something
> sane by hoisting whatever needs it? Also, please sort the promises to
> canonical order (roughly the order in the manual, look at what is done
> in base).
I took this over from an update solene@ made even earlier. I liked the
idea and pulled it in.
Unfortunately prot_exec is needed. Scrot immediately aborts without it.
I think adding pledge in ports is fine as long as it is simple enough to
maintain. But I'm fine with leaving it out as well.
> > -@@ -148,11 +149,11 @@ name_thumbnail(char *name)
> > + new_title = malloc(length);
> > ++ memset(new_title, 2, length);
>
> This doesn't look right at all.
Huh? The original patch sais:
+ memset(new_title, 0, length);
I had to bring it over manually to scrot 1.6... must have misstyped somehow.
Thanks for spotting it!
My version is evolving into your version with patches ;-)
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 16 Aug 2021 16:18:15 -0000
@@ -2,25 +2,25 @@
COMMENT= commandline screen capture util
-DISTNAME= scrot-0.8
-REVISION = 4
-CATEGORIES= graphics
+V = 1.6
+DISTNAME = scrot-${V}
-HOMEPAGE= http://www.linuxbrit.co.uk/scrot/
+CATEGORIES = graphics
-# BSD
-PERMIT_PACKAGE= Yes
+HOMEPAGE =
https://github.com/resurrecting-open-source-projects/scrot
+
+MASTER_SITES =
https://github.com/resurrecting-open-source-projects/scrot/releases/download/${DISTNAME}/
+DISTFILES = ${DISTNAME}${EXTRACT_SUFX}
-WANTLIB= X11 Xext c freetype m z \
- giblib>=1 Imlib2>=1
+# BSD
+PERMIT_PACKAGE= Yes
-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/
.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 16 Aug 2021 16:18: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 16 Aug 2021 16:18: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 16 Aug 2021 16:18: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 16 Aug 2021 16:18: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, 0, 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 16 Aug 2021 16:18: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