added two embrionary scripts for addson integration

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@10553 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
marsamos 2013-10-25 09:58:40 +00:00
parent 7ffa66f4dd
commit fb72c42152
2 changed files with 142 additions and 0 deletions

65
install/addsonpatch.sh Executable file
View File

@ -0,0 +1,65 @@
#!/bin/bash
# PATCH SCRIPT FOR QE Makefiles with addson
#
# this script needs to be launched from the root directory of the host code
# two arguments are neede where the addson source code is and
# where the source code has to be linked in order to be
# compiled by QE
# This script has been adapted from an original patch script
# of plumed (www.plumed-code.org)
destination="$PWD"
echo "root directory of host package: $destination"
LINKED_FILES="$1/*.f90"
WHERE_LINKS="$2/"
echo "LINKED_FILES are: $LINKED_FILES"
echo "WHERE_LINKS are: $WHERE_LINKS"
function to_do_before_patch () {
echo > /dev/null
}
function to_do_after_patch () {
{
echo -n "ADDSON_OBJECTS="
for file in $destination/$LINKED_FILES
do f=${file##*/}
echo " \\"
echo -n " ${f%.f90}.o"
done
echo
echo -n "ADDSON_SRC="
for file in $destination/$LINKED_FILES
do f=${file##*/}
echo " \\"
echo -n " ${f%.f90}.f90"
done
echo
echo
} > $destination/$WHERE_LINKS/ADDSON.inc
cp $destination/make.sys $destination/make.sys.original
}
function to_do_before_revert () {
rm $destination/$WHERE_LINKS/addson.inc
}
function to_do_after_revert () {
echo > /dev/null
mv $destination/make.sys.original $destination/make.sys
}
#########
NAME="$0"
echo "NAME $NAME "
if test -e $destination/install/addsontool.sh ; then
source $destination/install/addsontool.sh
else
echo "missing file addsontool.sh in install directory"
EXIT
fi

77
install/addsontool.sh Executable file
View File

@ -0,0 +1,77 @@
#!/bin/bash
# everything is performed in the destination directory
cd "$destination"
if [ "$#" -eq 0 ];
then
echo "USAGE :"
echo "$NAME WHERE_SOURCE WHERE_LINKS (-patch) (-revert) "
echo "WHERE_SOURCE is the relative path to the sources of the Addson code "
echo "WHERE_LINKS is the relative path to the QE directory where the addson sources have to be linked"
echo " -patch : apply patch to Makefiles "
echo " -revert : revert Makefiles to original "
echo " )"
exit
fi
case "$3" in
(-patch)
echo "* I will try to patch needed files for integrated compilation ..."
#-------------------
to_do_before_patch
echo "-- Setting up symlinks"
for file in $destination/$LINKED_FILES ; do
base="${file##*/}"
if test -e $destination/$WHERE_LINKS/$base ; then
echo "PATCH ERROR: file $base is already in $WHERE_LINKS"
exit 1
fi
ln -s $file $destination/$WHERE_LINKS/$base
done
echo "-- Executing post script"
to_do_after_patch
echo "- DONE!"
;;
(-revert)
echo "* I will try to revert ..."
echo "-- Executing pre script"
to_do_before_revert
echo "-- Removing symlinks"
for file in $destination/$LINKED_FILES ; do
base="${file##*/}"
if test -e $destination/$WHERE_LINKS/$base ; then
rm $destination/$WHERE_LINKS/$base
else
echo "where_links base: destination$WHERE_LINKS/$base"
echo "PATCH WARNING: file $base is not in $destination/$WHERE_LINKS"
fi
done
echo "-- Restoring .original files"
PREADDSON=$(find . -name "*.original")
if ! test "$PREADDSON" ; then
echo "-- I cannot find any .original file"
echo "* ABORT"
exit
fi
echo "-- Executing post script"
to_do_after_revert
echo "* DONE!"
;;
(*)
echo "Missing input argument"
esac