doc: add the option to generate an uncompressed PDF

An uncompressed PDF is about twice as big, but if one is using an
external compression program (e.g. .pdf.xz) it compresses far better.
Use it for the RPM specfile.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2017-04-10 16:10:28 -07:00
parent c11e23004f
commit f13effec22
5 changed files with 29 additions and 11 deletions

View file

@ -344,7 +344,8 @@ strip:
# Abuse doc/Makefile.in to build nasmdoc.pdf only
docs:
cd doc && $(MAKE) /f Makefile.in srcdir=. top_srcdir=.. PERL=$(PERL) nasmdoc.pdf
cd doc && $(MAKE) /f Makefile.in srcdir=. top_srcdir=.. \
PERL=$(PERL) PDFOPT= nasmdoc.pdf
everything: all docs nsis

View file

@ -149,6 +149,14 @@ AC_CHECK_DECLS(strnlen)
dnl Check for missing types
AC_TYPE_UINTPTR_T
dnl Documentation: should we generate an uncompressed PDF? It is
dnl about twice as big, but it can be externally compressed (e.g. with xz)
dnl and becomes significantly smaller than the original.
PA_ARG_DISABLED([pdf-compression],
[generate an uncompressed documentation PDF],
[PDFOPT='-nocompress'])
AC_SUBST([PDFOPT])
dnl
dnl Check for supported gcc attributes; some compilers (e.g. Sun CC)
dnl support these, but don't define __GNUC__ as they don't support

View file

@ -23,15 +23,13 @@ TEXI2DVI = texi2dvi
TEXI2IPF = texi2ipf
IPFC = ipfc
ACRODIST = acrodist # Acrobat Distiller
PSTOPDF = pstopdf # BSD/MacOS X utility
PS2PDF = ps2pdf # Part of GhostScript
PDFOPT = @PDFOPT@
RM_F = rm -f
RM_RF = rm -rf
SRCS = nasmdoc.src inslist.src changes.src version.src
OUT = info html nasmdoc.txt nasmdoc.ps nasmdoc.pdf
OUT = info html nasmdoc.txt nasmdoc.pdf
.SUFFIXES: .pfa .ph
@ -68,8 +66,8 @@ nasmdoc.ps: nasmdoc.dip genps.pl afmmetrics.ph ttfmetrics.ph \
$(PERL) $(srcdir)/genps.pl -headps $(srcdir)/head.ps nasmdoc.dip \
> nasmdoc.ps
nasmdoc.pdf: nasmdoc.ps
$(PERL) pspdf.pl nasmdoc.ps nasmdoc.pdf
nasmdoc.pdf: nasmdoc.ps pspdf.pl
$(PERL) pspdf.pl $(PDFOPT) nasmdoc.ps nasmdoc.pdf
.PHONY: info
info: info/nasm.info

View file

@ -5,10 +5,21 @@
use strict;
my $compress = 1;
while ($ARGV[0] =~ /^-(.*)$/) {
my $opt = $1;
shift @ARGV;
if ($opt eq '-nocompress') {
$compress = 0;
}
}
my ($in, $out) = @ARGV;
if (!defined($out)) {
die "Usage: $0 infile outfile\n";
die "Usage: $0 [-nocompress] infile outfile\n";
}
# Remove output file
@ -20,8 +31,8 @@ exit 0 if ( !$r && -f $out );
# 2. ps2pdf (from Ghostscript)
my $r = system('ps2pdf', '-dOptimize=true', '-dEmbedAllFonts=true',
'-dUseFlateCompression=true',
$in, $out);
'-dCompressPages=' . ($compress ? 'true' : 'false'),
'-dUseFlateCompression=true', $in, $out);
exit 0 if ( !$r && -f $out );
# 3. pstopdf (BSD/MacOS X utility)

View file

@ -44,7 +44,7 @@ include linker, library manager, loader, and information dump.
%setup -q -n nasm-%{nasm_version}
%build
%configure
%configure --disable-pdf-compression
make %{?_smp_mflags} everything
%install