Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mandoc #1395

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions build_info/mandoc.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Package: mandoc
Version: @DEB_MANDOC_V@
Priority: optional
Section: Development
Architecture: @DEB_ARCH@
Maintainer: @DEB_MAINTAINER@
Homepage: https://mandoc.bsd.lv/
Description: BSD manpage compiler toolset
mandoc is a suite of tools compiling mdoc, the roff macro language
of choice for BSD manual pages, and man, the predominant historical
language for UNIX manuals. It is small, ISO C, ISC-licensed, and
quite fast. The main component of the toolset is the mandoc utility
program, based on the libmandoc validating compiler, to format
output for UNIX terminals (with support for wide-character locales),
XHTML, HTML, PostScript, and PDF.
63 changes: 63 additions & 0 deletions build_patch/mandoc/configure.local.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/configure.local b/configure.local
new file mode 100644
index 00000000..5a6f3891
--- /dev/null
+++ b/configure.local
@@ -0,0 +1,57 @@
+HAVE_FTS=1
+HAVE_FTS_COMPARE_CONST=0
+HAVE_GETLINE=1
+HAVE_GETSUBOPT=1
+HAVE_ISBLANK=1
+HAVE_LESS_T=1
+HAVE_MKDTEMP=1
+HAVE_NTOHL=1
+HAVE_O_DIRECTORY=1
+HAVE_OHASH=0
+HAVE_PATH_MAX=1
+HAVE_PLEDGE=0
+HAVE_PROGNAME=1
+HAVE_REALLOCARRAY=0
+HAVE_RECALLOCARRAY=0
+HAVE_REWB_BSD=1
+HAVE_REWB_SYSV=0
+HAVE_STRCASESTR=1
+HAVE_STRINGLIST=1
+HAVE_STRLCAT=1
+HAVE_STRLCPY=1
+HAVE_STRPTIME=1
+HAVE_STRSEP=1
+HAVE_STRTONUM=0 # Was added in iOS 14
+HAVE_ENDIAN=0
+HAVE_SYS_ENDIAN=0
+HAVE_VASPRINTF=1
+HAVE_WCHAR=1
+HAVE_NANOSLEEP=1
+LD_NANOSLEEP=""
+HAVE_RECVMSG=1
+HAVE_CMSG=1
+MANPATH_DEFAULT="/usr/share/man:/usr/local/share/man:/usr/local/man:@MEMO_PREFIX@@MEMO_SUB_PREFIX@/share/man"
+OSNAME="Procursus"
+PREFIX="@MEMO_PREFIX@@MEMO_SUB_PREFIX@"
+MANDIR="${PREFIX}/share/man"
+EXAMPLEDIR="${PREFIX}/share/doc/mandoc"
+MANM_MAN="mandoc_man" # default is "man"
+MANM_MDOC="mandoc_mdoc" # default is "mdoc"
+MANM_ROFF="mandoc_roff" # default is "roff"
+MANM_EQN="mandoc_eqn" # default is "eqn"
+MANM_TBL="mandoc_tbl" # default is "tbl"
+BINM_MAN=mman # default is "man"
+BINM_APROPOS=mapropos # default is "apropos"
+BINM_SOELIM=msoelim # default is "soelim"
+BINM_WHATIS=mwhatis # default is "whatis"
+BINM_CATMAN=mcatman # default is "catman"
+BUILD_CATMAN=1
+LN="ln -sf"
+CC="@CC@"
+CFLAGS="@CFLAGS@"
+CPPFLAGS="@CPPFLAGS@"
+LDFLAGS="@LDFLAGS@"
+INSTALL_PROGRAM="${INSTALL} -m 0755"
+INSTALL_LIB="${INSTALL} -m 0644"
+INSTALL_MAN="${INSTALL} -m 0644"
+INSTALL_DATA="${INSTALL} -m 0644"
51 changes: 51 additions & 0 deletions makefiles/mandoc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ifneq ($(PROCURSUS),1)
$(error Use the main Makefile)
endif

SUBPROJECTS += mandoc
MANDOC_VERSION := 1.14.6
DEB_MANDOC_V ?= $(MANDOC_VERSION)

mandoc-setup: setup
$(call DOWNLOAD_FILES,$(BUILD_SOURCE),https://mandoc.bsd.lv/snapshots/mandoc-$(MANDOC_VERSION).tar.gz)
$(call EXTRACT_TAR,mandoc-$(MANDOC_VERSION).tar.gz,mandoc-$(MANDOC_VERSION),mandoc)
$(call DO_PATCH,mandoc,mandoc,-p1)
sed -i -e "s|@CC@|$(CC)|" \
-e "s|@CFLAGS@|$(CFLAGS)|" \
-e "s|@CPPFLAGS@|$(CPPFLAGS)|" \
-e "s|@LDFLAGS@|$(LDFLAGS)|" \
-e "s|@MEMO_PREFIX@|$(MEMO_PREFIX)|g" \
-e "s|@MEMO_SUB_PREFIX@|$(MEMO_SUB_PREFIX)|g" \
$(BUILD_WORK)/mandoc/configure.local
sed -i "/int dummy;/d" $(BUILD_WORK)/mandoc/compat_*.c

ifneq ($(wildcard $(BUILD_WORK)/mandoc/.build_complete),)
mandoc:
@echo "Using previously built mandoc."
else
mandoc: mandoc-setup
cd $(BUILD_WORK)/mandoc && ./configure -C \
$(DEFAULT_CONFIGURE_FLAGS)
+$(MAKE) -C $(BUILD_WORK)/mandoc
+$(MAKE) -C $(BUILD_WORK)/mandoc install \
DESTDIR="$(BUILD_STAGE)/mandoc"
$(call AFTER_BUILD)
endif

mandoc-package: mandoc-stage
# mandoc.mk Package Structure
rm -rf $(BUILD_DIST)/mandoc

# mandoc.mk Prep mandoc
cp -a $(BUILD_STAGE)/mandoc $(BUILD_DIST)/mandoc

# mandoc.mk Sign
$(call SIGN,mandoc,general.xml)

# mandoc.mk Make .debs
$(call PACK,mandoc,DEB_MANDOC_V)

# mandoc.mk Build cleanup
rm -rf $(BUILD_DIST)/mandoc

.PHONY: mandoc mandoc-package