Subject: another patch needed for htdocs
To: Rui Paulo <rpaulo@NetBSD.org>
From: Roland Illig <rillig@NetBSD.org>
List: netbsd-docs
Date: 10/13/2005 12:08:40
This is a multi-part message in MIME format.
--------------030807000500070809080300
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hello all,

this patch creates a web.prefs.mk file in htdocs/share/mk, similar to 
the pkgsrc/mk/bsd.prefs.mk. I consider this a non-trivial change, and, 
as Alistair has tought me, it is better to ask for discussion before 
committing such a change.

Another addition is that one can (and should) use the following in 
${MAKECONF} instead of simply setting NBWWW unconditionally:

# htdocs settings
.if defined(BUILDING_HTDOCS)
NBWWW=    yes
.endif

Do you find the name BUILDING_HTDOCS appropriate for this purpose? 
Because, once established, it will probably stay forever. As a 
counter-example, a badly chosen name is BSD_PKG_MK in 
pkgsrc/mk/bsd.prefs.mk, which is used both as multiple-inclusion guard 
(which doesn't match its filename) and as a condition for pkgsrc 
settings. I don't want that kind of mistake to be made again.

With this patch applied, and many, many Makefiles and Makefile.incs 
changed, htdocs/ build almost as before. Well, with some differences.

<http://www.netbsd.org/pl/Releases/formal-1.6/NetBSD-1.6.2.html>: The 
correct special characters are used instead of U+003f (see the "?" 
characters at the bottom of the page).

<http://www.netbsd.org/Documentation/network/dhcp.html>: The "Home page" 
link at the bottom of the page now points to "../.." instead of ".".

<http://www.netbsd.org/sv/Releases/formal-2.0/NetBSD-2.0.html>: The 
language tag changed mysteriously from "sv_SE" to "sv-SE".

Roland

--------------030807000500070809080300
Content-Type: text/plain;
 name="htdocs-share.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="htdocs-share.patch"

Index: share/mk/doc.docbook.mk
===================================================================
RCS file: /cvsroot/htdocs/share/mk/doc.docbook.mk,v
retrieving revision 1.11
diff -u -p -r1.11 doc.docbook.mk
--- share/mk/doc.docbook.mk	11 Oct 2005 07:21:46 -0000	1.11
+++ share/mk/doc.docbook.mk	13 Oct 2005 09:45:59 -0000
@@ -1,5 +1,19 @@
 # $NetBSD: doc.docbook.mk,v 1.11 2005/10/11 07:21:46 mishka Exp $
 
+#
+# include default settings and /etc/mk.conf first
+#
+.include "web.prefs.mk"
+
+#
+# include all Makefile.inc files on the way from ${.CURDIR} to ${WEB_PREFIX}
+#
+.for _d_ in ${_HTDOCS_SUBDIRS}
+.  if exists(${.CURDIR}/${_d_}/Makefile.inc)
+.    include "${.CURDIR}/${_d_}/Makefile.inc"
+.  endif
+.endfor
+
 .include <bsd.own.mk>
 
 UNAME!=		uname -s
Index: share/mk/web.prefs.mk
===================================================================
RCS file: share/mk/web.prefs.mk
diff -N share/mk/web.prefs.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ share/mk/web.prefs.mk	13 Oct 2005 09:45:59 -0000
@@ -0,0 +1,45 @@
+# $NetBSD$
+#
+
+# This file contains the default values (``preferences'') for commonly
+# used variables that can be overridden in /etc/mk.conf. Before using
+# such variables in Makefiles, this file must be included.
+
+.if !defined(_WEB_PREFS_MK)
+_WEB_PREFS_MK=		# defined
+
+#
+# Look for the root directory of htdocs. Currently five subdirectory
+# levels are enough to handle all web pages.
+#
+_HTDOCS_SUBDIRS=	# none
+.for _d_ in . .. ../.. ../../.. ../../../.. ../../../../..
+.  if !defined(_HTDOCS_PREFIX)
+_HTDOCS_SUBDIRS+=	${_d_}
+.    if exists(${.CURDIR}/${_d_}/robots.txt)
+_HTDOCS_PREFIX?=	${.CURDIR}/${_d_}
+.    endif
+.  endif
+.endfor
+
+#
+# Are we on the host www.NetBSD.org?
+# Possible values: YES, yes, NO, no.
+#
+NBWWW?=			no
+
+#
+# The location of htdocs/.
+# Possible values: An absolute directory name.
+#
+WEB_PREFIX?=		${_HTDOCS_PREFIX}
+
+#
+# Include /etc/mk.conf indirectly. The htdocs settings should be put
+# between .if defined(BUILDING_HTDOCS) ... .endif to not interfere with
+# other settings.
+#
+BUILDING_HTDOCS=	yes
+.include <bsd.own.mk>
+
+.endif
Index: share/mk/web.site.mk
===================================================================
RCS file: /cvsroot/htdocs/share/mk/web.site.mk,v
retrieving revision 1.42
diff -u -p -r1.42 web.site.mk
--- share/mk/web.site.mk	13 Oct 2005 00:35:11 -0000	1.42
+++ share/mk/web.site.mk	13 Oct 2005 09:45:59 -0000
@@ -18,18 +18,9 @@ _!=		echo "warning: web.site.mk is inclu
 _HTDOCS_WEB_SITE_MK=	#defined
 
 #
-# look for the root directory of htdocs
+# include default settings and /etc/mk.conf first
 #
-_HTDOCS_SUBDIRS=	#none
-.for _d_ in . .. ../.. ../../.. ../../../..
-.  if !defined(_HTDOCS_PREFIX)
-_HTDOCS_SUBDIRS+=	${_d_}
-.    if exists(${.CURDIR}/${_d_}/robots.txt)
-_HTDOCS_PREFIX?=	${.CURDIR}/${_d_}
-.    endif
-.  endif
-.endfor
-WEB_PREFIX?=	${_HTDOCS_PREFIX}
+.include "web.prefs.mk"
 
 #
 # include all Makefile.inc files on the way from ${.CURDIR} to ${WEB_PREFIX}
@@ -40,11 +31,6 @@ WEB_PREFIX?=	${_HTDOCS_PREFIX}
 .  endif
 .endfor
 
-DOCLANG?=	en
-
-# include settings from /etc/mk.conf first
-.include <bsd.own.mk>
-
 LOCALBASE?=	/usr/pkg
 PREFIX?=	${LOCALBASE}
 

--------------030807000500070809080300--