5 # $Date: 2010/05/09 12:39:01 $
6 ######################################################
8 # Installation path prefix
12 # Binaries access bits
16 # Data files access bits
24 # Binaries and data files owner
30 release=`uname -r | cut -b1`
32 CONFFILE="../../Makefile.conf"
33 VAR_DIR="./inst/var/stargazer"
34 MIN_XMLRPCC_VERSION="1.06.27"
35 XMLRPC_FEATURES="c++2 abyss-server"
41 MAKEOPTS="$MAKEOPTS -j1"
42 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
49 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
50 LDFLAGS="$LDFLAGS -L/usr/local/lib"
52 if [ "$sys" = "Linux" ]
56 ETC_DIR="./inst/linux/etc/stargazer"
60 if [ "$sys" = "FreeBSD" ]
71 ETC_DIR="./inst/freebsd/etc/stargazer"
75 if [ "$OS" = "unknown" ]
77 echo "#############################################################################"
78 echo "# Sorry, but stargazer currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #"
79 echo "#############################################################################"
83 echo "#############################################################################"
84 echo " Building STG 2.4 for $sys $release"
85 echo "#############################################################################"
97 PLUGINS="authorization/ao
98 authorization/inetaccess
99 configuration/sgconfig
107 if [ "$OS" = "linux" ]
116 DEFS="$DEFS -DFREE_BSD"
119 DEFS="$DEFS -DFREE_BSD5"
120 if [ "$OS" = "bsd7" ]
128 capture/ether_freebsd
129 capture/divert_freebsd"
142 echo -n "Checking CC... "
143 $CC --version > /dev/null 2> /dev/null
151 echo -n "Checking CXX... "
152 $CXX --version > /dev/null 2> /dev/null
156 echo "$CXX not found"
161 echo -n "Checking endianess... "
162 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
163 $CC $CFLAGS $LDFLAGS build_check.c -o fake
167 echo "Endianess checking failed"
174 CXXFLAGS="$CXXFLAGS -DARCH_LE"
175 CFLAGS="$CFLAGS -DARCH_LE"
179 CXXFLAGS="$CXXFLAGS -DARCH_BE"
180 CFLAGS="$CFLAGS -DARCH_BE"
186 echo -n "Checking for -lexpat... "
187 echo "int main() { return 0; }" > build_check.c
188 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
199 echo -n "Checking for -lfbclient... "
200 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
211 echo -n "Checking for mysql_config... "
212 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
216 echo -n "Checking for -lmysqlclient... "
217 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
223 CHECK_MYSQLCLIENT=yes
229 echo -n "Checking for mysql_config --cflags... "
230 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
236 echo "[$MYSQL_CFLAGS]"
237 echo -n "Checking for mysql_config --libs_r... "
238 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
244 CHECK_MYSQLCLIENT=yes
245 echo "[$MYSQL_LDFLAGS]"
250 echo -n "Checking for pg_config... "
251 PG_VERSION=`pg_config --version 2> /dev/null`
255 echo -n "Checking for -lpq... "
256 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
268 echo -n "Checking for pg_config --includedir... "
269 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
276 echo -n "Checking for pg_config --libdir... "
277 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
289 echo -n "Checking for xmlrpc-c-config... "
290 XMLRPCC_VERSION=`xmlrpc-c-config $XMLRPC_FEATURES --version 2> /dev/null`
294 echo -n "Checking for -lxmlrpc... "
295 $CC $CFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
305 elif [ "$XMLRPCC_VERSION" \< "$MIN_XMLRPCC_VERSION" ]
307 echo "no (need at least $MIN_XMLRPCC_VERSION, actual $XMLRPCC_VERSION)";
310 echo "yes (version $XMLRPCC_VERSION)";
311 echo -n "Checking for xmlrpc-c-config --cflags... "
312 XMLRPC_CFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --cflags 2> /dev/null`
318 echo "[$XMLRPC_CFLAGS]"
319 echo -n "Checking for xmlrpc-c-config --libs... "
320 XMLRPC_LDFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --libs 2> /dev/null`
327 echo "[$XMLRPC_LDFLAGS]"
332 if [ "$OS" = "linux" ]
334 echo -n "Checking for linux/netfilter_ipv4/ip_queue.h... "
335 echo "#include <linux/types.h>" > build_check.c
336 echo "#include <linux/netfilter_ipv4/ip_queue.h>" >> build_check.c
337 echo "int main() { return 0; }" >> build_check.c
338 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
345 DEFS="$DEFS -DHAS_IP_QUEUE_H"
355 if [ "$CHECK_EXPAT" != "yes" ]
357 echo "-lexpat not found!"
361 if [ "$CHECK_FBCLIENT" = "yes" ]
369 if [ "$CHECK_PQ" = "yes" ]
375 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
381 if [ "$CHECK_XMLRPC" = "yes" ]
384 configuration/rpcconfig"
387 echo "OS=$OS" > $CONFFILE
388 echo "STG_TIME=yes" >> $CONFFILE
389 echo "DEBUG=$DEBUG" >> $CONFFILE
390 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
391 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
392 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
393 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
394 echo "DIR_MOD=\$(DIR_BUILD)/modules" >> $CONFFILE
395 echo "DIR_PLUGINS=\$(DIR_BUILD)/plugins" >> $CONFFILE
396 echo "ARCH=$ARCH" >> $CONFFILE
397 echo "CHECK_EXPAT=$CHECK_EXPAT" >> $CONFFILE
398 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
399 echo "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT" >> $CONFFILE
400 echo "CHECK_PQ=$CHECK_PQ" >> $CONFFILE
401 echo "CHECK_XMLRPC=$CHECK_XMLRPC" >> $CONFFILE
402 echo "DEFS=$DEFS" >> $CONFFILE
403 echo -n "STG_LIBS=" >> $CONFFILE
406 echo -n "$lib " >> $CONFFILE
409 echo -n "PLUGINS=" >> $CONFFILE
410 for plugin in $PLUGINS
412 echo -n "$plugin " >> $CONFFILE
415 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
416 echo "CFLAGS=$CFLAGS" >> $CONFFILE
417 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
418 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
419 echo "PREFIX=$PREFIX" >> $CONFFILE
420 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
421 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
422 echo "DIR_MODE=$DIR_MODE" >> $CONFFILE
423 echo "OWNER=$OWNER" >> $CONFFILE
424 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
425 echo "ETC_DIR=$ETC_DIR" >> $CONFFILE
429 if [ "$1" != "debug" ]
433 echo -e "\n\n\nDebug build. Type $MAKE explicitly"