#############
# VARIABLES #
#############
-SETUPS_DIR=../../../source/diameter/stack/setups
-MSGDTD=../../../include/anna/diameter/codec/message.dtd
-DCTDTD=../../../include/anna/diameter/stack/dictionary.dtd
-SERVICES=./resources/services_examples
-STACK_EXAMPLES=./resources/stack_examples
+SCR_DIR=`readlink -f $(dirname $0)`
+PROJECT_ROOT=$(readlink -f ../../..)
+SETUPS_DIR=$PROJECT_ROOT/source/diameter/stack/setups
+MSGDTD=$PROJECT_ROOT/include/anna/diameter/codec/message.dtd
+DCTDTD=$PROJECT_ROOT/include/anna/diameter/stack/dictionary.dtd
+SERVICES=$SCR_DIR/resources/services_examples
+STACK_EXAMPLES=$SCR_DIR/resources/stack_examples
SRVDTD=$SERVICES/services.dtd
-
-# Executables in priority order:
-EXEC_installed=/opt/bin/anna/example_diameter_launcher
-EXECS=( $EXEC_installed ./release/example_diameter_launcher ./debug/example_diameter_launcher )
-
-# Stack management
-STACKMGMT_EXEC_installed=/opt/bin/anna/example_diameter_stackManagement
-STACKMGMT_EXECS=( $STACKMGMT_EXEC_installed ../stackManagement/release/example_diameter_stackManagement ../stackManagement/debug/example_diameter_stackManagement )
-
-# Dynamic library:
-#DYNLIB_installed=/usr/local/lib/libanna_dynamicLauncherProcedure.so
-#DYNLIBS=( $DYNLIB_installed ../../../dynamic/launcher/default/release/libanna_dynamicLauncherProcedure.so ../../../dynamic/launcher/default/debug/libanna_dynamicLauncherProcedure.so )
+VARIANT=
#############
# FUNCTIONS #
#############
_exit () {
- echo
- echo $1
- echo
+ echo -e "\n$1\n"
exit 1
}
#############
# EXECUTION #
#############
-cd `dirname $0`
+cd $SCR_DIR
+
echo
echo "---------------------------------------"
echo "Anna Diameter Launcher (ADML) deployment"
echo
echo "Basic checkings ..."
-# Launcher executable:
-available=
-for EXEC in ${EXECS[@]}; do
- echo -n "Looking executable at '$EXEC' ... "
- [ -x $EXEC ] && { available=yes ; echo "available !" ; break ; }
- echo "not found"
-done
-[ -z "$available" ] && _exit "Anna Diameter Launcher (ADML) is not installed neither linked. See README.md (Install section)."
-
-# Dynamic library variant:
-dynlib_variant=
-[ -f ./release/example_diameter_launcher ] && dynlib_variant=release
-[ -f ./debug/example_diameter_launcher ] && dynlib_variant=debug
-[ -z "$dynlib_variant" ] && _exit "Unknown dynamic library variant"
-
-# Dictionary creation:
-available=
-for STACKMGMT_EXEC in ${STACKMGMT_EXECS[@]}; do
- echo -n "Looking stack management executable at '$STACKMGMT_EXEC' ... "
- [ -x $STACKMGMT_EXEC ] && { available=yes ; echo "available !" ; break ; }
- echo "not found"
-done
-[ -z "$available" ] && _exit "Anna Diameter Stack Management Tool is not installed neither linked. See README.md (Install section)."
-STACKMGMT_EXEC=`readlink -f $STACKMGMT_EXEC`
-
-# Dynamic library:
-#available=
-#for DYNLIB in ${DYNLIBS[@]}; do
-# echo -n "Looking dynamic library at '$DYNLIB' ... "
-# [ -x $DYNLIB ] && { available=yes ; echo "available !" ; break ; }
-# echo "not found"
-#done
-#[ -z "$available" ] && _exit "Anna Diameter Launcher Dynamic Procedure Library (ADML) is not installed neither linked. See README.md (Install section)."
+# Get variant and main executables:
+[ -f $SCR_DIR/release/example_diameter_launcher ] && VARIANT=release
+[ -f $SCR_DIR/debug/example_diameter_launcher ] && VARIANT=debug
+[ -z "$VARIANT" ] && _exit "Cannot locate neither 'release' nor 'debug' variant !"
+echo "Variant: $VARIANT"
+ADML_EXEC=$SCR_DIR/$VARIANT/example_diameter_launcher
+STACKMGMT_EXEC=$(readlink -f $SCR_DIR/../stackManagement/$VARIANT/example_diameter_stackManagement)
[ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR)."
# Dynamic libs:
mkdir -p $DPATH/dynlibs
-cd ../../../dynamic/launcher
-DYNLIBS=( $(find . -name "*.so") )
-for dl in ${DYNLIBS[@]}
+DYNLIBS=( $(find $PROJECT_ROOT -name "*.so" | grep -w $VARIANT) )
+
+for dynlib in ${DYNLIBS[@]}
do
- dir=$(dirname $dl | xargs dirname)
- mkdir -p $DPATH/dynlibs/$dir
- cp $dir/$dynlib_variant/*.so $DPATH/dynlibs/$dir
- cp $dir/*.xml $DPATH/dynlibs/$dir 2>/dev/null
- cp $dir/dynamic.suffix $DPATH/dynlibs/$dir 2>/dev/null
- cp -r $dir/services $DPATH/dynlibs/$dir 2>/dev/null
+ dynlib_bn=$(basename $dynlib)
+ if [ "$dynlib_bn" != "libanna_dynamicLauncherProcedure.so" ]
+ then
+ cp $dynlib $DPATH/dynlibs
+ else
+ ########## ADML Dynamic libs system ##########
+ # Create structure from $PROJECT_ROOT/dynamic/launcher
+ suffix_path=$(echo $dynlib | awk -F"$PROJECT_ROOT/dynamic/launcher/" '{ print $2 }')
+ target=$(dirname $DPATH/dynlibs/$(dirname $suffix_path))
+ mkdir -p $target
+ cp $dynlib $target
+
+ # Additional resources
+ dynlib_dn=$(dirname $dynlib)
+ dynlib_dn_dn=$(dirname $dynlib_dn)
+ cp $dynlib_dn_dn/*.xml $target 2>/dev/null
+ cp $dynlib_dn_dn/dynamic.suffix $target 2>/dev/null
+ cp -r $dynlib_dn_dn/services $target 2>/dev/null
+ fi
done
-cd - >/dev/null
-cp ./resources/scripts/select_dynlib.sh $DPATH/dynlibs/select.sh
+
+# ADML dynamic libs selection script:
+cp $SCR_DIR/resources/scripts/select_dynlib.sh $DPATH/dynlibs/select.sh
+
+# Default dynamic library:
cd $DPATH/dynlibs
ln -s default/libanna_dynamicLauncherProcedure.so
cd - >/dev/null
+# Basic setup:
[ "$option" = "b" ] && mkdir -p $DPATH/services
-# ADML executable:
-if [ "$EXEC" = "$EXEC_installed" ]
-then
- ln -s $EXEC_installed $DPATH/ADML-launcher
-else
- cp $EXEC $DPATH/ADML-launcher
-fi
-
-# Stack management tool:
-if [ "$STACKMGMT_EXEC" = "$STACKMGMT_EXEC_installed" ]
-then
- ln -s $STACKMGMT_EXEC_installed $DPATH/stacks/stack-mgmt
-fi
-# Copy binary just in case:
+# Copy executables:
+cp $ADML_EXEC $DPATH/ADML-launcher
[ ! -f $DPATH/stacks/stack-mgmt ] && cp $STACKMGMT_EXEC $DPATH/stacks/stack-mgmt
+# Copy resources:
cp -rL $DEPLOYMENTS_DIR/* $DPATH
cp $SETUPS_DIR/*xml $DPATH/stacks
cp $SETUPS_DIR/*sh $DPATH/stacks
fi
# Help:
+echo "Done !"
+echo "(see README at '$DPATH')"
echo
-echo "Go to '$DPATH' and see README file"
-echo
-echo "Done!"
-echo
-echo
-
anna_libpaths = []
anna_libs = []
-modules = [ 'core', 'io', 'xml', 'app', 'http', 'comm', 'timex', 'http', 'statistics', 'time', 'diameter', 'diameter_comm', 'testing' ];
+modules = [ 'core', 'io', 'xml', 'app', 'http', 'comm', 'timex', 'http', 'statistics', 'time', 'diameter', 'diameter_comm' ];
for module in modules:
anna_libs.append ("anna_" + module)
module = module.replace("_", ".")
# dynamic lib:
anna_libs.append ("anna_dynamicLauncherProcedure")
+anna_libs.append ("anna_testing")
variant = env ['VARIANT']
dynamic_libpath = os.path.join (pwd, "../../../../dynamic/launcher/default/" + variant)
anna_libpaths.append (dynamic_libpath)
+dynamic_libpath = os.path.join (pwd, "../../../../source/testing/" + variant)
+anna_libpaths.append (dynamic_libpath)
anna_rlibs = list(anna_libs)
anna_rlibs.reverse()
current_directory = Dir ('.').abspath
dynamic_include = os.path.join (pwd, "../../../../dynamic/launcher/default/")
localEnv.Append (CPPPATH = [current_directory, dynamic_include])
+#dynamic_include = os.path.join (pwd, "../../../../include/anna/testing/")
+#localEnv.Append (CPPPATH = [current_directory, dynamic_include])
result = localEnv.Program (pName, Glob ('*.cpp'))
Return ('result')