Files
znc/modules/buildmod.in
imaginos 1cdb55995c more sun adeptations
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@12 726aef4b-f618-498e-8847-2d620e286838
2004-08-24 22:43:56 +00:00

71 lines
1.1 KiB
Bash

#!/usr/bin/bash
CXXFLAGS="@MODFLAGS@"
LIBS="@LIBS@"
if test -z "$1"; then
echo "Usage: $0 [--cflags] [--libs] | --all | <module> [...]"
exit 1
fi
if [ -z "$CXX" ]; then
CXX="g++"
fi
if [ "$1" = "--cflags" ]; then
echo "$CXXFLAGS"
exit 0
fi
if [ "$1" = "--libs" ]; then
echo "$LIBS"
exit 0
fi
if [ "$1" = "--all" ]; then
FILES="email raw sample shell"
if `echo $CXXFLAGS | grep 'HAVE_LIBSSL' >/dev/null 2>/dev/null`; then
FILES="$FILES schat savebuff"
fi
else
FILES=$@
fi
for arg in $FILES
do
if test -d $arg && test "$arg" != "CVS"; then
(cd $arg && make || exit 1)
elif test -f "$arg"; then
FILE="$arg"
MOD="${FILE%.cpp}"
MOD="${MOD%.cc}"
elif test -f "$arg.cpp"; then
FILE="$arg.cpp"
MOD="$arg"
elif test -f "$arg.cc"; then
FILE="$arg.cc"
MOD="$arg"
else
continue
fi
rm -f "$MOD.so"
if test -n "$FILE"; then
COMMAND="$CXX $CXXFLAGS -c $FILE"
echo $COMMAND
$COMMAND || exit 1
COMMAND="$CXX $CXXFLAGS -shared -o $MOD.so $MOD.o $LIBS"
echo $COMMAND
$COMMAND || exit 1
fi
if ! test -f "$MOD.so"; then
echo "Failed to build $MOD.so!"
exit 1
else
echo "Built $MOD.so"
fi
done
exit 0