File: spatch.sh.in

package info (click to toggle)
coccinelle 1.0.8.deb-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 26,148 kB
  • sloc: ml: 136,392; ansic: 23,594; sh: 2,189; makefile: 2,157; perl: 1,576; lisp: 840; python: 823; awk: 70; csh: 12
file content (51 lines) | stat: -rw-r--r-- 1,287 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
#! /bin/sh -e

# generic wrapper script to invoke 'spatch' or 'spatch.opt'
# it sets the python variables (if relevant)
# and COCCINELLE_HOME
exec_prefix=@prefix@
LIBDIR="@libdir@/coccinelle"

if test ! -d "$LIBDIR"; then
    LIBDIR="$(pwd)"
fi

COCCINELLE_HOME="${COCCINELLE_HOME:=$LIBDIR}"

if [ ! -d "${COCCINELLE_HOME}" ]; then
  echo "\$COCCINELLE_HOME is not a directory: ${COCCINELLE_HOME}" 1>&2
fi

if [ ! -r "${COCCINELLE_HOME}/standard.iso" ] ; then
  echo "There is no standard.iso in ${COCCINELLE_HOME}." 1>&2
  echo -n "Are you sure you run a properly installed version of spatch ?\n" 1>&2
else

export COCCINELLE_HOME

export LD_LIBRARY_PATH="${LIBDIR}:$LD_LIBRARY_PATH:${COCCINELLE_HOME}"
export PYTHONPATH="${COCCINELLE_HOME}/python:$PYTHONPATH"

# echo setting LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
# echo setting PYTHONPATH="$PYTHONPATH"

fi

extension="${0##*.}"
if [ "x$extension" = "xopt" ]; then
  TOOL="spatch.opt"
elif [ "x$extension" = "xbyte" ]; then
  TOOL="spatch"
else
  # autodetect
  if [ -f "${COCCINELLE_HOME}/spatch.opt" ]; then
    TOOL="spatch.opt"
  elif [ -f "${COCCINELLE_HOME}/spatch" ]; then
    TOOL="spatch"
  else
    echo "No 'spatch' nor 'spatch.opt' found in ${COCCINELLE_HOME}" 1>&2
    exit 1
  fi
fi

exec "${COCCINELLE_HOME}/${TOOL}" "$@"