From 7e57cdc1c623a14382f8925d8ce6129567cb55b0 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Wed, 27 Sep 2017 20:23:16 +0200
Subject: [PATCH] Remove libmandoc.

Maintaining it separately, along with its manual pages and headers,
is more maintenance burden than it has real value.

Nothing but mandoc(1) needs it, so just include the source files in
the mandoc(1) build for now.

In-discussion-with: Lubos Boucek <bouceklubos@gmail.com>
---
 Makefile_upgrade.inc              | 29 ++++++++++++++++++++++++++++
 gnu/usr.bin/groff/tmac/mdoc.local |  1 -
 lib/Makefile                      |  1 -
 lib/libmandoc/Makefile            | 40 ---------------------------------------
 share/mk/bsd.libnames.mk          |  1 -
 usr.bin/mandoc/Makefile           | 13 +++++++++----
 6 files changed, 38 insertions(+), 47 deletions(-)
 delete mode 100644 lib/libmandoc/Makefile

diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc
index 0fe6fcd8e9..c2318eae06 100644
--- a/Makefile_upgrade.inc
+++ b/Makefile_upgrade.inc
@@ -3221,6 +3221,35 @@ TO_REMOVE+=/usr/include/sys/device_port.h
 TO_REMOVE+=/usr/include/sys/ieee754.h
 TO_REMOVE+=/usr/include/sys/nlist_aout.h
 TO_REMOVE+=/usr/include/sys/sysvipc.h
+TO_REMOVE+=/usr/include/man.h
+TO_REMOVE+=/usr/include/mandoc.h
+TO_REMOVE+=/usr/include/mdoc.h
+TO_REMOVE+=/usr/lib/libmandoc.a
+TO_REMOVE+=/usr/lib/libmandoc.so
+TO_REMOVE+=/usr/lib/libmandoc.so.0
+TO_REMOVE+=/usr/lib/profile/libmandoc.a
+TO_REMOVE+=/usr/share/man/man3/man_meta.3.gz
+TO_REMOVE+=/usr/share/man/man3/man_mparse.3.gz
+TO_REMOVE+=/usr/share/man/man3/man_node.3.gz
+TO_REMOVE+=/usr/share/man/man3/mandoc.3.gz
+TO_REMOVE+=/usr/share/man/man3/mandoc_escape.3.gz
+TO_REMOVE+=/usr/share/man/man3/mchars_alloc.3.gz
+TO_REMOVE+=/usr/share/man/man3/mchars_free.3.gz
+TO_REMOVE+=/usr/share/man/man3/mchars_num2char.3.gz
+TO_REMOVE+=/usr/share/man/man3/mchars_num2uc.3.gz
+TO_REMOVE+=/usr/share/man/man3/mchars_spec2cp.3.gz
+TO_REMOVE+=/usr/share/man/man3/mchars_spec2str.3.gz
+TO_REMOVE+=/usr/share/man/man3/mdoc_meta.3.gz
+TO_REMOVE+=/usr/share/man/man3/mdoc_node.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_alloc.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_free.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_getkeep.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_keep.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_readfd.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_reset.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_result.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_strerror.3.gz
+TO_REMOVE+=/usr/share/man/man3/mparse_strlevel.3.gz
 
 .if !defined(WANT_INSTALLER)
 TO_REMOVE+=/usr/sbin/dfuibe_installer
diff --git a/gnu/usr.bin/groff/tmac/mdoc.local b/gnu/usr.bin/groff/tmac/mdoc.local
index 2233e004af..3517661b3f 100644
--- a/gnu/usr.bin/groff/tmac/mdoc.local
+++ b/gnu/usr.bin/groff/tmac/mdoc.local
@@ -52,7 +52,6 @@
 .ds doc-str-Lb-libkcore         Kernel Memory Core Access Library (libkcore, \-lkcore)
 .ds doc-str-Lb-libkiconv        Kernel side iconv library (libkiconv, \-lkiconv)
 .ds doc-str-Lb-libkinfo         Kernel Information Access Library (libkinfo, \-lkinfo)
-.ds doc-str-Lb-libmandoc        Mandoc Macro Compiler Library (libmandoc, \-lmandoc)
 .ds doc-str-Lb-libmd            Message Digest (MD4, MD5, etc.) Support Library (libmd, \-lmd)
 .ds doc-str-Lb-libnetgraph      Netgraph User Library (libnetgraph, \-lnetgraph)
 .ds doc-str-Lb-libposix1e       POSIX.1e Security API Library (libposix1e, \-lposix1e)
diff --git a/lib/Makefile b/lib/Makefile
index 2c01f63712..3b1ecfeab7 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -81,7 +81,6 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	libkvm \
 	libm \
 	libmagic \
-	libmandoc \
 	${_libnetgraph} \
 	libopie \
 	libpam \
diff --git a/lib/libmandoc/Makefile b/lib/libmandoc/Makefile
deleted file mode 100644
index 1cc3cd49b4..0000000000
--- a/lib/libmandoc/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-.PATH:	${.CURDIR}/../../contrib/mdocml
-
-LIB=	mandoc
-SHLIB_MAJOR=0
-WARNS?=	3
-MAN=	mandoc.3
-
-SRCS=	man.c man_hash.c man_macro.c man_validate.c
-SRCS+=	arch.c att.c lib.c mdoc.c mdoc_argv.c mdoc_hash.c mdoc_macro.c \
-	mdoc_validate.c st.c vol.c
-SRCS+=	eqn.c roff.c tbl.c tbl_data.c tbl_layout.c tbl_opts.c
-SRCS+=	chars.c mandoc.c msec.c read.c
-
-CFLAGS+=-DHAVE_CONFIG_H
-
-INCS=	man.h mdoc.h mandoc.h
-
-MLINKS+=mandoc.3 mandoc_escape.3
-MLINKS+=mandoc.3 man_meta.3
-MLINKS+=mandoc.3 man_mparse.3
-MLINKS+=mandoc.3 man_node.3
-MLINKS+=mandoc.3 mchars_alloc.3
-MLINKS+=mandoc.3 mchars_free.3
-MLINKS+=mandoc.3 mchars_num2char.3
-MLINKS+=mandoc.3 mchars_num2uc.3
-MLINKS+=mandoc.3 mchars_spec2cp.3
-MLINKS+=mandoc.3 mchars_spec2str.3
-MLINKS+=mandoc.3 mdoc_meta.3
-MLINKS+=mandoc.3 mdoc_node.3
-MLINKS+=mandoc.3 mparse_alloc.3
-MLINKS+=mandoc.3 mparse_free.3
-MLINKS+=mandoc.3 mparse_getkeep.3
-MLINKS+=mandoc.3 mparse_keep.3
-MLINKS+=mandoc.3 mparse_readfd.3
-MLINKS+=mandoc.3 mparse_reset.3
-MLINKS+=mandoc.3 mparse_result.3
-MLINKS+=mandoc.3 mparse_strerror.3
-MLINKS+=mandoc.3 mparse_strlevel.3
-
-.include <bsd.lib.mk>
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index f536c1936d..875a2b54fc 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -51,7 +51,6 @@ LIBLVM?=	${DESTDIR}${LIBDIR}/liblvm.a
 LIBLZMA?=	${DESTDIR}${LIBDIR}/liblzma.a
 LIBM?=		${DESTDIR}${LIBDIR}/libm.a
 LIBMAGIC?=	${DESTDIR}${LIBDIR}/libmagic.a
-LIBMANDOC?=	${DESTDIR}${LIBDIR}/libmandoc.a
 LIBMD?=		${DESTDIR}${LIBDIR}/libmd.a
 LIBMYTINFO?=	"don't use LIBMYTINFO, use LIBNCURSES"
 LIBNCURSES?=	${DESTDIR}${LIBDIR}/priv/libprivate_ncurses.a
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
index 053b72c3e4..9e2a64a702 100644
--- a/usr.bin/mandoc/Makefile
+++ b/usr.bin/mandoc/Makefile
@@ -7,13 +7,18 @@ WARNS?=	3
 
 CFLAGS+=-DHAVE_CONFIG_H
 
-SRCS=	eqn_html.c html.c man_html.c mdoc_html.c tbl_html.c
+# libmandoc
+SRCS=	man.c man_hash.c man_macro.c man_validate.c
+SRCS+=	arch.c att.c lib.c mdoc.c mdoc_argv.c mdoc_hash.c mdoc_macro.c \
+	mdoc_validate.c st.c vol.c
+SRCS+=	eqn.c roff.c tbl.c tbl_data.c tbl_layout.c tbl_opts.c
+SRCS+=	chars.c mandoc.c msec.c read.c
+
+# mandoc
+SRCS+=	eqn_html.c html.c man_html.c mdoc_html.c tbl_html.c
 SRCS+=	mdoc_man.c
 SRCS+=	eqn_term.c man_term.c mdoc_term.c term.c term_ascii.c term_ps.c \
 	tbl_term.c
 SRCS+=	main.c out.c tree.c compat_reallocarray.c mandoc_aux.c
 
-LDADD=	-lmandoc
-DPADD=	${LIBMANDOC}
-
 .include <bsd.prog.mk>
-- 
2.14.1

