-
Notifications
You must be signed in to change notification settings - Fork 0
/
znc-buildmod.in
executable file
·68 lines (56 loc) · 1.19 KB
/
znc-buildmod.in
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
#!/bin/sh
ERROR="[ !! ]"
WARNING="[ ** ]"
OK="[ ok ]"
# Check if we got everything we need
check_binary()
{
which $1 > /dev/null 2>&1
if test $? = 1 ; then
echo "${ERROR} Could not find $1. $2"
exit 1
fi
}
if test "x$CXX" = "x" ; then
CXX="@CXX@"
fi
if test "x$CXX" = "x" ; then
CXX=g++
fi
check_binary ${CXX} "What happened to your compiler?"
if test -z "$1"; then
echo "${WARNING} USAGE: $0 <file.cpp> [file.cpp ... ]"
exit 1
fi
CXXFLAGS="@CPPFLAGS@ @MODFLAGS@ -I@prefix@/include $CXXFLAGS"
LIBS="@LIBS@ $LIBS"
MODLINK="@MODLINK@ $MODLINK"
VERSION="@PACKAGE_VERSION@"
# Ugly cygwin stuff :(
if test -n "@LIBZNC@"; then
prefix="@prefix@"
exec_prefix="@exec_prefix@"
LDFLAGS="-L@libdir@ $LDFLAGS"
LIBS="-lznc $LIBS"
fi
while test -n "$1"
do
FILE=$1
shift
MOD="${FILE%.cpp}"
MOD="${MOD%.cc}"
MOD="${MOD##*/}"
if test ! -f "${FILE}"; then
echo "${ERROR} Building \"${MOD}\" for ZNC $VERSION... File not found"
exit 1
else
printf "Building \"${MOD}.so\" for ZNC $VERSION... "
if ${CXX} ${CXXFLAGS} ${INCLUDES} ${LDFLAGS} ${MODLINK} -o "${MOD}.so" "${FILE}" ${LIBS} ; then
echo "${OK}"
else
echo "${ERROR} Error while building \"${MOD}.so\""
exit 1
fi
fi
done
exit 0