From daf0dceee911d37668009d0e87449968ed03ffde Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 23 Jul 2006 15:48:01 +0000 Subject: Added some sections on variable definition. --- doc/guide/files/infr.design.xml | 65 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) (limited to 'doc/guide') diff --git a/doc/guide/files/infr.design.xml b/doc/guide/files/infr.design.xml index 4ddc3278789..d96634d46cc 100644 --- a/doc/guide/files/infr.design.xml +++ b/doc/guide/files/infr.design.xml @@ -1,4 +1,4 @@ - + Design of the pkgsrc infrastructure @@ -15,6 +15,69 @@ --> + +The meaning of variable definitions + + Whenever a variable is defined in the pkgsrc + infrastructure, the location and the way of definition provide + much information about the intended use of that variable. + Additionally, more documentation may be found in a header + comment or in this pkgsrc guide. + + A special file is + mk/defaults/mk.conf, which lists all + variables that are intended to be user-defined. They are either + defined using the ?= operator or they are + left undefined because defining them to anything would + effectively mean yes. All these variables may be + overridden by the pkgsrc user in the MAKECONF + file. + + Outside this file, the following conventions apply: + Variables that are defined using the ?= + operator may be overridden by a package. + + Variables that are defined using the = + operator may be used read-only at run-time. + + Variables whose name starts with an underscore must not be + accessed outside the pkgsrc infrastructure at all. They may + change without further notice. + + These conventions are currently not applied + consistently to the complete pkgsrc + infrastructure. + + + + +Avoiding problems before they arise + + All variables that contain lists of things should default + to being empty. Two examples that do not follow this rule are + USE_LANGUAGES and + DISTFILES. These variables cannot simply be + modified using the += operator in package + Makefiles (or other files included by + them), since there is no guarantee whether the variable is + already set or not, and what its value is. In the case of + DISTFILES, the packages know + the default value and just define it as in the following + example. + + + DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz + + + Because of the selection of this default value, the same + value appears in many package Makefiles. Similarly for + USE_LANGUAGES, but in this case the default + value (c) is so short that it + doesn't stand out. Nevertheless it is mentioned in many + files. + + + Variable evaluation -- cgit v1.2.3