File: addsonpatch.sh

package info (click to toggle)
espresso 5.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 146,004 kB
  • ctags: 17,245
  • sloc: f90: 253,041; sh: 51,271; ansic: 27,494; tcl: 15,570; xml: 14,508; makefile: 2,958; perl: 2,035; fortran: 1,924; python: 337; cpp: 200; awk: 57
file content (77 lines) | stat: -rwxr-xr-x 2,180 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/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"

# bisogna prendere il nome del plugin in input
ADDSON_NAME="$1"

LINKED_FILES="$2/*.f90"
WHERE_LINKS="$3/"

echo "The NAME of the addson is: $ADDSON_NAME"
echo "LINKED_FILES are: $LINKED_FILES"
echo "WHERE_LINKS are: $WHERE_LINKS"

function to_do_before_patch () {
  echo > /dev/null
  cp $destination/make.sys $destination/make.sys.pre$ADDSON_NAME
  cp $destination/$WHERE_LINKS/Makefile $destination/$WHERE_LINKS/Makefile.pre$ADDSON_NAME
  if test -e $destination/$WHERE_LINKS/make.depend ; then 
    cp $destination/$WHERE_LINKS/make.depend $destination/$WHERE_LINKS/make.depend.pre$ADDSON_NAME
  fi
}

function to_do_after_patch () {
  {
    echo -n "${ADDSON_NAME}_OBJECTS=" 
    for file in $destination/$LINKED_FILES
      do f=${file##*/}
      echo " \\"
      echo -n "	${f%.f90}.o"
    done
    echo
    echo -n "${ADDSON_NAME}_SRC="
    for file in $destination/$LINKED_FILES
      do f=${file##*/}
      echo " \\"
      echo -n "	${f%.f90}.f90"
    done
    echo
    echo
  } >> $destination/$WHERE_LINKS/$ADDSON_NAME.inc
}

function to_do_before_revert () {
  rm $destination/$WHERE_LINKS/$ADDSON_NAME.inc
 echo > /dev/null
}

function to_do_after_revert () {
  echo > /dev/null
  mv $destination/make.sys.pre$ADDSON_NAME $destination/make.sys
  mv $destination/$WHERE_LINKS/Makefile.pre$ADDSON_NAME $destination/$WHERE_LINKS/Makefile
  if test -e $destination/$WHERE_LINKS/make.depend.pre$ADDSON_NAME ; then \
  mv $destination/$WHERE_LINKS/make.depend.pre$ADDSON_NAME $destination/$WHERE_LINKS/make.depend ; fi
}

#########

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