Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Dec 2003 19:45:07 +0900 (JST)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        ue@nathan.ruhr.de
Cc:        hrs@FreeBSD.org
Subject:   Re: doc.common.mk 1.3
Message-ID:  <20031230.194507.56983609.hrs@eos.ocn.ne.jp>
In-Reply-To: <20031230004119.GA19005@nathan.ruhr.de>
References:  <20031230004119.GA19005@nathan.ruhr.de>

next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart(Tue_Dec_30_19:45:07_2003_467)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Udo Erdelhoff <ue@nathan.ruhr.de> wrote
  in <20031230004119.GA19005@nathan.ruhr.de>:

ue> Hi,
ue> your changes to doc.common.mk break certian cases of out-of-tree
ue> builds of the release notes.  The problem is quite simple, you set
ue> LANGCODE to ${.CURDIR} if either LANGCODE or WWW_LANGCODE is not
ue> defined.  If the current path does not contain "doc" or "www",
ue> LANGCODE is set to ".", and this breaks all non-english versions.
ue> In my opinion, you should only use your initialization if *both*
ue> LANGCODE and WWW_LANGCODE are empty.  If only one of the two variables
ue> is empty, you should initialize the other variable with this value.

 I understand the problem.  As you pointed out, currently
 if the pathname does not include "doc" or "www", LANGCODE and
 WWW_LANGCODE are not defined properly. 

 What do you think about using DOC_PREFIX and WEB_PREFIX to determine
 the magic pathname fragment "doc" and "www"?  First, LANGCODE and
 WWW_LANGCODE can be overridden via make's command line option in
 the attached patch.  And if they or a pair of them were not defined,
 doc.common.mk tries to guess using DOC_PREFIX and WEB_PREFIX.
 That is, it is needed to define WEB_PREFIX and DOC_PREFIX properly,
 when non-standard directory structure is used, though we should
 make www/<lang>/doc/Makefile respect ${DOC_PREFIX}/${LANGCODE}
 (currently ${.CURDIR} is used).

-- 
| Hiroki SATO

Index: doc.common.mk
===================================================================
RCS file: /home/ncvs/doc/share/mk/doc.common.mk,v
retrieving revision 1.3
diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.3 doc.common.mk
--- doc.common.mk	26 Nov 2003 01:47:00 -0000	1.3
+++ doc.common.mk	30 Dec 2003 10:16:07 -0000
@@ -20,58 +20,83 @@
 # Liberal default of maximum of 10 directories below to find it.
 #
 
+.if defined(DOC_PREFIX) && !empty(DOC_PREFIX)
+DOC_PREFIX_NAME!=	realpath ${DOC_PREFIX}
+DOC_PREFIX_NAME:=	${DOC_PREFIX_NAME:T}
+.else
 DOC_PREFIX_NAME?=	doc
+.endif
+
+.if defined(WEB_PREFIX) && !empty(WEB_PREFIX)
+WWW_PREFIX_NAME!=	realpath ${WEB_PREFIX}
+WWW_PREFIX_NAME:=	${WWW_PREFIX_NAME:T}
+.else
 WWW_PREFIX_NAME?=	www
+.endif
 
-.if !defined(LANGCODE) || empty(LANGCODE) || !defined(WWW_LANGCODE) || empty(WWW_LANGCODE)
-# Calculate LANGCODE.
-LANGCODE:=	${.CURDIR}
+.if (!defined(LANGCODE) || empty(LANGCODE)) && (!defined(WWW_LANGCODE) || empty(WWW_LANGCODE))
+# Calculate _LANGCODE.
+_LANGCODE:=	${.CURDIR}
 .for _ in 1 2 3 4 5 6 7 8 9 10
-.if !(${LANGCODE:H:T} == ${DOC_PREFIX_NAME}) && !(${LANGCODE:H:T} == ${WWW_PREFIX_NAME})
-LANGCODE:=	${LANGCODE:H}
+.if !(${_LANGCODE:H:T} == ${DOC_PREFIX_NAME}) && !(${_LANGCODE:H:T} == ${WWW_PREFIX_NAME})
+_LANGCODE:=	${_LANGCODE:H}
 .endif
 .endfor
-.if (${LANGCODE:H:T} == ${DOC_PREFIX_NAME})
+.if (${_LANGCODE:H:T} == ${DOC_PREFIX_NAME})
 # We are in doc/.
-LANGCODE:=	${LANGCODE:T}
-WWW_LANGCODE:=	.
+_LANGCODE:=	${_LANGCODE:T}
+_WWW_LANGCODE:=	.
 .else
 # We are in www/.
-WWW_LANGCODE:=	${LANGCODE:T}
-LANGCODE:=	.
+_WWW_LANGCODE:=	${_LANGCODE:T}
+_LANGCODE:=	.
+.endif
+.else
+# when LANGCODE or WWW_LANGCODE is defined, use the value.
+.if defined(LANGCODE) && !empty(LANGCODE)
+_LANGCODE?=	${LANGCODE}
+.else
+_LANGCODE?=	.
+.endif
+.if defined(WWW_LANGCODE) && !empty(WWW_LANGCODE)
+_WWW_LANGCODE?=	${WWW_LANGCODE}
+.else
+_WWW_LANGCODE?=	.
 .endif
 .endif
 
-# fixup LANGCODE
-.if (${LANGCODE} == .)
-# We have a short name such as `en' in ${WWW_LANGCODE} now.
-# Guess LANGCODE using WWW_LANGCODE.
-LANGCODE:=	${WWW_LANGCODE}
-.if (${LANGCODE} != .)
-LANGCODE!=	${ECHO} ${DOC_PREFIX}/${WWW_LANGCODE}*
+# fixup _LANGCODE
+.if (${_LANGCODE} == .)
+# We have a short name such as `en' in ${_WWW_LANGCODE} now.
+# Guess _LANGCODE using _WWW_LANGCODE.
+_LANGCODE:=	${_WWW_LANGCODE}
+.if (${_LANGCODE} != .)
+_LANGCODE!=	${ECHO} ${DOC_PREFIX}/${_WWW_LANGCODE}*
 .for _ in 1 2 3 4 5 6 7 8 9 10
-.if !(${LANGCODE:H:T} == ${DOC_PREFIX_NAME})
-LANGCODE:=	${LANGCODE:H}
+.if !(${_LANGCODE:H:T} == ${DOC_PREFIX_NAME})
+_LANGCODE:=	${_LANGCODE:H}
 .endif
 .endfor
-LANGCODE:=	${LANGCODE:T}
+_LANGCODE:=	${_LANGCODE:T}
 .endif
 .endif
+LANGCODE?=	${_LANGCODE}
 
-# fixup WWW_LANGCODE
-.if (${WWW_LANGCODE} == .)
+# fixup _WWW_LANGCODE
+.if (${_WWW_LANGCODE} == .)
 # We have a long name such as `en_US.ISO8859-1' in ${LANGCODE} now.
-# Guess WWW_LANGCODE using LANGCODE.
-WWW_LANGCODE!=	${ECHO} ${WEB_PREFIX}/*
-WWW2_LANGCODE!=	${ECHO} ${WWW_LANGCODE:T} |\
+# Guess _WWW_LANGCODE using _LANGCODE.
+_WWW_LANGCODE!=	${ECHO} ${WEB_PREFIX}/*
+_WWW2_LANGCODE!=	${ECHO} ${_WWW_LANGCODE:T} |\
 		${SED} -e 's,.*\(${LANGCODE:R:C,(..)_.*,\1,}[^. ]*\).*,\1,'
-.if ${WWW_LANGCODE:T} == ${WWW2_LANGCODE}
-WWW_LANGCODE:= .
+.if ${_WWW_LANGCODE:T} == ${_WWW2_LANGCODE}
+_WWW_LANGCODE:= .
 .else
-WWW_LANGCODE:= ${WWW2_LANGCODE}
+_WWW_LANGCODE:= ${_WWW2_LANGCODE}
 .endif
-.undef WWW2_LANGCODE
+.undef _WWW2_LANGCODE
 .endif
+WWW_LANGCODE?=	${_WWW_LANGCODE}
 
 # ------------------------------------------------------------------------
 #

----Security_Multipart(Tue_Dec_30_19:45:07_2003_467)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQA/8VczTyzT2CeTzy0RAowHAKDBPvYGXsi0vSZDD29YgXfCz5ljtgCgo+Q5
YRFDyqqJZqsGeWstDpOCkYU=
=sWTc
-----END PGP SIGNATURE-----

----Security_Multipart(Tue_Dec_30_19:45:07_2003_467)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031230.194507.56983609.hrs>