[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New: www/man2web



man2web is a program for converting man output to HTML on the fly
(as a CGI program) or on the command line.

The attached port is basically straightforward.  However, the default
section menu doesn't agree with the OpenBSD man pages.  In the port
I have simply patched the built-in default.  Alternatively, we could
not touch the source and provide a default configuration file
(otherwise unnecessary) that sets the sections.  I have also attached
a diff from the port that implements the second approach.  I'm
undecided whether it is cleaner.  It seems unecessarily complex.

Opinions?
-- 
Christian "naddy" Weisgerber                          naddy_(_at_)_mips_(_dot_)_inka_(_dot_)_de

Attachment: man2web.shar
Description: Unix shell archive

diff -uNr man2web/Makefile man2web.alt/Makefile
--- man2web/Makefile	Sat Apr 19 01:29:07 2003
+++ man2web.alt/Makefile	Sat Apr 19 01:28:45 2003
@@ -20,4 +20,13 @@
 FAKE_FLAGS=	${DESTDIRNAME}=${WRKINST} \
 		sysconfdir=${PREFIX}/share/examples/man2web
 
+post-build:
+	@sed -f ${FILESDIR}/man2web.conf.sed \
+		${WRKBUILD}/doc/man2web.conf.default \
+		>${WRKBUILD}/doc/man2web.conf.openbsd
+
+post-install:
+	${INSTALL_DATA} ${WRKBUILD}/doc/man2web.conf.openbsd \
+		${PREFIX}/share/examples/man2web/
+
 .include <bsd.port.mk>
diff -uNr man2web/files/man2web.conf.sed man2web.alt/files/man2web.conf.sed
--- man2web/files/man2web.conf.sed	Thu Jan  1 01:00:00 1970
+++ man2web.alt/files/man2web.conf.sed	Sat Apr 19 01:28:45 2003
@@ -0,0 +1,15 @@
+#/usr/bin/sed -f
+# $OpenBSD$
+/^# SECTION 3 3/a\
+\
+# OpenBSD sections\
+SECTION 1 1 General Commands (Tools and Utilities)\
+SECTION 2 2 System Calls and Error Numbers\
+SECTION 3 3 C Libraries\
+SECTION 4 4 Special Files and Hardware Support\
+SECTION 5 5 File Formats\
+SECTION 6 6 Games\
+SECTION 7 7 Miscellaneous Information Pages\
+SECTION 8 8 System Maintenance and Operation Commands\
+SECTION 9 9 Kernel Internals\
+
diff -uNr man2web/patches/patch-src_cover_page_h man2web.alt/patches/patch-src_cover_page_h
--- man2web/patches/patch-src_cover_page_h	Sat Apr 19 01:34:32 2003
+++ man2web.alt/patches/patch-src_cover_page_h	Thu Jan  1 01:00:00 1970
@@ -1,28 +0,0 @@
-$OpenBSD$
---- src/cover_page.h.orig	Sat Apr 19 01:29:40 2003
-+++ src/cover_page.h	Sat Apr 19 01:34:21 2003
-@@ -8,15 +8,15 @@ void cleanup_section_node(struct section
- char *find_section(struct section_entry **node, char *pseudo);
- 
- /* default section entries that are used if configuration file is disabled*/
--#define SECTION_COUNT 8
-+#define SECTION_COUNT 9
- struct section_entry section_matrix[] = {
--        { "1", "1",	"User Commands" },
--        { "2", "2",     "System Calls" },
--        { "3", "3",     "Library Functions" },
--        { "4", "4",     "Device Drivers & Files" },
-+        { "1", "1",	"General Commands (Tools and Utilities)" },
-+        { "2", "2",     "System Calls and Error Numbers" },
-+        { "3", "3",     "C Libraries" },
-+        { "4", "4",     "Special Files and Hardware Support" },
-         { "5", "5",     "File Formats" },
--        { "6", "6",     "Games and Demos" },
--        { "7", "7",     "Conventions & Miscellany" },
--        { "8", "8",     "System Administration Commands" }
-+        { "6", "6",     "Games" },
-+        { "7", "7",     "Miscellaneous Information Pages" },
-+        { "8", "8",     "System Maintenance and Operation Commands" },
-+        { "9", "9",     "Kernel Internals" }
- };
--
diff -uNr man2web/pkg/DEINSTALL man2web.alt/pkg/DEINSTALL
--- man2web/pkg/DEINSTALL	Thu Jan  1 01:00:00 1970
+++ man2web.alt/pkg/DEINSTALL	Sat Apr 19 01:28:45 2003
@@ -0,0 +1,51 @@
+#!/bin/sh
+# $OpenBSD$
+#
+# De-installation setup
+
+# exit on errors, use a sane path and install prefix
+#
+set -e
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PREFIX=${PKG_PREFIX:-/usr/local}
+CONFIG_FILE=${SYSCONFDIR}/man2web.conf
+
+# Function: tell the user what they need to do to delete the port completely
+#
+do_notice()
+{
+    echo
+    echo "+---------------"
+    echo "| To completely deinstall the $1 package you need to perform"
+    echo "| these steps as root:"
+    echo "|"
+    echo "|       rm -f ${CONFIG_FILE}"
+    echo "|"
+    echo "| Do not do this if you plan on re-installing $1"
+    echo "| at some future time."
+    echo "+---------------"
+    echo
+}
+
+# Verify proper execution
+#
+if [ $# -ne 2 ]; then
+    echo "usage: $0 distname DEINSTALL" >&2
+    exit 1
+fi
+
+# Verify/process the command
+#
+case $2 in
+    DEINSTALL)
+	if [ -f ${CONFIG_FILE} ]; then
+	    do_notice "$1"
+	fi
+	;;
+    *)
+	echo "usage: $0 distname DEINSTALL" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff -uNr man2web/pkg/INSTALL man2web.alt/pkg/INSTALL
--- man2web/pkg/INSTALL	Thu Jan  1 01:00:00 1970
+++ man2web.alt/pkg/INSTALL	Sat Apr 19 01:28:45 2003
@@ -0,0 +1,68 @@
+#!/bin/sh
+# $OpenBSD$
+#
+# Pre/post-installation setup
+
+# exit on errors, use a sane path and install prefix
+#
+set -e
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PREFIX=${PKG_PREFIX:-/usr/local}
+CONFIG_FILE=${SYSCONFDIR}/man2web.conf
+SAMPLE_CONFIG_DIR=$PREFIX/share/examples/man2web
+
+# Function: tell the user what they need to do to use the port just installed
+#
+do_notice()
+{
+    echo
+    echo "+---------------"
+    echo "| The existing $1 configuration file, ${CONFIG_FILE},"
+    echo "| has NOT been changed.  You may want to compare it to the"
+    echo "| current sample files in ${SAMPLE_CONFIG_DIR}"
+    echo "| and update your configuration as needed."
+    echo "+---------------"
+    echo
+}
+
+# Function: install configuration files
+#
+do_install()
+{
+    install -o root -g wheel ${SAMPLE_CONFIG_DIR}/man2web.conf.openbsd ${CONFIG_FILE}
+    echo
+    echo "+---------------"
+    echo "| The $1 configuration file, ${CONFIG_FILE},"
+    echo "| has been installed.  Please view this file and change"
+    echo "| the configuration to meet your needs."
+    echo "+---------------"
+    echo
+}
+
+# Verify proper execution
+#
+if [ $# -ne 2 ]; then
+    echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
+    exit 1
+fi
+
+# Verify/process the command
+#
+case $2 in
+    PRE-INSTALL)
+	: nothing to pre-install for this port
+	;;
+    POST-INSTALL)
+	if [ -f ${CONFIG_FILE} ]; then
+	    do_notice "$1"
+	else
+	    do_install "$1"
+	fi
+	;;
+    *)
+	echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff -uNr man2web/pkg/PLIST man2web.alt/pkg/PLIST
--- man2web/pkg/PLIST	Sat Apr 19 01:29:11 2003
+++ man2web.alt/pkg/PLIST	Sat Apr 19 01:28:45 2003
@@ -3,4 +3,5 @@
 man/man1/man2web.1
 man/man5/man2web.conf.5
 share/examples/man2web/man2web.conf.default
+share/examples/man2web/man2web.conf.openbsd
 @dirrm share/examples/man2web

Visit your host, monkey.org