commit: 506a146fe48ce91e07942e3ff2ea4e7093419ef6
parent 9b7b395ec1f6e3ef878a82d7537943b15ffc7661
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 13 Nov 2018 01:49:22 -0800
texi2mdoc: Update date patch to one adapted from upstream commit
Diffstat:
4 files changed, 181 insertions(+), 116 deletions(-)
diff --git a/pkg/ffmpeg/gen.lua b/pkg/ffmpeg/gen.lua
@@ -356,7 +356,7 @@ file('bin/ffprobe', '755', '$outdir/ffprobe')
exe('ffmpeg', {paths[[fftools/(ffmpeg.c ffmpeg_opt.c ffmpeg_filter.c ffmpeg_hw.c cmdutils.c.o)]], libs})
file('bin/ffmpeg', '755', '$outdir/ffmpeg')
-rule('texi2mdoc', 'texi2mdoc -d 2018-11-06 -I $outdir $in >$out.tmp && mv $out.tmp $out')
+rule('texi2mdoc', [[texi2mdoc -d 'November 7, 2018' -I $outdir $in >$out.tmp && mv $out.tmp $out]])
build('texi2mdoc', '$outdir/ffprobe.1', {'$srcdir/doc/ffprobe.texi', '|', '$outdir/config.texi'})
build('texi2mdoc', '$outdir/ffmpeg.1', {'$srcdir/doc/ffmpeg.texi', '|', '$outdir/config.texi'})
man{'$outdir/ffprobe.1', '$outdir/ffmpeg.1'}
diff --git a/pkg/texi2mdoc/patch/0001-Add-the-d-option-to-specify-the-.Dd-date.patch b/pkg/texi2mdoc/patch/0001-Add-the-d-option-to-specify-the-.Dd-date.patch
@@ -0,0 +1,179 @@
+From 5b40a091f4d31fa6d21a84536f5998135faf6dfa Mon Sep 17 00:00:00 2001
+From: schwarze <schwarze>
+Date: Tue, 13 Nov 2018 08:45:29 +0000
+Subject: [PATCH] Add the -d option to specify the .Dd date, and fall back to
+ the mtime before resorting to the current time. Patch from Michael Forney
+ <mforney at mforney dot org> with minimal tweaks by me.
+
+While here, fix the date format, "%F" is wrong for mdoc(7).
+Change it to "%B %e, %Y" which isn't perfect due to the
+spurious blank before single-digit day numbers, but closer.
+---
+ extern.h | 1 +
+ main.c | 35 ++++++++++++++++++++++++++---------
+ texi2mdoc.1 | 14 +++++++++++++-
+ util.c | 1 -
+ 4 files changed, 40 insertions(+), 11 deletions(-)
+
+diff --git a/extern.h b/extern.h
+index f713e0b..643edde 100644
+--- a/extern.h
++++ b/extern.h
+@@ -365,6 +365,7 @@ struct texi {
+ size_t dirsz; /* number of texi directories */
+ char *title; /* title of document */
+ char *subtitle; /* subtitle of document */
++ char *date; /* date of document */
+ int secoffs; /* see sectioner() */
+ char **indexs; /* @defindex indices */
+ size_t indexsz; /* entries in indexs */
+diff --git a/main.c b/main.c
+index d343727..308fe5e 100644
+--- a/main.c
++++ b/main.c
+@@ -17,6 +17,9 @@
+ #if defined(__linux__) || defined(__MINT__)
+ # define _GNU_SOURCE /* memmem */
+ #endif
++
++#include <sys/stat.h>
++
+ #include <assert.h>
+ #include <ctype.h>
+ #include <getopt.h>
+@@ -1587,8 +1590,6 @@ static void
+ dotop(struct texi *p, enum texicmd cmd, size_t *pos)
+ {
+ const char *cp;
+- time_t t;
+- char date[32];
+
+ if (--p->ign)
+ texierr(p, "@top command while ignoring");
+@@ -1598,13 +1599,11 @@ dotop(struct texi *p, enum texicmd cmd, size_t *pos)
+ * We use the title set with @settitle for the `Nd' description
+ * and the source document filename (the first one as invoked on
+ * the command line) for the title.
+- * The date is set to the current date.
++ * The date is set to the modification time of the input.
+ */
+- t = time(NULL);
+- strftime(date, sizeof(date), "%F", localtime(&t));
+
+ teximacroopen(p, "Dd");
+- texiputchars(p, date);
++ texiputchars(p, p->date);
+ teximacroclose(p);
+ teximacroopen(p, "Dt");
+ for (cp = p->title; '\0' != *cp; cp++)
+@@ -1864,9 +1863,12 @@ int
+ main(int argc, char *argv[])
+ {
+ struct texi texi;
+- int c;
++ char date[32];
++ struct stat st;
+ char *dirpath, *dir, *ccp;
+ const char *progname, *Idir, *cp;
++ time_t t;
++ int c;
+
+ progname = strrchr(argv[0], '/');
+ if (progname == NULL)
+@@ -1878,8 +1880,11 @@ main(int argc, char *argv[])
+ texi.ign = 1;
+ Idir = NULL;
+
+- while (-1 != (c = getopt(argc, argv, "I:")))
++ while (-1 != (c = getopt(argc, argv, "d:I:")))
+ switch (c) {
++ case ('d'):
++ texi.date = optarg;
++ break;
+ case ('I'):
+ Idir = optarg;
+ break;
+@@ -1905,16 +1910,28 @@ main(int argc, char *argv[])
+ *ccp = '\0';
+ texi.dirs = parsedirs(&texi, dir, Idir, &texi.dirsz);
+ free(dirpath);
++ if (NULL == texi.date) {
++ t = stat(argv[0], &st) == 0 ? st.st_mtime : time(NULL);
++ strftime(date, sizeof(date),
++ "%B %e, %Y", localtime(&t));
++ texi.date = date;
++ }
+ parsefile(&texi, argv[0], 1);
+ } else {
+ texi.title = strdup("Unknown Manual");
+ texi.dirs = parsedirs(&texi, NULL, Idir, &texi.dirsz);
++ if (NULL == texi.date) {
++ t = time(NULL);
++ strftime(date, sizeof(date),
++ "%B %e, %Y", localtime(&t));
++ texi.date = date;
++ }
+ parsestdin(&texi);
+ }
+
+ texiexit(&texi);
+ return(EXIT_FAILURE);
+ usage:
+- fprintf(stderr, "usage: %s [-Idirs] [file]\n", progname);
++ fprintf(stderr, "usage: %s [-d date] [-I dirs] [file]\n", progname);
+ return(EXIT_FAILURE);
+ }
+diff --git a/texi2mdoc.1 b/texi2mdoc.1
+index 9f8169e..f479adc 100644
+--- a/texi2mdoc.1
++++ b/texi2mdoc.1
+@@ -14,7 +14,7 @@
+ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ .\"
+-.Dd $Mdocdate: February 25 2015 $
++.Dd $Mdocdate: November 13 2018 $
+ .Dt TEXI2MDOC 1
+ .Os
+ .Sh NAME
+@@ -22,6 +22,7 @@
+ .Nd convert texinfo documents to mdoc
+ .Sh SYNOPSIS
+ .Nm texi2mdoc
++.Op Fl d Ar date
+ .Op Fl I Ar dirs
+ .Op Ar file
+ .Sh DESCRIPTION
+@@ -39,6 +40,17 @@ By default,
+ reads from standard input.
+ Its arguments are as follows:
+ .Bl -tag -width Ds
++.It Fl d Ar date
++Set the output document date in the
++.Ic \&Dd
++macro to
++.Ar date ,
++to be specified in the format
++.Dq Ar Month Day , Year .
++If unspecified,
++.Nm
++uses the file modification date
++or the current date when reading from standard input.
+ .It Fl I Ar dirs
+ Colon-separated directories to search for
+ .Li @include
+diff --git a/util.c b/util.c
+index 944872f..c6de818 100644
+--- a/util.c
++++ b/util.c
+@@ -27,7 +27,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <time.h>
+ #include <unistd.h>
+
+ #include "extern.h"
+--
+2.19.1
+
diff --git a/pkg/texi2mdoc/patch/0001-Use-mtime-of-source-for-date-and-allow-override.patch b/pkg/texi2mdoc/patch/0001-Use-mtime-of-source-for-date-and-allow-override.patch
@@ -1,114 +0,0 @@
-From b011ba98eb147ebd87aedd4b10bee9fc878cdf45 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 11 Nov 2018 14:24:00 -0800
-Subject: [PATCH] Use mtime of source for date, and allow override
-
----
- extern.h | 1 +
- main.c | 29 ++++++++++++++++++++---------
- 2 files changed, 21 insertions(+), 9 deletions(-)
-
-diff --git a/extern.h b/extern.h
-index f713e0b..643edde 100644
---- a/extern.h
-+++ b/extern.h
-@@ -365,6 +365,7 @@ struct texi {
- size_t dirsz; /* number of texi directories */
- char *title; /* title of document */
- char *subtitle; /* subtitle of document */
-+ char *date; /* date of document */
- int secoffs; /* see sectioner() */
- char **indexs; /* @defindex indices */
- size_t indexsz; /* entries in indexs */
-diff --git a/main.c b/main.c
-index d343727..0492a79 100644
---- a/main.c
-+++ b/main.c
-@@ -28,6 +28,7 @@
- #include <string.h>
- #include <time.h>
- #include <unistd.h>
-+#include <sys/stat.h>
-
- #include "extern.h"
-
-@@ -1587,8 +1588,6 @@ static void
- dotop(struct texi *p, enum texicmd cmd, size_t *pos)
- {
- const char *cp;
-- time_t t;
-- char date[32];
-
- if (--p->ign)
- texierr(p, "@top command while ignoring");
-@@ -1598,13 +1597,10 @@ dotop(struct texi *p, enum texicmd cmd, size_t *pos)
- * We use the title set with @settitle for the `Nd' description
- * and the source document filename (the first one as invoked on
- * the command line) for the title.
-- * The date is set to the current date.
- */
-- t = time(NULL);
-- strftime(date, sizeof(date), "%F", localtime(&t));
-
- teximacroopen(p, "Dd");
-- texiputchars(p, date);
-+ texiputchars(p, p->date);
- teximacroclose(p);
- teximacroopen(p, "Dt");
- for (cp = p->title; '\0' != *cp; cp++)
-@@ -1865,8 +1861,10 @@ main(int argc, char *argv[])
- {
- struct texi texi;
- int c;
-- char *dirpath, *dir, *ccp;
-+ char *dirpath, *dir, *ccp, date[32];
- const char *progname, *Idir, *cp;
-+ struct stat st;
-+ time_t t;
-
- progname = strrchr(argv[0], '/');
- if (progname == NULL)
-@@ -1878,8 +1876,11 @@ main(int argc, char *argv[])
- texi.ign = 1;
- Idir = NULL;
-
-- while (-1 != (c = getopt(argc, argv, "I:")))
-+ while (-1 != (c = getopt(argc, argv, "d:I:")))
- switch (c) {
-+ case ('d'):
-+ texi.date = optarg;
-+ break;
- case ('I'):
- Idir = optarg;
- break;
-@@ -1905,16 +1906,26 @@ main(int argc, char *argv[])
- *ccp = '\0';
- texi.dirs = parsedirs(&texi, dir, Idir, &texi.dirsz);
- free(dirpath);
-+ if (!texi.date) {
-+ t = stat(argv[0], &st) == 0 ? st.st_mtime : time(NULL);
-+ strftime(date, sizeof(date), "%F", localtime(&t));
-+ texi.date = date;
-+ }
- parsefile(&texi, argv[0], 1);
- } else {
- texi.title = strdup("Unknown Manual");
- texi.dirs = parsedirs(&texi, NULL, Idir, &texi.dirsz);
-+ if (!texi.date) {
-+ t = time(NULL);
-+ strftime(date, sizeof(date), "%F", localtime(&t));
-+ texi.date = date;
-+ }
- parsestdin(&texi);
- }
-
- texiexit(&texi);
- return(EXIT_FAILURE);
- usage:
-- fprintf(stderr, "usage: %s [-Idirs] [file]\n", progname);
-+ fprintf(stderr, "usage: %s [-d date] [-Idirs] [file]\n", progname);
- return(EXIT_FAILURE);
- }
---
-2.19.1
-
diff --git a/pkg/texi2mdoc/rev b/pkg/texi2mdoc/rev
@@ -1 +1 @@
-2
+3