deri pushed a commit to branch master
in repository groff.
commit 6198245eac8f51a17b222118b02102a9c2ea4519
Author: Deri James <[email protected]>
AuthorDate: Thu Jul 24 17:57:44 2025 +0100
Improve build logic.
* font/devpdf/util/BuildFoundries.pl: If any warnings issued
during run, exit code 2 at end of run. This will abort any
build. Change to Notice any information only messages.
Remove code which copied grops fonts to gropdf (Branden added
this to devpdf.am so is now unnecessary).
* src/devices/gropdf/gropdf.pl: Exit with code 2 if any
warnings issued during run (this will stop a 'make'). Report
a 'Notice' if duplicate font entries and 1 is incorrect.
Report path of download file in messages.
* src/devices/gropdf.1.man: Document exit status.
* contrib/mom/mom.am:
* doc/doc.am: -W flag no longer required
Continues fixing Savannah #67268.
---
ChangeLog | 20 ++++++++++++++++++++
contrib/mom/mom.am | 2 +-
doc/doc.am | 2 +-
font/devpdf/util/BuildFoundries.pl | 30 ++++++++----------------------
src/devices/gropdf/gropdf.1.man | 15 +++++++++++++++
src/devices/gropdf/gropdf.pl | 31 ++++++++++++++++++-------------
6 files changed, 63 insertions(+), 37 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 60b4b3c3e..0ddf6ce7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2025-07-24 Deri James <[email protected]>
+
+ * font/devpdf/util/BuildFoundries.pl: If any warnings issued
+ during run, exit code 2 at end of run. This will abort any
+ build. Change to Notice any information only messages.
+ Remove code which copied grops fonts to gropdf (Branden added
+ this to devpdf.am so is now unnecessary).
+
+ * src/devices/gropdf/gropdf.pl: Exit with code 2 if any
+ warnings issued during run (this will stop a 'make'). Report
+ a 'Notice' if duplicate font entries and 1 is incorrect.
+ Report path of download file in messages.
+
+ * src/devices/gropdf.1.man: Document exit status.
+
+ * contrib/mom/mom.am:
+ * doc/doc.am: -W flag no longer required
+
+ Continues fixing Savannah #67268.
+
2025-07-22 G. Branden Robinson <[email protected]>
* tmac/an.tmac ([initialization]):
diff --git a/contrib/mom/mom.am b/contrib/mom/mom.am
index e03d791aa..2c5de6fbc 100644
--- a/contrib/mom/mom.am
+++ b/contrib/mom/mom.am
@@ -27,7 +27,7 @@ MOMPDFMOM = \
GROFF_COMMAND_PREFIX= \
GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
$(PDFMOMBIN) $(FFLAG) $(MFLAG) -M$(mom_srcdir) -K utf8 -p -e -t \
- -wall -b -P -W
+ -wall -b
man7_MANS += contrib/mom/groff_mom.7
diff --git a/doc/doc.am b/doc/doc.am
index 6827c7ab9..7e13d0a1f 100644
--- a/doc/doc.am
+++ b/doc/doc.am
@@ -43,7 +43,7 @@ DOC_GROFF = \
DOC_PDFMOM = \
GROFF_COMMAND_PREFIX= \
GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
- $(PDFMOMBIN) $(MFLAG) $(FFLAG) -ww -b -P -W -P -d --roff
+ $(PDFMOMBIN) $(MFLAG) $(FFLAG) -ww -b --roff
# This image file is used by several documents in the groff source tree.
DOC_GNU_EPS = doc/gnu.eps
diff --git a/font/devpdf/util/BuildFoundries.pl
b/font/devpdf/util/BuildFoundries.pl
index e7a9b10c7..7d26bc931 100644
--- a/font/devpdf/util/BuildFoundries.pl
+++ b/font/devpdf/util/BuildFoundries.pl
@@ -42,6 +42,7 @@ chdir $where if $where ne '';
my (%flg,@downloadpreamble,%download);
my $GSpath=FindGSpath();
my $lct=0;
+my $xitcd=0;
my $foundry=''; # the default foundry
my $notFoundFont=0;
@@ -56,7 +57,7 @@ else
LoadFoundry("Foundry");
WriteDownload();
}
-exit 0;
+exit $xitcd;
@@ -89,7 +90,7 @@ sub LoadFoundry
if (lc($r[0]) eq 'foundry')
{
- Warn("\nThe path(s) used for
searching:\n".join(':',@{$foundrypath})."\n") if $notFoundFont;
+ Notice("\nThe path(s) used for
searching:\n".join(':',@{$foundrypath})."\n") if $notFoundFont;
$foundry=uc($r[1]);
$foundrypath=[];
push(@{$foundrypath},$dirURW) if $dirURW;
@@ -154,9 +155,7 @@ sub LoadFoundry
# Use afmtodit to create a groff font description file.
my $afmfile=LocateAF($foundrypath,$r[5]);
if (!$afmfile) {
- my $sub=\&Warn;
- $sub=\&Die if ($beStrict);
- &$sub("cannot locate AFM file for font '$gfont'");
+ Warn("cannot locate AFM file for font '$gfont'");
next;
}
my $psfont=RunAfmtodit($gfont,$afmfile,$r[2],$r[3],$r[4]);
@@ -182,7 +181,7 @@ sub LoadFoundry
}
close(F);
- Warn("\nThe path(s) used for searching:\n".join(':',@{$foundrypath})."\n")
if $notFoundFont;
+ Notice("\nThe path(s) used for
searching:\n".join(':',@{$foundrypath})."\n") if $notFoundFont;
}
sub RunAfmtodit
@@ -210,11 +209,11 @@ sub RunAfmtodit
$cmd.=" $flg{$f}";
}
- Notice("running \"$cmd $enc '$afmfile' $map $gfont\"");
system("$cmd $enc '$afmfile' $map $gfont");
if ($?)
{
+ Warn("failed running \"$cmd $enc '$afmfile' $map $gfont\"");
unlink $gfont;
return('');
}
@@ -386,21 +385,7 @@ sub UseGropsVersion
close(GF);
- if ($psfont)
- {
- if (open(GF,">$gfontbase"))
- {
- local $"='';
- print GF "@gf";
- close(GF);
- }
- else
- {
- $psfont='';
- Warn("Failed to create new font '$gfont' for Foundry
'$foundry'");
- }
- }
- else
+ if (!$psfont)
{
Warn("Failed to locate postscript internalname in grops font
'$gfont' for Foundry '$foundry'");
}
@@ -481,6 +466,7 @@ sub Notice {
sub Warn {
my $msg=shift;
Msg("warning: line $lct: $msg");
+ $xitcd=2;
}
sub Die {
diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man
index e7110cbdf..7c4ad947b 100644
--- a/src/devices/gropdf/gropdf.1.man
+++ b/src/devices/gropdf/gropdf.1.man
@@ -1878,6 +1878,19 @@ see hello.pdf
.br
.ne 5v
.\" ====================================================================
+.SH Exit Status
+.\" ====================================================================
+.
+The exit code reflects the result of the run.
+.IP 0
+Success. The operation completed successfully.
+.IP 1
+Critical error. PDF produced will be unusable.
+.IP 2
+Warnings were issued. PDF produced may be usable, but it will have issues.
+.br
+.ne 5v
+.\" ====================================================================
.SH Environment
.\" ====================================================================
.
@@ -2062,6 +2075,8 @@ Deri James
.ME .
.
.
+.br
+.ne 3v
.\" ====================================================================
.SH "See also"
.\" ====================================================================
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 89deb83c1..bc041934a 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -224,6 +224,7 @@ unshift(@ARGV,split(' ',$ENV{GROPDF_OPTIONS})) if
exists($ENV{GROPDF_OPTIONS});
my $gotzlib=0;
my $gotinline=0;
my $gotexif=0;
+my $xitcd=0;
my $rc = eval
{
@@ -1003,6 +1004,7 @@ else
print "startxref\n$xrefct\n\%\%EOF\n";
print "\% Pages=$pages->{Count}\n" if $stats;
+exit $xitcd;
sub MakeMatrix
{
@@ -1195,11 +1197,11 @@ sub LoadDownload
if (!-r $pth)
{
- $missing{"$foundry $name"}="$dir/$devnm";
+ $missing{"$foundry $name"}="$dir/$devnm" if
!exists($download{"$foundry $name"});
next;
}
- $download{"$foundry $name"}=$file if !exists($download{"$foundry
$name"});
+ $download{"$foundry $name"}=[$file,$dir] if
!exists($download{"$foundry $name"});
}
close($f);
@@ -3025,8 +3027,7 @@ sub ParsePDFHash
if ($w[0])
{
- Warn("PDF Dict Key '$wd' does not start with '/'");
- exit 1;
+ Die("PDF Dict Key '$wd' does not start with '/'");
}
else
{
@@ -3179,12 +3180,9 @@ sub ParsePDFArray
sub Notice
{
- if ($debug)
- {
- unshift(@_, "debug: ");
- my $msg=join('',@_);
- Msg(0,$msg);
- }
+ unshift(@_, "notice: ");
+ my $msg=join('',@_);
+ Msg(0,$msg);
}
sub Warn
@@ -3192,6 +3190,7 @@ sub Warn
unshift(@_, "warning: ");
my $msg=join('',@_);
Msg(0,$msg);
+ $xitcd=2;
}
sub Die
@@ -3501,7 +3500,7 @@ sub LoadFont
$fnt{slant}=$slant;
$fnt{nospace}=(!defined($fnt{NAM}->{space}->[PSNAME]) or
$fnt{NAM}->{space}->[PSNAME] ne '/space' or !exists($fnt{'spacewidth'}))?1:0;
$fnt{'spacewidth'}=270 if !exists($fnt{'spacewidth'});
- Notice("Using nospace mode for font '$ofontnm'") if $fnt{nospace} == 1 and
$options & USESPACE;
+ Notice("Using nospace mode for font '$ofontnm'") if $debug and
$fnt{nospace} == 1 and $options & USESPACE;
$t1flags|=2**0 if $fixwid > -1;
$t1flags|=(exists($fnt{'special'}))?2**2:2**5;
@@ -3515,7 +3514,13 @@ sub LoadFont
if (exists($download{$fontkey}))
{
# Real font needs subsetting
- $fnt{fontfile}=$download{$fontkey};
+ $fnt{fontfile}=$download{$fontkey}[0];
+ if (exists($missing{$fontkey}))
+ {
+ Notice("The download file in '$missing{$fontkey}'"
+ . " has erroneous entry for '$fnt{internalname} ($ofontnm)'"
+ . " but entry in '$download{$fontkey}[1]' used instead");
+ }
# my ($head,$body,$tail)=GetType1($download{$fontkey});
# $head=~s/\/Encoding .*?readonly def\b/\/Encoding StandardEncoding def/s;
# $fontlst{$fontno}->{HEAD}=$head;
@@ -3528,7 +3533,7 @@ sub LoadFont
{
if (exists($missing{$fontkey}))
{
- Warn("The download file in '$missing{$fontkey}' "
+ Warn("The download file in '$missing{$fontkey}'"
. " has erroneous entry for '$fnt{internalname} ($ofontnm)'");
}
else
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit