Skip to content
Snippets Groups Projects
Commit 877b59f6 authored by Christian Engwer's avatar Christian Engwer
Browse files

fixed issue of multiple invocation of the same module

[[Imported from SVN: r4510]]
parent a1009597
Branches
Tags
No related merge requests found
......@@ -29,9 +29,9 @@ CONTROL="dune.module"
parse_control() {
if test -f "$1"; then
export module=$(echo $(grep Module: "$1" | cut -d ':' -f2))
deps=$(echo $(grep Depends: "$1" | cut -d ':' -f2))
sugs=$(echo $(grep Suggests: "$1" | cut -d ':' -f2))
path=$(dirname "$1")
local deps=$(echo $(grep Depends: "$1" | cut -d ':' -f2))
local sugs=$(echo $(grep Suggests: "$1" | cut -d ':' -f2))
local path=$(dirname "$1")
if test "x$module" != "x"; then
export HAVE_${module}=yes
export PATH_${module}="$path"
......@@ -46,7 +46,7 @@ parse_control() {
find_modules() {
if test -d "$1"; then
dir=$(cd "$1" && pwd)
local dir=$(cd "$1" && pwd)
while read m; do
if test "x$m" != "x"; then
export module=""
......@@ -71,8 +71,8 @@ EOF
# $2 full path of the $CONTROL file
#
eval_control() {
command=$1
file=$2
local command=$1
local file=$2
shift 2
if test -f "$file"; then
# open subshell
......@@ -83,28 +83,28 @@ eval_control() {
# then the default implementation will be executed
eval "$(grep -v -e '^[[:alnum:]]\+:' $file)"
# execute $command
$command "$@"
$command
) || false
fi
}
_build_module() {
command=$1
module=$2
local command=$1
local module=$2
shift 2
if test "x$(eval echo \$BUILD_DONE_${command}_${module})" != "xyes"; then
echo "--- building $module ---"
# resolve dependencies
for dep in $(eval "echo \$DEPS_$module"); do
echo "--- $module depends on $dep ... calling ---"
(set -e; _build_module $command $dep "$@") || false
_build_module $command $dep
done
# resolve suggestions
for dep in $(eval "echo \$SUGS_$module"); do
echo -n "--- $module suggests $dep ... "
if test "x$(eval echo \$HAVE_$dep)" != "x"; then
echo "calling ---"
(set -e; _build_module $command $dep "$@") || false
_build_module $command $dep
else
echo "skipping ---"
fi
......@@ -112,11 +112,11 @@ _build_module() {
# really build this module
echo "--- calling $command for $module ---"
export BUILD_DONE_${command}_${module}=yes
path=$(eval "echo \$PATH_${module}")
local path=$(eval "echo \$PATH_${module}")
(
set -e
cd "$path"
eval_control $command $path/$CONTROL "$@"
eval_control $command $path/$CONTROL
) || exit 1
else
echo "--- skipping $module ---"
......@@ -124,18 +124,18 @@ _build_module() {
}
build_modules() {
command=$1
runcommand=run_$command
local command=$1
local runcommand=run_$command
shift
load_opts $command
for m in $MODULES; do
_build_module $runcommand $m "$@"
_build_module $runcommand $m
done
}
load_opts() {
command=$1
COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]')
local command=$1
local COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]')
if test "x$OPTS_FILE" != "x"; then
echo "----- loading default flags \$${COMMAND}_FLAGS from $OPTS_FILE -----"
CMD_PARAMS="$(. $OPTS_FILE; eval echo \$${COMMAND}_FLAGS)"
......@@ -204,33 +204,33 @@ run_default_make () {
run_default_all () {
load_opts autogen
run_autogen "$@"
run_autogen
load_opts configure
run_configure "$@"
run_configure
load_opts make
run_make "$@"
run_make
}
run_nothing () {
run_default_nothing "$@"
run_default_nothing
}
run_exec () {
run_default_exec "$@"
run_default_exec
}
run_update () {
run_default_update "$@"
run_default_update
}
run_autogen () {
run_default_autogen "$@"
run_default_autogen
}
run_configure () {
run_default_configure "$@"
run_default_configure
}
run_make () {
run_default_make "$@"
run_default_make
}
run_all () {
run_default_all "$@"
run_default_all
}
###############################################
......@@ -324,7 +324,7 @@ done
case "$command" in
update | autogen | configure | make | all | exec | nothing)
find_modules .
build_modules $command "$@"
build_modules $command
;;
help)
usage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment