0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00

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 # Abuse doc/Makefile.in to build nasmdoc.pdf only
docs: 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 everything: all docs nsis

View File

@@ -149,6 +149,14 @@ AC_CHECK_DECLS(strnlen)
dnl Check for missing types dnl Check for missing types
AC_TYPE_UINTPTR_T 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
dnl Check for supported gcc attributes; some compilers (e.g. Sun CC) 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 dnl support these, but don't define __GNUC__ as they don't support

View File

@@ -23,15 +23,13 @@ TEXI2DVI = texi2dvi
TEXI2IPF = texi2ipf TEXI2IPF = texi2ipf
IPFC = ipfc IPFC = ipfc
ACRODIST = acrodist # Acrobat Distiller PDFOPT = @PDFOPT@
PSTOPDF = pstopdf # BSD/MacOS X utility
PS2PDF = ps2pdf # Part of GhostScript
RM_F = rm -f RM_F = rm -f
RM_RF = rm -rf RM_RF = rm -rf
SRCS = nasmdoc.src inslist.src changes.src version.src 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 .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 \ $(PERL) $(srcdir)/genps.pl -headps $(srcdir)/head.ps nasmdoc.dip \
> nasmdoc.ps > nasmdoc.ps
nasmdoc.pdf: nasmdoc.ps nasmdoc.pdf: nasmdoc.ps pspdf.pl
$(PERL) pspdf.pl nasmdoc.ps nasmdoc.pdf $(PERL) pspdf.pl $(PDFOPT) nasmdoc.ps nasmdoc.pdf
.PHONY: info .PHONY: info
info: info/nasm.info info: info/nasm.info

View File

@@ -5,10 +5,21 @@
use strict; use strict;
my $compress = 1;
while ($ARGV[0] =~ /^-(.*)$/) {
my $opt = $1;
shift @ARGV;
if ($opt eq '-nocompress') {
$compress = 0;
}
}
my ($in, $out) = @ARGV; my ($in, $out) = @ARGV;
if (!defined($out)) { if (!defined($out)) {
die "Usage: $0 infile outfile\n"; die "Usage: $0 [-nocompress] infile outfile\n";
} }
# Remove output file # Remove output file
@@ -20,8 +31,8 @@ exit 0 if ( !$r && -f $out );
# 2. ps2pdf (from Ghostscript) # 2. ps2pdf (from Ghostscript)
my $r = system('ps2pdf', '-dOptimize=true', '-dEmbedAllFonts=true', my $r = system('ps2pdf', '-dOptimize=true', '-dEmbedAllFonts=true',
'-dUseFlateCompression=true', '-dCompressPages=' . ($compress ? 'true' : 'false'),
$in, $out); '-dUseFlateCompression=true', $in, $out);
exit 0 if ( !$r && -f $out ); exit 0 if ( !$r && -f $out );
# 3. pstopdf (BSD/MacOS X utility) # 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} %setup -q -n nasm-%{nasm_version}
%build %build
%configure %configure --disable-pdf-compression
make %{?_smp_mflags} everything make %{?_smp_mflags} everything
%install %install