diff options
author | Felippe de Meirelles Motta <lippe@FreeBSD.org> | 2008-09-02 19:06:45 +0000 |
---|---|---|
committer | Felippe de Meirelles Motta <lippe@FreeBSD.org> | 2008-09-02 19:06:45 +0000 |
commit | 71c95c84ef488285a0dd96b555488c3ed9c9174c (patch) | |
tree | cd76bb26e0be2dc78aaed26fc80c2da0b50e53c8 /print/pstotext | |
parent | daeb996df44fc08d774285931705a8116d7d91b7 (diff) | |
download | ports-71c95c84ef488285a0dd96b555488c3ed9c9174c.tar.gz ports-71c95c84ef488285a0dd96b555488c3ed9c9174c.zip |
Notes
Diffstat (limited to 'print/pstotext')
-rw-r--r-- | print/pstotext/Makefile | 18 | ||||
-rw-r--r-- | print/pstotext/distinfo | 6 | ||||
-rw-r--r-- | print/pstotext/files/patch-aa | 19 | ||||
-rw-r--r-- | print/pstotext/files/patch-ab | 150 | ||||
-rw-r--r-- | print/pstotext/files/patch-pstotext.1 | 11 | ||||
-rw-r--r-- | print/pstotext/pkg-descr | 16 |
6 files changed, 167 insertions, 53 deletions
diff --git a/print/pstotext/Makefile b/print/pstotext/Makefile index f81d022f1f7a..d060dd8d0aea 100644 --- a/print/pstotext/Makefile +++ b/print/pstotext/Makefile @@ -6,12 +6,9 @@ # PORTNAME= pstotext -PORTVERSION= 1.8g -PORTREVISION= 1 +PORTVERSION= 1.9 CATEGORIES= print -MASTER_SITES= http://www.breuninger.org/files/distfiles/ -DISTNAME= ${PORTNAME} -EXTRACT_SUFX= .tar.Z +MASTER_SITES= http://mirror.cs.wisc.edu/pub/mirrors/ghost/contrib/ MAINTAINER= ob@breuninger.org COMMENT= A PostScript to Text converter @@ -20,9 +17,18 @@ USE_GHOSTSCRIPT_RUN= yes MAN1= pstotext.1 PLIST_FILES= bin/pstotext +PORTDOCS= copyright + +post-patch: + ${REINPLACE_CMD} -e 's;%%LOCALBASE%%;${LOCALBASE};g' ${WRKSRC}/main.c + ${REINPLACE_CMD} -e 's;%%PREFIX%%;${PREFIX};g' ${WRKSRC}/pstotext.1 do-install: ${INSTALL_PROGRAM} ${WRKSRC}/pstotext ${PREFIX}/bin - ${INSTALL_MAN} ${WRKSRC}/pstotext.1 ${PREFIX}/man/man1 + ${INSTALL_MAN} ${WRKSRC}/pstotext.1 ${MAN1PREFIX}/man/man1 +.ifndef(NOPORTDOCS) + ${MKDIR} ${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/pstotext.txt ${DOCSDIR}/copyright +.endif .include <bsd.port.mk> diff --git a/print/pstotext/distinfo b/print/pstotext/distinfo index e87711562034..d8f4694e9cd0 100644 --- a/print/pstotext/distinfo +++ b/print/pstotext/distinfo @@ -1,3 +1,3 @@ -MD5 (pstotext.tar.Z) = 1be0be028ccc85be1bf55d7e90976b18 -SHA256 (pstotext.tar.Z) = 139ff4819bd067cb185c5d65d97b2ce62fb8109487a44e4b5450916179363652 -SIZE (pstotext.tar.Z) = 58743 +MD5 (pstotext-1.9.tar.gz) = 64576e8a10ff5514e285d98b3898ae78 +SHA256 (pstotext-1.9.tar.gz) = cfe0a251d0d43982a7d3bdf1d1670c854432739d00cb593c9beaca4b2cc36c27 +SIZE (pstotext-1.9.tar.gz) = 37461 diff --git a/print/pstotext/files/patch-aa b/print/pstotext/files/patch-aa index afe9e3eb9902..3da057cab9be 100644 --- a/print/pstotext/files/patch-aa +++ b/print/pstotext/files/patch-aa @@ -1,29 +1,28 @@ ---- Makefile.orig Wed Oct 28 08:45:58 1998 -+++ Makefile Tue Feb 1 23:21:29 2000 -@@ -8,7 +8,8 @@ +--- 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?=gcc -+CFLAGS?=-O2 #CC=cc -std BUNDLE = ocr.h rot270.h rot90.h -@@ -16,10 +17,10 @@ +@@ -17,18 +16,18 @@ all: pstotext - main.o: ptotdll.h bundle.h ocr.h rot270.h rot90.h + main.o: main.c ptotdll.h bundle.h ocr.h rot270.h rot90.h - $(CC) -c $*.c + $(CC) ${CFLAGS} -c $*.c - ptotdll.o: ptotdll.h + 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 -@@ -27,7 +28,7 @@ +- $(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: diff --git a/print/pstotext/files/patch-ab b/print/pstotext/files/patch-ab index 8594e9c85619..a208de3ce0b3 100644 --- a/print/pstotext/files/patch-ab +++ b/print/pstotext/files/patch-ab @@ -1,21 +1,135 @@ ---- main.c.orig Fri Oct 16 16:27:57 1998 -+++ main.c Tue Feb 1 23:29:34 2000 -@@ -90,13 +90,16 @@ - static char *make_temp(b) BUNDLE b; { - /* Return pathname of temporary file containing bundle "b". Caller - should unlink file (and, technically, free pathname). */ -+ int fd; - FILE *f; +--- 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 - char *path = tempnam("SYS$SCRATCH:", ".ps2t"); ++ if (gs!=NULL) { + gsstatus = fclose(gs); ++ } #else -- char *path = tempnam("/tmp", ",ps2t"); -+ char *path = strdup("/tmp/ps2tXXXXXXXXXX"); -+ if ((fd = mkstemp(path)) == NULL) -+ {perror(cmd); exit(1);} +- gsstatus = pclose(gs); ++ waitpid(-1, &gsstatus, 0); #endif -- f = fopen(path, "w"); -+ f = fdopen(fd, "w"); - if (f==NULL) {perror(cmd); exit(1);} - putbundle(b, f); - fclose(f); ++ 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) { diff --git a/print/pstotext/files/patch-pstotext.1 b/print/pstotext/files/patch-pstotext.1 new file mode 100644 index 000000000000..2f519cc4e870 --- /dev/null +++ b/print/pstotext/files/patch-pstotext.1 @@ -0,0 +1,11 @@ +--- pstotext.1.orig 2008-07-14 11:41:51.372153755 -0400 ++++ pstotext.1 2008-07-14 12:40:21.785198430 -0400 +@@ -128,7 +128,7 @@ + .br + Distributed only by permission. + .br +-See file pstotext.txt for details. ++See file %%PREFIX%%/share/doc/pstotext/copyright for details. + .br + .BR + .PP diff --git a/print/pstotext/pkg-descr b/print/pstotext/pkg-descr index ff3f83974a31..af301508f9e6 100644 --- a/print/pstotext/pkg-descr +++ b/print/pstotext/pkg-descr @@ -21,19 +21,3 @@ standard input. (PDF documents require random access, hence cannot be read from standard input.) You can use the -output option to specify an output file (remember to invoke it before the input file); otherwise pstotext writes to standard output. - -The option -cork is only relevant for PostScript files produced by dvips from -TeX or LaTeX documents; it tells pstotext to use the Cork encoding (known as T1 -in LaTeX) rather than the old TeX text encoding (known as OT1 in LaTeX). -Unfortunately files produced by dvips don't distinguish which font encodings -were used. - -The options -landscape and -landscapeOther should be used for documents that -must be rotated 90 degrees clockwise or counterclockwise, respectively, in -order to be readable. - -The options -debug and -bboxes are mostly of use for the maintainers of -pstotext. -debug shows Ghostscript output and error messages. -bboxes outputs -one word per line with bounding box information. - -WWW: http://www.research.digital.com/SRC/virtualpaper/pstotext.html |