1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
samba-mirror/source4/heimdal_build/et_compile_wrapper.sh
Stefan Metzmacher 3f073b4c6b r25736: make sure we include "config.h" as first header
in code generated from et_compile

metze
(This used to be commit 8757b09052)
2007-12-21 05:43:35 +01:00

80 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
SELF=$0
SELFDIR=`dirname ${SELF}`
SRCDIR=$1
BUILDDIR=$2
DESTDIR=$3
CMD=$4
FILE=$5
SOURCE=$6
shift 6
test -z "${SRCDIR}" && {
echo "${SELF}:SRCDIR: '${SRCDIR}'" >&2;
exit 1;
}
test -z "${BUILDDIR}" && {
echo "${SELF}:BUILDDIR: '${BUILDDIR}'" >&2;
exit 1;
}
test -z "${DESTDIR}" && {
echo "${SELF}:DESTDIR: '${DESTDIR}'" >&2;
exit 1;
}
test -z "${CMD}" && {
echo "${SELF}:CMD: '${CMD}'" >&2;
exit 1;
}
test -z "${FILE}" && {
echo "${SELF}:FILE: '${FILE}'" >&2;
exit 1;
}
test -z "${SOURCE}" && {
echo "${SELF}:SOURCE: '${SOURCE}'" >&2;
exit 1;
}
CURDIR=`pwd`
cd ${SRCDIR} && {
ABS_SRCDIR=`pwd`
cd ${CURDIR}
} || {
echo "${SELF}:cannot cd into '${SRCDIR}'" >&2;
exit 1;
}
cd ${BUILDDIR} && {
ABS_BUILDDIR=`pwd`
cd ${CURDIR}
} || {
echo "${SELF}:cannot cd into '${BUILDDIR}'" >&2;
exit 1;
}
cd ${DESTDIR} && {
${ABS_BUILDDIR}/${CMD} ${ABS_SRCDIR}/${FILE} >&2 || exit 1;
cd ${CURDIR}
TMP="${SOURCE}.$$"
mv ${SOURCE} ${TMP} && {
echo "#include \"config.h\"" > ${SOURCE} && {
cat ${TMP} >> ${SOURCE}
}
}
rm ${TMP}
} || {
echo "${SELF}:cannot cd into '${BUILDDIR}'" >&2;
exit 1;
}
exit 0;