Third part of fix for bug #8541 - readlink() on Linux clients fails if the symlink...
[Samba.git] / source4 / heimdal_build / et_compile_wrapper.sh
blob939b434767c1ac24157f0cbb7d8386d7e79813d9
1 #!/bin/sh
4 SELF="$0"
5 SELFDIR=`dirname "${SELF}"`
7 DESTDIR="$1"
8 CMD="$2"
9 FILE="$3"
10 SOURCE="$4"
11 shift 4
13 test -z "${DESTDIR}" && {
14 echo "${SELF}:DESTDIR: '${DESTDIR}'" >&2;
15 exit 1;
18 test -z "${CMD}" && {
19 echo "${SELF}:CMD: '${CMD}'" >&2;
20 exit 1;
23 test -z "${FILE}" && {
24 echo "${SELF}:FILE: '${FILE}'" >&2;
25 exit 1;
28 test -z "${SOURCE}" && {
29 echo "${SELF}:SOURCE: '${SOURCE}'" >&2;
30 exit 1;
33 CURDIR="`pwd`"
35 cd "${DESTDIR}" && {
36 # Remove older copies beforehand - MIT's compile_et uses odd permissions for these
37 # files, which makes Heimdal's compile_et fail mysteriously when writing to them.
38 rm -f `basename "${FILE}" .et`.c
39 rm -f `basename "${FILE}" .et`.h
40 "${CMD}" "${FILE}" >&2 || exit 1;
41 cd "${CURDIR}"
42 TMP="${SOURCE}.$$"
43 mv "${SOURCE}" "${TMP}" && {
44 echo "#include \"config.h\"" > "${SOURCE}" && {
45 cat "${TMP}" >> "${SOURCE}"
48 rm -f "${TMP}"
49 } || {
50 echo "${SELF}:cannot cd into '${DESTDIR}'" >&2;
51 exit 1;
54 exit 0;