diff --git a/print/html2ps/Makefile b/print/html2ps/Makefile
index ca64b97ef1af..cd88412a6a6c 100644
--- a/print/html2ps/Makefile
+++ b/print/html2ps/Makefile
@@ -1,49 +1,49 @@
PORTNAME= html2ps
DISTVERSION= 1.0b7
-PORTREVISION= 5
+PORTREVISION= 6
PORTEPOCH= 1
CATEGORIES= print www perl5
MASTER_SITES= LOCAL/hrs
MAINTAINER= hrs@FreeBSD.org
COMMENT= HTML to PostScript converter
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
RUN_DEPENDS= p5-libwww>=0:www/p5-libwww \
weblint++:www/weblint++ \
paperconf:print/libpaper
NO_BUILD= yes
USES= ghostscript:run magick:6,run perl5
CONFLICTS_INSTALL= p5-DocSet # bin/html2ps
SUB_FILES= html2psrc
PLIST_FILES= bin/html2ps \
etc/html2psrc \
man/man1/html2ps.1.gz \
man/man5/html2psrc.5.gz \
${DATADIR_REL}/html2ps.html \
${DATADIR_REL}/hyphen.tex
post-patch:
@${REINPLACE_CMD} -e \
's|exec perl|exec ${PERL}| ; \
s|%%LOCALBASE%%|${LOCALBASE}| ; \
s|%%PREFIX%%|${PREFIX}| ; \
s|%%DATADIR%%|${DATADIR}|' \
${WRKSRC}/html2ps
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/html2ps ${STAGEDIR}${PREFIX}/bin
${INSTALL_DATA} ${WRKDIR}/html2psrc ${STAGEDIR}${PREFIX}/etc
${INSTALL_MAN} ${WRKSRC}/html2ps.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
${INSTALL_MAN} ${WRKSRC}/html2psrc.5 ${STAGEDIR}${MAN5PREFIX}/man/man5
@${MKDIR} ${STAGEDIR}${DATADIR}
${INSTALL_DATA} ${WRKSRC}/html2ps.html ${STAGEDIR}${DATADIR}
${INSTALL_DATA} ${WRKSRC}/hyphen.tex ${STAGEDIR}${DATADIR}
.include
diff --git a/print/html2ps/files/patch-html2ps b/print/html2ps/files/patch-html2ps
index 84c80ddf321f..c1d7f38df050 100644
--- a/print/html2ps/files/patch-html2ps
+++ b/print/html2ps/files/patch-html2ps
@@ -1,63 +1,75 @@
--- html2ps.orig 2010-05-07 11:22:12 UTC
+++ html2ps
-@@ -26,8 +26,9 @@ eval 'exec perl -S $0 "$@"'
+@@ -26,9 +26,12 @@ eval 'exec perl -S $0 "$@"'
# Set the name of the global configuration file. See the installation notes
# and manual page for more details on configuration files.
-$globrc='/it/sw/share/www/lib/html2ps/html2psrc';
-$ug='/it/sw/share/www/lib/html2ps/html2ps.html';
++use File::Temp qw/tempfile/;
+
+$LIBPAPER=1;
+$globrc='%%PREFIX%%/etc/html2psrc';
+$ug='%%DATADIR%%/html2ps.html';
-
++
$conf=<<'EOR';
@html2ps {
-@@ -46,7 +47,7 @@ $conf=<<'EOR';
+ package {
+@@ -46,7 +49,7 @@ $conf=<<'EOR';
path: "";
}
paper {
- type: A4;
+ type: libpaper;
height: "";
width: "";
}
-@@ -613,6 +614,23 @@ for (0..10) {
+@@ -495,7 +498,7 @@ die "Ghostscript is required to generate DSC PostScrip
+ if($opt_D && !$package{'Ghostscript'});
+ die "Ghostscript is required to generate cross references\n"
+ if($opt_R && !$package{'Ghostscript'});
+-$tmpname=$posix?POSIX::tmpnam():"h2p_$$";
++$tmpname = tempfile();
+ ($scr=$tmpname)=~/\w+$/;
+ $tempdir=$`;
+
+@@ -613,6 +616,23 @@ for (0..10) {
$height{"b$_"}=int($temp*2**(1/2)*1000+.5)/10;
}
if(!$pagew || !$pageh) {
+ if ($LIBPAPER) {
+ my $env_com;
+ if ("\L$paper{'type'}" ne 'libpaper') {
+ $env_com = "/usr/bin/env PAPERSIZE=\"$paper{'type'}\"";
+ }
+ my $_w = `$env_com /usr/local/bin/paperconf -wc`;
+ my $_h = `$env_com /usr/local/bin/paperconf -hc`;
+ my $_n = `$env_com /usr/local/bin/paperconf -n`;
+ if ($_w ne '' and $_h ne '') {
+ $paper{'width'} = $_w;
+ $paper{'height'} = $_h;
+ $paper{'type'} = $_n;
+ ($pagew,$pageh)=($paper{'width'},$paper{'height'});
+ } else {
+ &dbg("Unknown paper type: $paper{'type'}\n");
+ }
+ } else { # !LIBPAPER
if($width{"\L$paper{'type'}"}) {
$paper{'width'}=$width{"\L$paper{'type'}"} if(!defined $paper{'width'});
$paper{'height'}=$height{"\L$paper{'type'}"} if(!defined $paper{'height'});
-@@ -620,6 +638,7 @@ if(!$pagew || !$pageh) {
+@@ -620,6 +640,7 @@ if(!$pagew || !$pageh) {
} elsif($paper{'type'}) {
&dbg("Unknown paper type: $paper{'type'}\n");
}
+ } # LIBPAPER
}
if($opt_L) {
$wl=$pageh-$mll-$mrl;
-@@ -3405,7 +3424,6 @@ sub Getopts {
+@@ -3405,7 +3426,6 @@ sub Getopts {
local($optlist)=@_;
local(@args,$_,$opt,$opts,$rest,$olist,$plist,$found,@popts);
local($errs)=0;
- local($[)=0;
@args=split( /\|/, $optlist );
for $opt (@args) {
if(substr($opt,-1,1) ne ':') {$olist.=$opt}