diff options
author | Mark Ferrell <major@homeonderanged.org> | 2014-04-15 09:44:44 -0700 |
---|---|---|
committer | Mark Ferrell <major@homeonderanged.org> | 2014-04-15 09:50:36 -0700 |
commit | b780df8b59b54048f08cc1fb2bce8ecd49390c6e (patch) | |
tree | b3d51148213f78a14ee681e03654c9e7cd4adee6 | |
parent | ce8bcac04f86f97676ca80a3ba03e015088d8c47 (diff) |
Enable include() directive.
* Add routine for including files found in ${BUILDER_CONFIG}
-rwxr-xr-x | build | 27 |
1 files changed, 14 insertions, 13 deletions
@@ -89,6 +89,18 @@ import() BUILDER_CALL_STACK="${BUILDER_CALL_STASH}" } +## include +# include a builder config. +# This command simply sources the named config found in TOPDIR/.builder/ +include() +{ + set -- "${1}" "`echo "${1}" | tr '-' '_'`" + test -f "${BUILDER_CFGDIR}/${1}" || die "config not found '${1}'" + eval "test -z '\${BUILDER_INCLUDE_${2}}'" || return + . "${BUILDER_CFGDIR}/${1}" + eval "BUILDER_INCLUDE_${2}='${BUILDER_CFGDIR}/${1}" +} + # FIXME we need a build-resolv subcmd for resolving package names parse_pkg_name() { @@ -294,19 +306,8 @@ BUILDER_PATH="${BUILDER_LIBDIR}:${PATH}" PATH="${BUILDER_PATH}" export BUILDER_PATH PATH -# FIXME The original idea here is to allow a "default" environment, that has a "default" -# override... Basically we set some default variables, and then load the -# default config, and THEN let the target config override anything set. This -# is really confusing, and totally obsolted by an 'include' option in the configs. -test -f "${BUILDER_CFGDIR}/config" && . "${BUILDER_CFGDIR}/config" -BUILDER_CONFIG="${BUILDER_CONFIG:-config}" -if [ "${BUILDER_CONFIG}" != 'config' ]; then - if [ ! -f "${BUILDER_CFGDIR}/${BUILDER_CONFIG}" ]; then - die "invalid config '${BUILDER_CONFIG}'" - fi - . "${BUILDER_CFGDIR}/${BUILDER_CONFIG}" -fi -export BUILDER_CONFIG +# include our default config +test -f "${BUILDER_CFGDIR}/config" && include config # FIXME MAKE_OPTS should default to #CPUS + 1, until we can detect #CPUS, we # just set it to 2 for uni-processor systems. |