svn commit: r357884 - in head/print/pstotext: . files
Jason E. Hale
jhale at FreeBSD.org
Sun Jun 15 14:03:27 UTC 2014
Author: jhale
Date: Sun Jun 15 14:03:26 2014
New Revision: 357884
URL: http://svnweb.freebsd.org/changeset/ports/357884
QAT: https://qat.redports.org/buildarchive/r357884/
Log:
- Support staging
- Rename generic-named patches to specific file names
- Define LICENSE using file previously installed with the DOCS option
- Remove DOCS option as it only installed aforementioned license file
- Bump PORTREVISION since OPTIONS changed
Added:
head/print/pstotext/files/patch-Makefile
- copied unchanged from r357872, head/print/pstotext/files/patch-aa
head/print/pstotext/files/patch-main.c
- copied unchanged from r357872, head/print/pstotext/files/patch-ab
Deleted:
head/print/pstotext/files/patch-aa
head/print/pstotext/files/patch-ab
Modified:
head/print/pstotext/Makefile
head/print/pstotext/files/patch-pstotext.1
Modified: head/print/pstotext/Makefile
==============================================================================
--- head/print/pstotext/Makefile Sun Jun 15 13:45:01 2014 (r357883)
+++ head/print/pstotext/Makefile Sun Jun 15 14:03:26 2014 (r357884)
@@ -3,7 +3,7 @@
PORTNAME= pstotext
PORTVERSION= 1.9
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= print
MASTER_SITES= http://ftp.gwdg.de/pub/%SUBDIR%/ \
http://ftp.sunet.se/pub/text-processing/postscript/interpreters/%SUBDIR%/ \
@@ -14,28 +14,26 @@ MASTER_SITE_SUBDIR= ghostscript/contrib
MAINTAINER= ports at FreeBSD.org
COMMENT= PostScript to Text converter
-USE_GHOSTSCRIPT_RUN= yes
-
-MAN1= pstotext.1
-PLIST_FILES= bin/pstotext
-PORTDOCS= copyright
+LICENSE= EULA
+LICENSE_NAME= End User License Agreement
+LICENSE_FILE= ${WRKSRC}/pstotext.txt
+LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
-NO_STAGE= yes
+USE_GHOSTSCRIPT_RUN= yes
-OPTIONS_DEFINE= DOCS
+SUB_LIST= LICENSE=${LICENSE} \
+ LICENSE_DIR=${_LICENSE_DIR}
-.include <bsd.port.options.mk>
+PLIST_FILES= bin/pstotext \
+ man/man1/pstotext.1.gz
post-patch:
- ${REINPLACE_CMD} -e 's;%%LOCALBASE%%;${LOCALBASE};g' ${WRKSRC}/main.c
- ${REINPLACE_CMD} -e 's;%%PREFIX%%;${PREFIX};g' ${WRKSRC}/pstotext.1
+ @${REINPLACE_CMD} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${WRKSRC}/main.c \
+ ${WRKSRC}/pstotext.1
do-install:
- ${INSTALL_PROGRAM} ${WRKSRC}/pstotext ${PREFIX}/bin
- ${INSTALL_MAN} ${WRKSRC}/pstotext.1 ${MAN1PREFIX}/man/man1
-.if ${PORT_OPTIONS:MDOCS}
- @${MKDIR} ${DOCSDIR}
- ${INSTALL_DATA} ${WRKSRC}/pstotext.txt ${DOCSDIR}/copyright
-.endif
+ ${INSTALL_PROGRAM} ${WRKSRC}/pstotext ${STAGEDIR}${PREFIX}/bin
+ ${INSTALL_MAN} ${WRKSRC}/pstotext.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
.include <bsd.port.mk>
Copied: head/print/pstotext/files/patch-Makefile (from r357872, head/print/pstotext/files/patch-aa)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/print/pstotext/files/patch-Makefile Sun Jun 15 14:03:26 2014 (r357884, copy of r357872, head/print/pstotext/files/patch-aa)
@@ -0,0 +1,33 @@
+--- Makefile.orig 2004-01-09 05:20:35.000000000 -0500
++++ Makefile 2008-07-14 12:26:19.832973217 -0400
+@@ -9,7 +9,6 @@
+ # commenting out the includes of ptotdll.h in ptotdll.c and main.c.
+ # PMcJ 6 Sep 96
+
+-CC=gcc
+ #CC=cc -std
+
+ BUNDLE = ocr.h rot270.h rot90.h
+@@ -17,18 +16,18 @@
+ all: pstotext
+
+ main.o: main.c ptotdll.h bundle.h ocr.h rot270.h rot90.h
+- $(CC) -c $*.c
++ $(CC) ${CFLAGS} -c $*.c
+
+ ptotdll.o: ptotdll.c ptotdll.h
+- $(CC) -c $*.c
++ $(CC) ${CFLAGS} -c $*.c
+
+ pstotext: bundle.o main.o ptotdll.o
+- $(CC) -o pstotext main.o bundle.o ptotdll.o -lm
++ $(CC) ${CFLAGS} -o pstotext main.o bundle.o ptotdll.o -lm
+
+ .SUFFIXES: .ps
+
+ .c.o:
+- $(CC) -c $*.c
++ $(CC) ${CFLAGS} -c $*.c
+
+ # "Bundle" an Ascii file.
+ .ps.h:
Copied: head/print/pstotext/files/patch-main.c (from r357872, head/print/pstotext/files/patch-ab)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/print/pstotext/files/patch-main.c Sun Jun 15 14:03:26 2014 (r357884, copy of r357872, head/print/pstotext/files/patch-ab)
@@ -0,0 +1,135 @@
+--- main.c.orig 2008-07-14 11:41:51.368157158 -0400
++++ main.c 2008-07-14 12:07:36.524646879 -0400
+@@ -126,12 +126,14 @@
+ static int cleanup(void) {
+ int gsstatus, status = 0;
+ pstotextExit(instance);
+- if (gs!=NULL) {
+ #ifdef VMS
++ if (gs!=NULL) {
+ gsstatus = fclose(gs);
++ }
+ #else
+- gsstatus = pclose(gs);
++ waitpid(-1, &gsstatus, 0);
+ #endif
++ if (gsstatus) {
+ if (WIFEXITED(gsstatus)) {
+ if (WEXITSTATUS(gsstatus)!=0) status = 3;
+ else if (WIFSIGNALED(gsstatus)) status = 4;
+@@ -166,8 +168,13 @@
+
+ static int do_it(char *path) {
+ /* If "path" is NULL, then "stdin" should be processed. */
+- char *gs_cmdline;
+- char *input;
++ char *gs_argv[32];
++ int gs_argc=0;
++#ifdef DEBUG
++ int i;
++#endif
++ int fd[2];
++ pid_t p;
+ int status;
+ char norotate[] = "";
+ FILE *fileout;
+@@ -201,47 +208,31 @@
+ exit(1);
+ }
+
+- if (path==NULL) {
+- input = (char*)malloc(2);
+- if (input == NULL) {
+- fprintf(stderr,"No memory available\n");
+- cleanup();
+- exit(1);
+- }
+- strcpy(input, "-");
+- } else {
+- input = (char*)malloc(strlen(path) + 6);
+- if (input == NULL) {
+- fprintf(stderr,"No memory available\n");
+- cleanup();
+- exit(1);
+- }
+- strcpy(input, "-- '"); strcat(input, path); strcat(input, "'");
++ gs_argv[gs_argc++] = "gs";
++ gs_argv[gs_argc++] = "-r72";
++ gs_argv[gs_argc++] = "-dNODISPLAY";
++ gs_argv[gs_argc++] = "-dFIXEDMEDIA";
++ gs_argv[gs_argc++] = "-dDELAYBIND";
++ gs_argv[gs_argc++] = "-dWRITESYSTEMDICT";
++ if (!debug) {
++ gs_argv[gs_argc++] = "-q";
++ }
++ gs_argv[gs_argc++] = "-dNOPAUSE";
++ gs_argv[gs_argc++] = "-dSAFER";
++ if (rotate_path && strcmp(rotate_path, "")) {
++ gs_argv[gs_argc++] = rotate_path;
++ }
++ if (ocr_path && strcmp(ocr_path, "")) {
++ gs_argv[gs_argc++] = ocr_path;
++ }
++ if (path == NULL ) {
++ gs_argv[gs_argc++] = "-";
++ }
++ else {
++ gs_argv[gs_argc++] = "--";
++ gs_argv[gs_argc++] = path;
+ }
+-
+- gs_cmdline = (char*)malloc(strlen(gs_cmd)+strlen(rotate_path)+
+- strlen(ocr_path) + strlen(input) + 128);
+-
+- if (gs_cmdline == NULL) {
+- fprintf(stderr, "No memory available\n");
+- cleanup();
+- exit(1);
+- }
+-
+- sprintf(
+- gs_cmdline,
+-#ifdef VMS
+- "%s -r72 \"-dNODISPLAY\" \"-dFIXEDMEDIA\" \"-dDELAYBIND\" \"-dWRITESYSTEMDICT\" %s \"-dNOPAUSE\" %s %s %s",
+-#else
+- "%s -r72 -dNODISPLAY -dFIXEDMEDIA -dDELAYBIND -dWRITESYSTEMDICT %s -dNOPAUSE %s %s %s",
+-#endif
+- gs_cmd,
+- (debug ? "" : "-q"),
+- rotate_path,
+- ocr_path,
+- input
+- );
+- if (debug) fprintf(stderr, "%s\n", gs_cmdline);
++ gs_argv[gs_argc++] = NULL;
+ #ifdef VMS
+ cmdfile = tempnam("SYS$SCRATCH:","PS2TGS");
+ gsoutfile = tempnam("SYS$SCRATCH:","GSRES");
+@@ -259,8 +250,25 @@
+ exit(1);
+ }
+ #else
+- gs = popen(gs_cmdline, "r");
+- if (gs==0) {perror(cmd); exit(1);}
++ if (pipe(fd)) {
++ perror("pipe failed: "); exit(1);
++ };
++ p = fork();
++ if (p == -1) {
++ perror("fork failed: "); exit(1);
++ }
++ if (p == 0) { /* child */
++ close(fd[0]);
++ dup2(fd[1], 1); /* Redirect stdout into pipe to parent */
++ execvp("%%LOCALBASE%%/bin/gs", gs_argv);
++ perror("execvp: "); status=cleanup(); exit(1);
++ } else { /* parent */
++ close(fd[1]);
++ gs = fdopen(fd[0], "r");
++ if (gs == NULL) {
++ perror("fdopen: "); status=cleanup(); exit(1);
++ }
++ }
+ #endif
+ status = pstotextInit(&instance);
+ if (status!=0) {
Modified: head/print/pstotext/files/patch-pstotext.1
==============================================================================
--- head/print/pstotext/files/patch-pstotext.1 Sun Jun 15 13:45:01 2014 (r357883)
+++ head/print/pstotext/files/patch-pstotext.1 Sun Jun 15 14:03:26 2014 (r357884)
@@ -5,7 +5,7 @@
Distributed only by permission.
.br
-See file pstotext.txt for details.
-+See file %%PREFIX%%/share/doc/pstotext/copyright for details.
++See file %%LICENSE_DIR%%/%%LICENSE%% for details.
.br
.BR
.PP
More information about the svn-ports-all
mailing list