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

* distinguish between installed and src modules,

* duneproject get's the installed list from modules.inc
* install dune.module file so that dunecontrol can find it

[[Imported from SVN: r5180]]
parent 3e61921f
Branches
Tags
No related merge requests found
......@@ -10,10 +10,12 @@ AUTOMAKE_OPTIONS = foreign 1.5
SUBDIRS = lib common doc bin m4 am
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dune-common.pc
pkgconfig_DATA = @DUNE_MOD_NAME@.pc
moduledir = $(libdir)/dunecontrol/@DUNE_MOD_NAME@
module_DATA = dune.module
# use configured compiler for "make distcheck"
# doxygen is difficult to convince to build in a special directory...
DISTCHECK_CONFIGURE_FLAGS = CXX="$(CXX)" CC="$(CC)" --enable-parallel=@ENABLE_PARALLEL@ MPICC="$(MPICC)"
include $(top_srcdir)/am/global-rules
......@@ -88,12 +88,10 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`canonicalpath $0`/../lib/pkgconfig"
#
build_modules() {
command="$1"
shift
load_opts $command
local runcommand=run_$command
modules="$MODULES"
if test x"$ONLY" != x; then
modules="$ONLY"
fi
modules="$@"
for module in $modules; do
local path=$(eval "echo \$PATH_${module}")
eval echo "--- calling $command for \$NAME_${module} ---"
......@@ -513,6 +511,7 @@ done
case "$command" in
print)
create_module_list
echo "FOUND_MODULES=$FOUND_MODULES"
eval "print_module_list ' ' $MODULES"
echo >&2
;;
......@@ -626,11 +625,16 @@ EOF
*)
if is_command $command; then
create_module_list
NAMES=""
BUILDMODULES=""
for mod in $MODULES; do
if test "$(eval echo \$INST_$mod)" != "yes"; then
NAMES="$NAMES$(eval echo \$NAME_$mod) "
BUILDMODULES="$BUILDMODULES$mod "
fi
done
echo "--- going to build $NAMES ---"
build_modules $command
build_modules $command $BUILDMODULES
echo "--- done ---"
else
usage
......
......@@ -22,6 +22,51 @@ fi
###############################################
canonicalname(){
if test $# -ne 1; then
echo Usage: canonicalname path >&2
return 1
fi
file="$1"
if test ! -e "$file"; then
echo $file: file not found >&2
return 1
fi
# if this is a symlink, then follow the symlink
if test -L "$file"; then
fdir="`dirname \"$file\"`"
flink="`readlink \"$file\"`"
if test -e "$flink"; then
# these are absolute links, or links in the CWD
canonicalname "$flink"
else
canonicalname "$fdir/$flink"
fi
else
# if this is a file, then remember the filename and
# canonicalize the directory name
if test -f "$file"; then
fdir="`dirname \"$file\"`"
fname="`basename \"$file\"`"
fdir="`canonicalname \"$fdir\"`"
echo "$fdir/$fname"
fi
# if this is a directory, then create an absolute
# directory name and we are done
if test -d "$file"; then
(cd "$file"; pwd)
fi
fi
}
canonicalpath(){
if test $# -ne 1; then
echo Usage: canonicalpath path >&2
return 1
fi
dirname $(canonicalname "$1")
}
#
# read paramters from a $CONTROL file
#
......@@ -40,13 +85,27 @@ parse_control() {
echo "ERROR: $CONTROL files $1 does not contain a Module entry" >&2
exit 1
fi
# create and check variable name from module name
export module_inst=""
export module=$(fix_variable_name $name)
# read dune.module file
local deps="$(echo $($GREP Depends: "$1" | cut -d ':' -f2))"
local sugs="$(echo $($GREP Suggests: "$1" | cut -d ':' -f2))"
local vers="$(echo $($GREP Version: "$1" | cut -d ':' -f2))"
local main="$(echo $($GREP Maintainer: "$1" | cut -d ':' -f2))"
local path="$(dirname "$1")"
# create and check variable name from module name
export module=$(fix_variable_name $name)
# guess the path of the dune module:
# - installed module: ${path}/lib/dunecontrol/${name}/dune.module
# and there is a file ${path}/lib/pkgconfig/${name}.pc
# - source module: ${path}/dune.module
# and there is a file ${path}/${name}.pc.in
local path="$(canonicalpath "$1")"
if test -f $path/../../../lib/dunecontrol/${name}/dune.module; then
path=$(canonicalname "$path/../../../")
export module_inst="true"
export INST_${module}=yes
else
export INST_${module}=no
fi
if ! check_modname "$module"; then
echo "ERROR: $CONTROL files $1 contains an invalid Module entry" >&2
exit 1
......@@ -85,12 +144,20 @@ find_modules_in_path() {
if test -z "$FOUND_MODULES"; then
# foreach dir in $@
while read dir; do
find_modules $dir
if test -d "$dir"; then
while read m; do
find_modules $m
done <<EOFM
$(find "$dir" -name $CONTROL | $GREP -v 'dune-[-_a-zA-Z]/dune\-[-a-zA-Z_]*\-[0-9]\+.[0-9]\+/')
EOFM
else
find_modules $dir
fi
done <<EOF
$(echo $DUNE_CONTROL_PATH | sed -e 's/:/\n/g')
$(echo $DUNE_CONTROL_PATH | tr ':' '\n')
EOF
export FOUND_MODULES="$MODULES$INSTMODULES"
fi
export FOUND_MODULES=$MODULES
}
#
......@@ -100,27 +167,19 @@ EOF
# $1 directory to search for modules
#
find_modules() {
if test -d "$1"; then
local dir="$(cd "$1" && pwd)"
while read m; do
if test "x$m" != "x"; then
export module=""
parse_control "$m"
export MODULES="$MODULES $module"
fi
done <<EOF
$(find "$dir" -name $CONTROL | $GREP -v 'dune-[-_a-zA-Z]/dune\-[-a-zA-Z_]*\-[0-9]\+.[0-9]\+/')
EOF
else
if test -f "$1" &&
test "$(basename $1)" = "$CONTROL"; then
if test -f "$1" &&
test "$(basename $1)" = "$CONTROL"; then
export module=""
export module_inst=""
parse_control "$1"
export MODULES="$MODULES $module"
else
echo "ERROR: '$1' is neither a directory nor a $CONTROL file" >&2
if test -n "$module_inst"; then
export INSTMODULES="$MODULES$module "
else
export MODULES="$MODULES$module "
fi
else
echo "ERROR: '$1' is no $CONTROL file" >&2
false
fi
fi
}
......
......@@ -145,32 +145,30 @@ echo
# create PKG_CONFIG_PATH for installed dune modules
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(canonicalpath $0)/../lib/pkgconfig"
if [ "$MODULES" = "" ]; then
find_modules_in_path
fi
# search for modules, both installed and src modules
find_modules_in_path
echo "FOUND_MODULES=$FOUND_MODULES"
# get the real module names
SRC_MODULES=""
for i in $MODULES; do
MODULES=""
for i in $FOUND_MODULES; do
mod=$(eval echo \$NAME_$i)
SRC_MODULES="$SRC_MODULES $mod"
done
MODULES="$SRC_MODULES$mod "
echo "$i ... MODULES=$MODULES" >&2
# get installed modules
PKG_MODULES="`pkg-config --list-all | grep dune | cut -d' ' -f1`"
# merge lists
ALL_MODULES="`echo $SRC_MODULES $PKG_MODULES | tr ' ' '\n' | sort | uniq`"
done
echo "MODULES=$MODULES" >&2
if [ "$ALL_MODULES" = "" ]; then
echo "ERROR">&2
echo "No dune modules were found!">&2
echo "Did you forget to specify the places where ">&2
echo "you installed your modules in the ">&2
echo "DUNE_CONTROL_PATH environment variable">&2
echo "and adjusted the PKG_CONFIG_PATH environment">&2
echo "accordingly?" >&2
if [ "$MODULES" = "" ]; then
echo "ERROR:">&2
echo " No dune modules were found!">&2
echo " Did you forget to specify the places where ">&2
echo " you installed your modules in the ">&2
echo " DUNE_CONTROL_PATH environment variable">&2
echo " and adjusted the PKG_CONFIG_PATH environment">&2
echo " accordingly?" >&2
exit 1;
fi
......@@ -180,7 +178,7 @@ while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do
PROJECT=""
while [ -z $PROJECT ]; do
read -p "1) Name of your new Project? (e.g.: dune-grid): " PROJECT
if echo "$ALL_MODULES" | grep -q ^$PROJECT$; then
if echo "$MODULES" | grep -q ^$PROJECT$; then
read -p " A module named $PROJECT already exists. Continue anyway? [y/N] " CONT
if test x$DELETE = xy -o x$DELETE = xY; then
PROJECT=""
......@@ -195,13 +193,14 @@ while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do
DEPENDENCIES=""
echo "2) Which modules should this module depend on?"
echo " Following modules are found:"
for i in $ALL_MODULES; do echo -n " $i"; done
echo ""
echo " $MODULES"
# for i in $MODULES; do echo -n " $i"; done
# echo ""
while [ -z "$DEPENDENCIES" ]; do
read -p " Enter space separated list: " DEPENDENCIES
read -p " Enter space separated list: " DEPENDENCIES
done
set +e
modulesexist "$DEPENDENCIES" "$ALL_MODULES"
modulesexist "$DEPENDENCIES" "$MODULES"
DEPOK=$?
set -e
done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment