diff --git a/share/misc/epsgeom b/share/misc/epsgeom index cf90d361e4..2db43fc549 100644 --- a/share/misc/epsgeom +++ b/share/misc/epsgeom @@ -1,102 +1,102 @@ #!/usr/bin/perl -w # $FreeBSD$ # # epsgeom - extract geometry from a EPS file. # # Copyright (C) 2004 The FreeBSD Project. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# +# # THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # my $x; my $y; my $width; my $height; my $gx; my $gy; if (@ARGV != 4) { die "Error: invalid arguments.\n"; } my $mode = shift @ARGV; my $hres = shift @ARGV; my $vres = shift @ARGV; my $file = shift @ARGV; my $realfile = `realpath ${file}`; chomp $realfile; open IN, "<$realfile" or die "Error: cannot open $realfile.\n"; while() { last if (($x,$y,$width,$height) = /^%%BoundingBox:\s+([-\d]+)\s+([-\d]+)\s+([-\d]+)\s+([-\d]+)/); #print STDERR "DEBUG: $_"; } close IN; if (not defined($x)) { die "Error: no BoundingBox found.\n"; } $width -= $x; $height -= $y; # (int)(((double)hres * (double)width / 72.0) + 0.5), $gx = $hres * $width / 72.0 + 0.5; # (int)(((double)vres * (double)height / 72.0) + 0.5), $gy = $vres * $height / 72.0 + 0.5; my %replace = ( '@X@' => int $x, '@Y@' => int $y, '@MX@' => int -$x, '@MY@' => int -$y, '@WIDTH@' => int $width, '@MWIDTH@' => int -$width, '@HEIGHT@' => int $height, '@MHEIGHT@' => int -$height, '@ANGLE@' => int 0, '@INPUT@' => $realfile, ); if ($mode eq "-replace") { foreach my $i (keys %replace) { printf "-e s,%s,%s,g ", $i, $replace{$i}; } } elsif ($mode eq "-offset") { #print STDERR "DEBUG: (int -$x), $y\n"; printf "<< /PageOffset [%d %d] >> setpagedevice\n", (int -$x), $y; open IN, "<$realfile" or die "Error: cannot open $realfile.\n"; print while(); close IN; print "\n"; print "showpage\n"; } elsif ($mode eq "-geom") { #print STDERR "DEBUG: $x,$y,$width,$height\n"; printf "%dx%d", $gx, $gy; } else { die "Error: invalid mode specified.\n"; } __END__ diff --git a/share/mk/doc.images.mk b/share/mk/doc.images.mk index b40e08bb44..c0378a6d08 100644 --- a/share/mk/doc.images.mk +++ b/share/mk/doc.images.mk @@ -1,305 +1,305 @@ # # $FreeBSD$ # # This include file handles image processing. # # There are two types of images that must be handled: # # 1. Images from the library directory, that are shared across multiple # documents. # # 2. Images that are document specific. # -# For library images this file ensures that they are copied in to the +# For library images this file ensures that they are copied in to the # documents directory so that they can be reference properly. # # For library images *and* document specific images, this file ensures # that the images are converted from their repository format to the # correct output format. # # # Using document specific images # ------------------------------ # # The images that each document provides *from the repository* are listed in # the IMAGES variable. # # We then need to build a list of images that must be generated from these. # This is to handle the case where a document might include some images as # bitmaps and some as vector images in the repository, but where, depending # on the output format, you want all the images in one format or another. # # This list of generated images can then be cleaned in the clean target # later # # This is the same for each format. To use IMAGES_GEN_PNG as an example, # the substitution means "First match, using M, all the components of # ${IMAGES} that match the '*.eps' regexp. Then, search/replace the .eps # in the matching filenames with .png. Finally, stick the results in the # ${IMAGES_GEN_PNG} variable." ${IMAGES_GEN_PNG} then contains the names # of all the .eps images listed, but with a .png extension. This is the # list of files we need to generate if we need PNG format images. # # The PDF generation, when it's looking for file 'foo', will first try # foo.pdf, and it will try foo.png. There's no point converting PNG files # to PDF, as they'll be used directly. However, we can convert the EPS files # to PDF, and hopefully get better quality. # IMAGES_EN?= LOCAL_IMAGES_EN?= # # The name of the directory that contains all the library images for this # language and encoding # IMAGES_EN_DIR?= ${.CURDIR}/../../../share/images .for _curimage in ${IMAGES_EN} LOCAL_IMAGES_EN += ${IMAGES_EN_DIR}/${DOC}s/${.CURDIR:T}/${_curimage} .endfor _IMAGES_PNG= ${IMAGES:M*.png} _IMAGES_PNG+= ${LOCAL_IMAGES_EN:M*.png} _IMAGES_EPS= ${IMAGES:M*.eps} _IMAGES_EPS+= ${LOCAL_IMAGES_EN:M*.eps} _IMAGES_SCR= ${IMAGES:M*.scr} _IMAGES_SCR+= ${LOCAL_IMAGES_EN:M*.scr} _IMAGES_TXT= ${IMAGES:M*.txt} _IMAGES_TXT+= ${LOCAL_IMAGES_EN:M*.txt} _IMAGES_PIC= ${IMAGES:M*.pic} _IMAGES_PIC+= ${LOCAL_IMAGES_EN:M*.pic} IMAGES_GEN_PNG= ${_IMAGES_EPS:S/.eps$/.png/} IMAGES_GEN_EPS= ${_IMAGES_PNG:S/.png$/.eps/} IMAGES_GEN_PDF= ${_IMAGES_EPS:S/.eps$/.pdf/} IMAGES_SCR_PNG= ${_IMAGES_SCR:S/.scr$/.png/} IMAGES_SCR_EPS= ${_IMAGES_SCR:S/.scr$/.eps/} IMAGES_SCR_PDF= ${_IMAGES_SCR:S/.scr$/.pdf/} IMAGES_SCR_TXT= ${_IMAGES_SCR:S/.scr$/.txt/} IMAGES_PIC_PNG= ${_IMAGES_PIC:S/.pic$/.png/} IMAGES_PIC_EPS= ${_IMAGES_PIC:S/.pic$/.eps/} IMAGES_PIC_PDF= ${_IMAGES_PIC:S/.pic$/.pdf/} IMAGES_GEN_PDF+= ${IMAGES_PIC_PDF} ${IMAGES_SCR_PDF} CLEANFILES+= ${IMAGES_GEN_PNG} ${IMAGES_GEN_EPS} ${IMAGES_GEN_PDF} CLEANFILES+= ${IMAGES_SCR_PNG} ${IMAGES_SCR_EPS} ${IMAGES_SCR_TXT} CLEANFILES+= ${IMAGES_PIC_PNG} ${IMAGES_PIC_EPS} ${_IMAGES_PIC:S/.pic$/.ps/} IMAGES_PNG= ${_IMAGES_PNG} ${IMAGES_GEN_PNG} ${IMAGES_SCR_PNG} ${IMAGES_PIC_PNG} IMAGES_EPS= ${_IMAGES_EPS} ${IMAGES_GEN_EPS} ${IMAGES_SCR_EPS} ${IMAGES_PIC_EPS} IMAGES_TXT= ${_IMAGES_TXT} ${IMAGES_SCR_TXT} .if ${.OBJDIR} != ${.CURDIR} LOCAL_IMAGES= ${IMAGES:S|^|${.OBJDIR}/|} CLEANFILES+= ${LOCAL_IMAGES} .if !empty(_IMAGES_PNG) LOCAL_IMAGES_PNG= ${_IMAGES_PNG:S|^|${.OBJDIR}/|} .endif .if !empty(_IMAGES_EPS) LOCAL_IMAGES_EPS= ${_IMAGES_EPS:S|^|${.OBJDIR}/|} .endif .if !empty(_IMAGES_TXT) LOCAL_IMAGES_TXT= ${_IMAGES_TXT:S|^|${.OBJDIR}/|} .endif .else LOCAL_IMAGES= ${IMAGES} LOCAL_IMAGES_PNG= ${_IMAGES_PNG} LOCAL_IMAGES_EPS= ${_IMAGES_EPS} LOCAL_IMAGES_TXT= ${_IMAGES_TXT} .endif LOCAL_IMAGES_PNG+= ${IMAGES_GEN_PNG} ${IMAGES_SCR_PNG} ${IMAGES_PIC_PNG} LOCAL_IMAGES_EPS+= ${IMAGES_GEN_EPS} ${IMAGES_SCR_EPS} ${IMAGES_PIC_EPS} LOCAL_IMAGES_TXT+= ${IMAGES_SCR_TXT} # The default resolution eps2png (82) assumes a 640x480 monitor, and is too # low for the typical monitor in use today. The resolution of 100 looks # much better on these monitors without making the image too large for # a 640x480 monitor. EPS2PNM_RES?= 100 # We need to list ${_IMAGES_PNG} here since the images might be in a # shared image directory. IMAGES_PDF= ${IMAGES_GEN_PDF} ${_IMAGES_PNG} SCR2PNG?= ${PREFIX}/bin/scr2png SCR2PNGOPTS?= ${SCR2PNGFLAGS} SCR2TXT?= ${PREFIX}/bin/scr2txt SCR2TXTOPTS?= -l ${SCR2TXTFLAGS} SED?= /usr/bin/sed EPS2PNM?= ${PREFIX}/bin/gs EPS2PNMOPTS?= -q -dBATCH -dGraphicsAlphaBits=4 -dTextAlphaBits=4 \ -dEPSCrop -r${EPS2PNM_RES}x${EPS2PNM_RES} \ -dNOPAUSE -dSAFER -sDEVICE=pnm -sOutputFile=- # # epsgeom is a perl script for 1) extracting geometry information # from a .eps file and 2) arrange it for ghostscript's pnm driver. # EPSGEOM?= ${PERL} ${DOC_PREFIX}/share/misc/epsgeom EPSGEOMOPTS?= ${EPS2PNM_RES} ${EPS2PNM_RES} PNMTOPNG?= ${PREFIX}/bin/pnmtopng PNMTOPNGOPTS?= ${PNGTOPNGFLAGS} PNGTOPNM?= ${PREFIX}/bin/pngtopnm PNGTOPNMOPTS?= ${PNGTOPNMFLAGS} PPMTOPGM?= ${PREFIX}/bin/ppmtopgm PPMTOPGMOPTS?= ${PPMTOPGMFLAGS} PNMTOPS?= ${PREFIX}/bin/pnmtops PNMTOPSOPTS?= -noturn ${PNMTOPSFLAGS} EPSTOPDF?= ${PREFIX}/bin/epstopdf EPSTOPDFOPTS?= ${EPSTOPDFFLAGS} # -PIC2PS?= ${GROFF} -p -S -Wall -mtty-char -man +PIC2PS?= ${GROFF} -p -S -Wall -mtty-char -man # PS2EPS?= ${PREFIX}/bin/gs PS2EPSOPTS?= -q -dNOPAUSE -dSAFER -dDELAYSAFER \ -sPAPERSIZE=letter -r72 -sDEVICE=bit \ -sOutputFile=/dev/null ${PS2EPSFLAGS} ps2epsi.ps # # Use suffix rules to convert .scr files to other formats .SUFFIXES: .scr .pic .png .ps .eps .txt .scr.png: ${SCR2PNG} ${SCR2PNGOPTS} < ${.IMPSRC} > ${.TARGET} ## If we want grayscale, convert with ppmtopgm before running through pnmtops .if defined(GREYSCALE_IMAGES) .scr.eps: ${SCR2PNG} ${SCR2PNGOPTS} < ${.ALLSRC} | \ ${PNGTOPNM} ${PNGTOPNMOPTS} | \ ${PPMTOPGM} ${PPMTOPGMOPTS} | \ ${PNMTOPS} ${PNMTOPSOPTS} > ${.TARGET} .else .scr.eps: ${SCR2PNG} ${SCR2PNGOPTS} < ${.ALLSRC} | \ ${PNGTOPNM} ${PNGTOPNMOPTS} | \ ${PNMTOPS} ${PNMTOPSOPTS} > ${.TARGET} .endif # The .txt files need to have any trailing spaces trimmed from # each line, which is why the output from ${SCR2TXT} is run # through ${SED} .scr.txt: ${SCR2TXT} ${SCR2TXTOPTS} < ${.IMPSRC} | ${SED} -E -e 's/ +$$//' > ${.TARGET} .pic.png: ${.TARGET:S/.png$/.eps/} ${EPSGEOM} -offset ${EPSGEOMOPTS} ${.TARGET:S/.png$/.eps/} \ | ${EPS2PNM} ${EPS2PNMOPTS} \ -g`${EPSGEOM} -geom ${EPSGEOMOPTS} ${.TARGET:S/.png$/.eps/}` - \ | ${PNMTOPNG} > ${.TARGET} .pic.ps: ${PIC2PS} ${.ALLSRC} > ${.TARGET} # When ghostscript built with A4=yes is used, ps2epsi's paper size also # becomes the A4 size. However, the ps2epsi fails to convert grops(1) # outputs, which is the letter size, and we cannot change ps2epsi's paper size # from the command line. So ps->eps suffix rule is defined. In the rule, # gs(1) is used to generate the bitmap preview and the size of the # bounding box. .ps.eps: ${SETENV} outfile=${.TARGET} ${PS2EPS} ${PS2EPSOPTS} < ${.ALLSRC} 1>&2 (echo "save countdictstack mark newpath /showpage {} def /setpagedevice {pop} def";\ echo "%%EndProlog";\ echo "%%Page: 1 1";\ echo "%%BeginDocument: ${.ALLSRC}";\ ) >> ${.TARGET} ${SED} -e '/^%%BeginPreview:/,/^%%EndPreview[^!-~]*$$/d' \ -e '/^%!PS-Adobe/d' \ -e '/^%%[A-Za-z][A-Za-z]*[^!-~]*$$/d'\ -e '/^%%[A-Za-z][A-Za-z]*: /d' < ${.ALLSRC} >> ${.TARGET} (echo "%%EndDocument";\ echo "%%Trailer";\ echo "cleartomark countdictstack exch sub { end } repeat restore";\ echo "%%EOF";\ ) >> ${.TARGET} # We can't use suffix rules to generate the rules to convert EPS to PNG and # PNG to EPS. This is because a .png file can depend on a .eps file, and # vice versa, leading to a loop in the dependency graph. Instead, build # the targets on the fly. .for _curimage in ${IMAGES_GEN_PNG} ${_curimage}: ${_curimage:S/.png$/.eps/} ${EPSGEOM} -offset ${EPSGEOMOPTS} ${.ALLSRC} \ | ${EPS2PNM} ${EPS2PNMOPTS} \ -g`${EPSGEOM} -geom ${EPSGEOMOPTS} ${.ALLSRC}` - \ | ${PNMTOPNG} > ${.TARGET} .endfor .for _curimage in ${IMAGES_GEN_EPS} ${_curimage}: ${_curimage:S/.eps$/.png/} ${PNGTOPNM} ${PNGTOPNMOPTS} ${.ALLSRC} | \ ${PNMTOPS} ${PNMTOPSOPTS} > ${.TARGET} .endfor .for _curimage in ${IMAGES_GEN_PDF} ${_curimage}: ${_curimage:S/.pdf$/.eps/} ${EPSTOPDF} ${EPSTOPDFOPTS} --outfile=${.TARGET} ${.ALLSRC} .endfor .if ${.OBJDIR} != ${.CURDIR} .for _curimage in ${IMAGES} ${.OBJDIR}/${_curimage}: ${_curimage} @${CP} -p ${.ALLSRC} ${.TARGET} .endfor .endif # # Using library images # -------------------- # # Each document that wants to use one or more library images has to -# list them in the IMAGES_LIB variable. For example, a document that wants +# list them in the IMAGES_LIB variable. For example, a document that wants # to use callouts 1 thru 4 has to list # # IMAGES_LIB= callouts/1.png callouts/2.png callouts/3.png callouts/4.png # # in the controlling Makefile. # # This code ensures they exist in the current directory, and copies them in # as necessary. # IMAGES_LIB?= LOCAL_IMAGES_LIB ?= # # The name of the directory that contains all the library images for this # language and encoding # IMAGES_LIB_DIR?= ${.CURDIR}/../../../share/images # # The name of the directory *in* the document directory where files and # directory hierarchies should be copied to. "images" is too generic, and -# might clash with local document images, so use "imagelib" by default +# might clash with local document images, so use "imagelib" by default # instead. If you redefine this then you must also update the # %callout-graphics-path% variable in the .dsl file. # LOCAL_IMAGES_LIB_DIR?= imagelib CLEANDIRS+= ${LOCAL_IMAGES_LIB_DIR} # # Create a target for each image used from the library. This target just -# ensures that each image required is copied from its location in +# ensures that each image required is copied from its location in # ${IMAGES_LIB_DIR} to the same place in ${LOCAL_IMAGES_LIB_DIR}. # .for _curimage in ${IMAGES_LIB} LOCAL_IMAGES_LIB += ${LOCAL_IMAGES_LIB_DIR}/${_curimage} ${LOCAL_IMAGES_LIB_DIR}/${_curimage}: ${IMAGES_LIB_DIR}/${_curimage} @[ -d ${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ] || \ ${MKDIR} -p ${LOCAL_IMAGES_LIB_DIR}/${_curimage:H} ${CP} -p ${IMAGES_LIB_DIR}/${_curimage} \ ${LOCAL_IMAGES_LIB_DIR}/${_curimage} .endfor .if !empty(IMAGES_LIB) CLEANFILES+= ${IMAGES_LIB:S|^|${LOCAL_IMAGES_LIB_DIR}/|} .endif diff --git a/share/mk/doc.project.mk b/share/mk/doc.project.mk index f222f53d46..a9f4032397 100644 --- a/share/mk/doc.project.mk +++ b/share/mk/doc.project.mk @@ -1,116 +1,116 @@ # # $FreeBSD$ # -# This include file is the FreeBSD Documentation Project +# This include file is the FreeBSD Documentation Project # co-ordination make file. # # This file includes the other makefiles, which contain enough # knowledge to perform their duties without the system make files. # # ------------------------------------------------------------------------ # # Document-specific variables: # # DOC This _must_ be set if there is a document to # build. It should be without prefix. # # DOCFORMAT Format of the document. Defaults to docbook. # docbook is also the only option currently. # # MAINTAINER This denotes who is responsible for maintaining # this section of the project. If unset, set to # doc@FreeBSD.org # # ------------------------------------------------------------------------ # # User-modifiable variables: # # PREFIX Standard path to document-building applications # installed to serve the documentation build # process, usually by installing the docproj port # or package. Default is ${LOCALBASE} or /usr/local # # NOINCLUDEMK Whether to include the standard BSD make files, # or just to emulate them poorly. Set this if you # aren't on FreeBSD, or a compatible sibling. By # default is not set. # # ------------------------------------------------------------------------ # # Make files included: # # doc.install.mk Installation specific information, including # ownership and permissions. # # doc.subdir.mk Subdirectory related configuration, including # handling "obj" builds. # # doc.common.mk targets and variables commonly used in doc/ and # www/ tree. # # DOCFORMAT-specific make files, like: # # doc.docbook.mk Building and installing docbook documentation. # Currently the only method. # # Document-specific defaults DOCFORMAT?= docbook MAINTAINER?= doc@FreeBSD.org -# Master list of known target formats. The doc..mk files implement +# Master list of known target formats. The doc..mk files implement # the code to convert from their source format to one or more of these target # formats ALL_FORMATS= html html.tar html-split html-split.tar txt rtf ps pdf tex dvi tar pdb # User-modifiable LOCALBASE?= /usr/local PREFIX?= ${LOCALBASE} PRI_LANG?= en_US.ISO8859-1 CP?= /bin/cp CAT?= /bin/cat ECHO_CMD?= echo LN?= /bin/ln MKDIR?= /bin/mkdir RM?= /bin/rm MV?= /bin/mv HTML2TXT?= ${PREFIX}/bin/links HTML2TXTOPTS?= -dump ${HTML2TXTFLAGS} ISPELL?= ispell ISPELLOPTS?= -l -p /usr/share/dict/freebsd ${ISPELLFLAGS} .if exists(/usr/bin/perl) PERL?= /usr/bin/perl .elif exists(/usr/local/bin/perl) PERL?= /usr/local/bin/perl .else PERL?= perl .endif REALPATH?= /bin/realpath SETENV?= /usr/bin/env # Image processing (contains code used by the doc..mk files, so must # be listed first). .include "doc.images.mk" # targets and variables commonly used in doc/ and www/ tree. .include "doc.common.mk" # Ownership information. .include "doc.install.mk" # Format-specific configuration .if defined(DOC) .if ${DOCFORMAT} == "docbook" .include "doc.docbook.mk" .endif .if ${DOCFORMAT} == "html" .include "doc.html.mk" .endif .endif # Subdirectory glue. .include "doc.subdir.mk"