1 # $NetBSD: pbulk-index.mk,v 1.15 2012/11/23 12:13:35 joerg Exp $
3 # This Makefile fragment is included by bsd.pkg.mk and provides all
4 # variables and targets related to the parallel bulk build
7 # The following are the "public" targets provided by this module:
13 # _PBULK_MULTI lists the multi-package variable.
14 # For each class the following variables are provided:
15 # _PBULK_MULTI_LIST.foo enumerates the supported settings
16 # _PBULK_MULTI_VAR.foo forces a specific version
17 # _PBULK_MULTI_DEFAULT.foo contains the default value
19 _PBULK_MULTI?
= apache php postgresql python ruby
21 _PBULK_MULTI_LIST.apache
= PKG_APACHE_ACCEPTED
22 _PBULK_MULTI_VAR.apache
= PKG_APACHE
23 _PBULK_MULTI_DEFAULT.apache
= PKG_APACHE_DEFAULT
25 _PBULK_MULTI_LIST.php
= PHP_VERSIONS_ACCEPTED
26 _PBULK_MULTI_VAR.php
= PHP_VERSION_REQD
27 _PBULK_MULTI_DEFAULT.php
= PHP_VERSION_DEFAULT
29 _PBULK_MULTI_LIST.postgresql
= PGSQL_VERSIONS_ACCEPTED
30 _PBULK_MULTI_VAR.postgresql
= PGSQL_VERSION_REQD
31 _PBULK_MULTI_DEFAULT.postgresql
= PGSQL_VERSION_DEFAULT
33 _PBULK_MULTI_LIST.python
= _PYTHON_VERSIONS_ACCEPTED
34 _PBULK_MULTI_VAR.python
= PYTHON_VERSION_REQD
35 _PBULK_MULTI_DEFAULT.python
= PYTHON_VERSION_DEFAULT
37 _PBULK_MULTI_LIST.ruby
= RUBY_VERSION_SUPPORTED
38 _PBULK_MULTI_VAR.ruby
= RUBY_VERSION_REQD
39 _PBULK_MULTI_DEFAULT.ruby
= RUBY_VERSION_DEFAULT
41 .PHONY
: pbulk-index pbulk-index-item
43 # Find all classes with more than one supported setting.
44 # Undefined list variables are handled like a single default value,
45 # empty list variables are checked afterwards.
47 # For each such class, reorder the supported values to list
48 # the default value first. This is important for packages that
49 # don't follow the module naming conventions.
51 .for _t in
${_PBULK_MULTI}
52 . if defined
(${_PBULK_MULTI_LIST.
${_t}}) && !empty
(${_PBULK_MULTI_LIST.
${_t}})
53 . if
${${_PBULK_MULTI_LIST.
${_t}}:[\
#]} != 1 || \
54 !empty
(${_PBULK_MULTI_LIST.
${_t}}:N
${_PBULK_MULTI_DEFAULT.
${_t}})
55 _PBULK_MULTI_NEEDED
:= ${_t} ${_PBULK_MULTI_NEEDED}
56 _PBULK_SORTED_LIST.
${_t}:= \
57 ${${_PBULK_MULTI_LIST.
${_t}}:M
${${_PBULK_MULTI_DEFAULT.
${_t}}}} \
58 ${${_PBULK_MULTI_LIST.
${_t}}:N
${${_PBULK_MULTI_DEFAULT.
${_t}}}}
63 .if
!defined
(_PBULK_MULTI_NEEDED
)
64 # No multi-package handling needed, directly print the item.
65 pbulk-index
: pbulk-index-item
68 # Use an ODE for loop to compute the carthesian product of
69 # the support settings. This expands to something like
71 # for apache in apache13 apache2; do \
72 # _PBULK_MULTI_VALUE.apache=$apache; \
73 # export _PBULK_MULTI_VALUE.apache; \
74 # PKG_APACHE=$apache; \
75 # export PKG_APACHE; \
76 # for php in 4 5; do \
77 # _PBULK_MULTI_VALUE.php=$php; \
78 # export _PBULK_MULTI_VALUE.php; \
79 # PHP_VERSION_REQD=$php; \
80 # export PHP_VERSION_REQD;
82 # Because the ODE expansion happens in the same shell instance,
83 # make gets the environment variables in the inner-most loop.
84 # A second ODE for loop is used to close the shell for loops.
87 @set
-e
; ${_PBULK_MULTI_NEEDED
:@._t.@\
88 for
${._t.
} in
${_PBULK_SORTED_LIST.
${._t.
}}; do \
89 _PBULK_MULTI_VALUE_
${._t.
}=$$${._t.
}; \
90 export _PBULK_MULTI_VALUE_
${._t.
}; \
91 ${_PBULK_MULTI_VAR.
${._t.
}}=$$${._t.
}; \
92 export ${_PBULK_MULTI_VAR.
${._t.
}};@
} \
93 ${MAKE} pbulk-index-item \
94 ${_PBULK_MULTI_NEEDED
:@._t.@
;done@
}
98 @echo
"PKGNAME="${PKGNAME
:Q
}
99 @echo
"ALL_DEPENDS="${_ALL_DEPENDS
:Q
}
100 @echo
"PKG_SKIP_REASON="${PKG_SKIP_REASON
:Q
}
101 @echo
"PKG_FAIL_REASON="${PKG_FAIL_REASON
:Q
}
102 @echo
"NO_BIN_ON_FTP="${NO_BIN_ON_FTP
:Q
}
103 @echo
"RESTRICTED="${RESTRICTED
:Q
}
104 @echo
"CATEGORIES="${CATEGORIES
:Q
}
105 @echo
"MAINTAINER="${MAINTAINER
:Q
}
106 @echo
"USE_DESTDIR="${_USE_DESTDIR
:Q
}
107 @echo
"BOOTSTRAP_PKG="${BOOTSTRAP_PKG}
108 @echo
"USERGROUP_PHASE="${USERGROUP_PHASE
:Q
}
109 @echo
"SCAN_DEPENDS="${.MAKE.MAKEFILES
:Q
}
110 .if defined
(_PBULK_MULTI_NEEDED
)
111 @printf
"MULTI_VERSION="
112 .for _t in
${_PBULK_MULTI_NEEDED}
113 @printf
" %s=%s" ${_PBULK_MULTI_VAR.
${_t}:Q
} ${_PBULK_MULTI_VALUE_
${_t}:Q
}
119 ${RUN} [ ! -d
${WRKDIR} ] || cd
${WRKDIR} && ${TAR} cfz
${INTO
:Q
} .