Ports: Add mandoc port

This commit is contained in:
Brian Callahan 2020-01-25 21:20:39 -05:00 committed by Andreas Kling
parent 77ed943275
commit 78ddf2e048
15 changed files with 1574 additions and 0 deletions

6
Ports/mandoc/package.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash ../.port_include.sh
port=mandoc
version=1.14.5
useconfigure=true
files="https://mandoc.bsd.lv/snapshots/mandoc-1.14.5.tar.gz mandoc-1.14.5.tar.gz"
depends="less pcre2 zlib"

View file

@ -0,0 +1,32 @@
--- /dev/null Mon Jan 20 00:15:16 2020
+++ mandoc-1.14.5/charclass.h Mon Jan 20 00:15:04 2020
@@ -0,0 +1,29 @@
+/*
+ * Public domain, 2008, Todd C. Miller <millert@openbsd.org>
+ *
+ * $OpenBSD: charclass.h,v 1.2 2019/01/25 00:19:25 millert Exp $
+ */
+
+/*
+ * POSIX character class support for fnmatch() and glob().
+ */
+static struct cclass {
+ const char *name;
+ int (*isctype)(int);
+} cclasses[] = {
+ { "alnum", isalnum },
+ { "alpha", isalpha },
+ { "blank", isblank },
+ { "cntrl", iscntrl },
+ { "digit", isdigit },
+ { "graph", isgraph },
+ { "lower", islower },
+ { "print", isprint },
+ { "punct", ispunct },
+ { "space", isspace },
+ { "upper", isupper },
+ { "xdigit", isxdigit },
+ { NULL, NULL }
+};
+
+#define NCCLASSES (sizeof(cclasses) / sizeof(cclasses[0]) - 1)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,118 @@
--- mandoc-1.14.5/glob.h.orig Sat Jan 25 20:20:24 2020
+++ mandoc-1.14.5/glob.h Sat Jan 25 20:20:44 2020
@@ -0,0 +1,115 @@
+/* $NetBSD: glob.h,v 1.27 2019/05/29 01:21:33 christos Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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.
+ *
+ * @(#)glob.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _GLOB_H_
+#define _GLOB_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifndef __gl_size_t
+#define __gl_size_t size_t
+#endif
+#ifndef __gl_stat_t
+#define __gl_stat_t struct stat
+#endif
+
+typedef struct {
+ __gl_size_t gl_pathc; /* Count of total paths so far. */
+ __gl_size_t gl_matchc; /* Count of paths matching pattern. */
+ __gl_size_t gl_offs; /* Reserved at beginning of gl_pathv. */
+ int gl_flags; /* Copy of flags parameter to glob. */
+ char **gl_pathv; /* List of paths matching pattern. */
+ /* Copy of errfunc parameter to glob. */
+ int (*gl_errfunc)(const char *, int);
+
+ /*
+ * Alternate filesystem access methods for glob; replacement
+ * versions of closedir(3), readdir(3), opendir(3), stat(2)
+ * and lstat(2).
+ */
+ void (*gl_closedir)(void *);
+ struct dirent *(*gl_readdir)(void *);
+ void *(*gl_opendir)(const char *);
+ int (*gl_lstat)(const char *, __gl_stat_t *);
+ int (*gl_stat)(const char *, __gl_stat_t *);
+} glob_t;
+
+#define GLOB_APPEND 0x00001 /* Append to output from previous call. */
+#define GLOB_DOOFFS 0x00002 /* Use gl_offs. */
+#define GLOB_ERR 0x00004 /* Return on error. */
+#define GLOB_MARK 0x00008 /* Append / to matching directories. */
+#define GLOB_NOCHECK 0x00010 /* Return pattern itself if nothing matches. */
+#define GLOB_NOSORT 0x00020 /* Don't sort. */
+#define GLOB_NOESCAPE 0x01000 /* Disable backslash escaping. */
+
+#define GLOB_NOSPACE (-1) /* Malloc call failed. */
+#define GLOB_ABORTED (-2) /* Unignored error. */
+#define GLOB_NOMATCH (-3) /* No match, and GLOB_NOCHECK was not set. */
+#define GLOB_NOSYS (-4) /* Implementation does not support function. */
+
+#define _NETBSD_SOURCE 1
+
+#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
+#define GLOB_ALTDIRFUNC 0x00040 /* Use alternately specified directory funcs. */
+#define GLOB_BRACE 0x00080 /* Expand braces ala csh. */
+#define GLOB_MAGCHAR 0x00100 /* Pattern had globbing characters. */
+#define GLOB_NOMAGIC 0x00200 /* GLOB_NOCHECK without magic chars (csh). */
+#define GLOB_LIMIT 0x00400 /* Limit memory used by matches to ARG_MAX */
+#define GLOB_TILDE 0x00800 /* Expand tilde names from the passwd file. */
+/* GLOB_NOESCAPE 0x01000 above */
+#define GLOB_PERIOD 0x02000 /* Allow metachars to match leading periods. */
+#define GLOB_NO_DOTDIRS 0x04000 /* Make . and .. vanish from wildcards. */
+#define GLOB_STAR 0x08000 /* Use glob ** to recurse directories */
+#define GLOB_TILDE_CHECK 0x10000 /* Expand tilde names from the passwd file. */
+#define GLOB_QUOTE 0 /* source compatibility */
+
+#define GLOB_ABEND GLOB_ABORTED /* source compatibility */
+#endif
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int glob(const char * __restrict, int,
+ int (*)(const char *, int), glob_t * __restrict);
+void globfree(glob_t *);
+#endif
+#ifdef _NETBSD_SOURCE
+int glob_pattern_p(const char *, int);
+#endif
+__END_DECLS
+
+#endif /* !_GLOB_H_ */

View file

@ -0,0 +1,18 @@
--- mandoc-1.14.5/Makefile.orig Sat Jan 25 20:14:41 2020
+++ mandoc-1.14.5/Makefile Sat Jan 25 20:15:10 2020
@@ -63,6 +63,7 @@
compat_fts.c \
compat_getline.c \
compat_getsubopt.c \
+ compat_glob.c \
compat_isblank.c \
compat_mkdtemp.c \
compat_ohash.c \
@@ -251,6 +252,7 @@
compat_fts.o \
compat_getline.o \
compat_getsubopt.o \
+ compat_glob.o \
compat_isblank.o \
compat_mkdtemp.o \
compat_ohash.o \

View file

@ -0,0 +1,11 @@
--- mandoc-1.14.5/catman.c.orig Sun Jan 19 23:55:20 2020
+++ mandoc-1.14.5/catman.c Sun Jan 19 23:55:30 2020
@@ -113,7 +113,7 @@
if ((sz = sendmsg(fd, &msg, 0)) != -1 ||
errno != EAGAIN)
break;
- nanosleep(&timeout, NULL);
+ sleep(1);
}
return sz;
}

View file

@ -0,0 +1,92 @@
--- mandoc-1.14.5/configure.orig Sat Jan 25 20:56:19 2020
+++ mandoc-1.14.5/configure Sat Jan 25 20:56:55 2020
@@ -35,14 +35,13 @@
SOURCEDIR=`dirname "$0"`
-MANPATH_BASE="/usr/share/man:/usr/X11R6/man"
-MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man"
-OSENUM=
-OSNAME=
+MANPATH_BASE="/usr/share/man:/usr/local/share/man"
+MANPATH_DEFAULT="/usr/share/man:/usr/local/share/man"
+OSENUM=MANDOC_OS_OTHER
+OSNAME=Serenity
UTF8_LOCALE=
-CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
-CFLAGS=
+CFLAGS="-O2 -pipe"
LDADD=
LDFLAGS=
LD_NANOSLEEP=
@@ -62,17 +61,17 @@
HAVE_ERR=
HAVE_FTS=
HAVE_FTS_COMPARE_CONST=
-HAVE_GETLINE=
+HAVE_GETLINE=1
HAVE_GETSUBOPT=
HAVE_ISBLANK=
HAVE_LESS_T=
-HAVE_MKDTEMP=
+HAVE_MKDTEMP=1
HAVE_NANOSLEEP=
-HAVE_NTOHL=
+HAVE_NTOHL=1
HAVE_O_DIRECTORY=
HAVE_OHASH=
HAVE_PATH_MAX=
-HAVE_PLEDGE=
+HAVE_PLEDGE=0
HAVE_PROGNAME=
HAVE_REALLOCARRAY=
HAVE_RECALLOCARRAY=
@@ -84,7 +83,7 @@
HAVE_STRINGLIST=
HAVE_STRLCAT=
HAVE_STRLCPY=
-HAVE_STRNDUP=
+HAVE_STRNDUP=1
HAVE_STRPTIME=
HAVE_STRSEP=
HAVE_STRTONUM=
@@ -361,20 +360,6 @@
echo 1>&3
fi
-# --- nanosleep ---
-if [ -n "${LD_NANOSLEEP}" ]; then
- runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" || true
-elif singletest nanosleep NANOSLEEP; then
- :
-elif runtest nanosleep NANOSLEEP "-lrt"; then
- LD_NANOSLEEP="-lrt"
-fi
-if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then
- echo "FATAL: nanosleep: no" 1>&2
- echo "FATAL: nanosleep: no" 1>&3
- exit 1
-fi
-
if [ ${BUILD_CATMAN} -gt 0 ]; then
# --- recvmsg ---
if [ -n "${LD_RECVMSG}" ]; then
@@ -420,7 +405,7 @@
fi
# --- LDADD ---
-LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz"
+LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lpcre2-posix -lpcre2-8 -lz"
echo "selected LDADD=\"${LDADD}\"" 1>&2
echo "selected LDADD=\"${LDADD}\"" 1>&3
echo 1>&3
@@ -572,7 +557,7 @@
[ -z "${BIN_FROM_SBIN}" ] && BIN_FROM_SBIN="../bin"
[ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc"
[ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib/mandoc"
-[ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
+[ -z "${MANDIR}" ] && MANDIR="${PREFIX}/share/man"
[ -z "${HTDOCDIR}" ] && HTDOCDIR="${WWWPREFIX}/htdocs"
[ -z "${CGIBINDIR}" ] && CGIBINDIR="${WWWPREFIX}/cgi-bin"

View file

@ -0,0 +1,11 @@
--- mandoc-1.14.5/dba_read.c.orig Sat Jan 25 20:11:14 2020
+++ mandoc-1.14.5/dba_read.c Sat Jan 25 20:11:22 2020
@@ -19,7 +19,7 @@
* The interface is defined in "dba.h".
* This file is seperate from dba.c because this also uses "dbm.h".
*/
-#include <regex.h>
+#include <pcre2posix.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -0,0 +1,11 @@
--- mandoc-1.14.5/dbm_map.c.orig Sat Jan 25 20:09:42 2020
+++ mandoc-1.14.5/dbm_map.c Sat Jan 25 20:09:49 2020
@@ -36,7 +36,7 @@
#endif
#include <errno.h>
#include <fcntl.h>
-#include <regex.h>
+#include <pcre2posix.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

View file

@ -0,0 +1,11 @@
--- mandoc-1.14.5/dbm.c.orig Sat Jan 25 20:09:04 2020
+++ mandoc-1.14.5/dbm.c Sat Jan 25 20:09:16 2020
@@ -31,7 +31,7 @@
#include <err.h>
#endif
#include <errno.h>
-#include <regex.h>
+#include <pcre2posix.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

View file

@ -0,0 +1,10 @@
--- mandoc-1.14.5/demandoc.c.orig Mon Jan 20 00:18:29 2020
+++ mandoc-1.14.5/demandoc.c Mon Jan 20 00:18:39 2020
@@ -30,6 +30,7 @@
#include "man.h"
#include "mdoc.h"
#include "mandoc_parse.h"
+#include "getopt.h"
static void pline(int, int *, int *, int);
static void pman(const struct roff_node *, int *, int *, int);

View file

@ -0,0 +1,43 @@
--- mandoc-1.14.5/main.c.orig Sat Jan 25 20:29:18 2020
+++ mandoc-1.14.5/main.c Sat Jan 25 20:30:06 2020
@@ -30,7 +30,6 @@
#endif
#include <errno.h>
#include <fcntl.h>
-#include <glob.h>
#if HAVE_SANDBOX_INIT
#include <sandbox.h>
#endif
@@ -42,6 +41,7 @@
#include <termios.h>
#include <time.h>
#include <unistd.h>
+#include <getopt.h>
#include "mandoc_aux.h"
#include "mandoc.h"
@@ -54,6 +54,7 @@
#include "main.h"
#include "manconf.h"
#include "mansearch.h"
+#include "glob.h"
enum outmode {
OUTMODE_DEF = 0,
@@ -660,6 +661,7 @@
if (!WIFSTOPPED(status))
break;
+#define WSTOPSIG(x) 0
signum = WSTOPSIG(status);
}
tag_unlink();
@@ -1239,7 +1241,7 @@
/* Do not start the pager before controlling the terminal. */
while (tcgetpgrp(STDOUT_FILENO) != getpid())
- nanosleep(&timeout, NULL);
+ sleep(1);
execvp(argv[0], argv);
err((int)MANDOCLEVEL_SYSERR, "exec %s", argv[0]);

View file

@ -0,0 +1,10 @@
--- mandoc-1.14.5/mandocdb.c.orig Sat Jan 25 20:18:09 2020
+++ mandoc-1.14.5/mandocdb.c Sat Jan 25 20:18:22 2020
@@ -45,6 +45,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <getopt.h>
#include "mandoc_aux.h"
#include "mandoc_ohash.h"

View file

@ -0,0 +1,14 @@
--- mandoc-1.14.5/mansearch.c.orig Sat Jan 25 20:17:03 2020
+++ mandoc-1.14.5/mansearch.c Sat Jan 25 20:17:11 2020
@@ -26,9 +26,9 @@
#endif
#include <errno.h>
#include <fcntl.h>
-#include <glob.h>
+#include "glob.h"
#include <limits.h>
-#include <regex.h>
+#include <pcre2posix.h>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>

View file

@ -0,0 +1,10 @@
--- mandoc-1.14.5/soelim.c.orig Mon Jan 20 00:18:44 2020
+++ mandoc-1.14.5/soelim.c Mon Jan 20 00:18:55 2020
@@ -42,6 +42,7 @@
#include "compat_stringlist.h"
#endif
#include <unistd.h>
+#include "getopt.h"
#define C_OPTION 0x1