]> jfr.im git - irc/evilnet/znc.git/blob - znc-buildmod.in
Merge pull request #1383 from Phansa/master
[irc/evilnet/znc.git] / znc-buildmod.in
1 #!/bin/sh
2
3 ERROR="[ !! ]"
4 WARNING="[ ** ]"
5 OK="[ ok ]"
6
7 # Check if we got everything we need
8
9 check_binary()
10 {
11 which $1 > /dev/null 2>&1
12 if test $? = 1 ; then
13 echo "${ERROR} Could not find $1. $2"
14 exit 1
15 fi
16 }
17
18 if test "x$CXX" = "x" ; then
19 CXX="@CXX@"
20 fi
21 if test "x$CXX" = "x" ; then
22 CXX=g++
23 fi
24
25 check_binary ${CXX} "What happened to your compiler?"
26
27 if test -z "$1"; then
28 echo "${WARNING} USAGE: $0 <file.cpp> [file.cpp ... ]"
29 exit 1
30 fi
31
32 CXXFLAGS="@CPPFLAGS@ @MODFLAGS@ -I@prefix@/include $CXXFLAGS"
33 LIBS="@LIBS@ $LIBS"
34 MODLINK="@MODLINK@ $MODLINK"
35 VERSION="@PACKAGE_VERSION@"
36
37 # Ugly cygwin stuff :(
38 if test -n "@LIBZNC@"; then
39 prefix="@prefix@"
40 exec_prefix="@exec_prefix@"
41 LDFLAGS="-L@libdir@ $LDFLAGS"
42 LIBS="-lznc $LIBS"
43 fi
44
45 while test -n "$1"
46 do
47 FILE=$1
48 shift
49
50 MOD="${FILE%.cpp}"
51 MOD="${MOD%.cc}"
52 MOD="${MOD##*/}"
53
54 if test ! -f "${FILE}"; then
55 echo "${ERROR} Building \"${MOD}\" for ZNC $VERSION... File not found"
56 exit 1
57 else
58 printf "Building \"${MOD}.so\" for ZNC $VERSION... "
59 if ${CXX} ${CXXFLAGS} ${INCLUDES} ${LDFLAGS} ${MODLINK} -o "${MOD}.so" "${FILE}" ${LIBS} ; then
60 echo "${OK}"
61 else
62 echo "${ERROR} Error while building \"${MOD}.so\""
63 exit 1
64 fi
65 fi
66 done
67
68 exit 0