X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/fcef953f92c2e87cda8ed0a6f98991093fbe5769..a729c9ba2df66e31beb52e4bbbe638d3cd3445ad:/projects/stargazer/build diff --git a/projects/stargazer/build b/projects/stargazer/build index cda3b5e0..a323148b 100755 --- a/projects/stargazer/build +++ b/projects/stargazer/build @@ -17,33 +17,13 @@ BIN_MODE=0755 DATA_MODE=0644 -# Binaries and data files owner - -OWNER=root - -# Name of the firebird's group -# Need for chown directory with firebird db - -FIREBIRD_GROUP=firebird - -# Database address -# Firebird must have priviledges to read/write for specified path +# Dir access bits -DB_ADDRESS="localhost:/var/stargazer/stargazer.fdb" +DIR_MODE=0755 -# Database user -# This user must have priviledges to create database - -DB_USER="stg" - -# Database password - -DB_PASSWORD="123456" - -# Full path to isql utility -# Note: Debian users have to specify path to isql-fb utility +# Binaries and data files owner -FIREBIRD_ISQL="/opt/firebird/bin/isql" +OWNER=root OS=unknown sys=`uname -s` @@ -55,20 +35,15 @@ MIN_XMLRPCC_VERSION="1.06.27" XMLRPC_FEATURES="c++2 abyss-server" -if [ -z $1 ] +if [ "$1" = "debug" ] then - DEFS="$DEFS -DNDEBUG" - MAKEOPTS="-j1" + DEFS="$DEFS -DDEBUG" + MAKEOPTS="$MAKEOPTS -j1" + CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall" + DEBUG="yes" else - if [ "$1" = "debug" ] - then - DEFS="$DEFS -DDEBUG" - MAKEOPTS="-j1" - CXXFLAGS="$CXXFLAGS -g3 -W -Wall" - else - DEFS="$DEFS -DNDEBUG" - MAKEOPTS="-j1" - fi + DEFS="$DEFS -DNDEBUG" + DEBUG="no" fi CXXFLAGS="$CXXFLAGS -I/usr/local/include" @@ -90,6 +65,7 @@ then 6) OS=bsd5;; 7) OS=bsd7;; 8) OS=bsd7;; + 9) OS=bsd7;; *) OS=unknown;; esac ETC_DIR="./inst/freebsd/etc/stargazer" @@ -108,15 +84,15 @@ echo "########################################################################## echo " Building STG 2.4 for $sys $release" echo "#############################################################################" -STG_LIBS="stg_logger.lib - stg_locker.lib +STG_LIBS="logger.lib + locker.lib crypto.lib common.lib - script_executer.lib + scriptexecuter.lib conffiles.lib - hostallow.lib pinger.lib - dotconfpp.lib" + dotconfpp.lib + smux.lib" PLUGINS="authorization/ao authorization/inetaccess @@ -124,6 +100,7 @@ PLUGINS="authorization/ao other/ping other/rscript other/radius + other/smux store/files capture/cap_nf" @@ -131,9 +108,7 @@ if [ "$OS" = "linux" ] then DEFS="$DEFS -DLINUX" PLUGINS="$PLUGINS - capture/ether_linux - capture/ipq_linux" - SHELL="/bin/bash" + capture/ether_linux" LIB_THREAD=-lpthread else if [ "$OS" = "bsd" ] @@ -152,12 +127,40 @@ else PLUGINS="$PLUGINS capture/ether_freebsd capture/divert_freebsd" - SHELL="/usr/local/bin/bash" fi +if [ -z "$CC" ] +then + CC=gcc +fi + +if [ -z "$CXX" ] +then + CXX=g++ +fi + +echo -n "Checking CC... " +$CC --version > /dev/null 2> /dev/null +if [ $? != 0 ] +then + echo "FAIL!" + echo "$CC not found" + exit; +fi +echo "found" +echo -n "Checking CXX... " +$CXX --version > /dev/null 2> /dev/null +if [ $? != 0 ] +then + echo "FAIL!" + echo "$CXX not found" + exit; +fi +echo "found" + echo -n "Checking endianess... " echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c -gcc $CXXFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null +$CC $CFLAGS $LDFLAGS build_check.c -o fake if [ $? != 0 ] then echo "FAIL!" @@ -169,10 +172,12 @@ else then ARCH=le CXXFLAGS="$CXXFLAGS -DARCH_LE" + CFLAGS="$CFLAGS -DARCH_LE" echo "Little Endian" else ARCH=be CXXFLAGS="$CXXFLAGS -DARCH_BE" + CFLAGS="$CFLAGS -DARCH_BE" echo "Big Endian" fi fi @@ -180,7 +185,7 @@ rm -f fake echo -n "Checking for -lexpat... " echo "int main() { return 0; }" > build_check.c -gcc $CXXFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null +$CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null if [ $? != 0 ] then CHECK_EXPAT=no @@ -192,7 +197,7 @@ fi rm -f fake echo -n "Checking for -lfbclient... " -gcc $CXXFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null +$CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null if [ $? != 0 ] then CHECK_FBCLIENT=no @@ -209,7 +214,7 @@ if [ $? != 0 ] then echo "no"; echo -n "Checking for -lmysqlclient... " - gcc $CXXFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null + $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null if [ $? != 0 ] then CHECK_MYSQLCLIENT=no @@ -228,7 +233,6 @@ else CHECK_MYSQLCLIENT=no echo "no" else - #CXXFLAGS="$CXXFLAGS $MYSQL_CFLAGS" echo "[$MYSQL_CFLAGS]" echo -n "Checking for mysql_config --libs_r... " MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null` @@ -238,7 +242,6 @@ else echo "no" else CHECK_MYSQLCLIENT=yes - #LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS" echo "[$MYSQL_LDFLAGS]" fi fi @@ -250,7 +253,7 @@ if [ $? != 0 ] then echo "no"; echo -n "Checking for -lpq... " - gcc $CXXFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null + $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null if [ $? != 0 ] then CHECK_PQ=no @@ -289,7 +292,7 @@ if [ $? != 0 ] then echo "no"; echo -n "Checking for -lxmlrpc... " - gcc $CXXFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null + $CC $CFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null if [ $? != 0 ] then CHECK_XMLRPC=no @@ -326,6 +329,27 @@ else fi fi +if [ "$OS" = "linux" ] +then + echo -n "Checking for linux/netfilter_ipv4/ip_queue.h... " + echo "#include " > build_check.c + echo "#include " >> build_check.c + echo "int main() { return 0; }" >> build_check.c + $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null + if [ $? != 0 ] + then + CHECK_IP_QUEUE_H=no + echo "no" + else + CHECK_IP_QUEUE_H=yes + DEFS="$DEFS -DHAS_IP_QUEUE_H" + PLUGINS="$PLUGINS + capture/ipq_linux" + echo "yes" + fi + rm -f fake +fi + rm -f build_check.c if [ "$CHECK_EXPAT" != "yes" ] @@ -362,6 +386,7 @@ fi echo "OS=$OS" > $CONFFILE echo "STG_TIME=yes" >> $CONFFILE +echo "DEBUG=$DEBUG" >> $CONFFILE echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE @@ -387,21 +412,17 @@ do echo -n "$plugin " >> $CONFFILE done echo "" >> $CONFFILE -echo "SHELL=$SHELL" >> $CONFFILE echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE +echo "CFLAGS=$CFLAGS" >> $CONFFILE echo "LDFLAGS=$LDFLAGS" >> $CONFFILE echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE echo "PREFIX=$PREFIX" >> $CONFFILE echo "BIN_MODE=$BIN_MODE" >> $CONFFILE echo "DATA_MODE=$DATA_MODE" >> $CONFFILE +echo "DIR_MODE=$DIR_MODE" >> $CONFFILE echo "OWNER=$OWNER" >> $CONFFILE echo "VAR_DIR=$VAR_DIR" >> $CONFFILE echo "ETC_DIR=$ETC_DIR" >> $CONFFILE -echo "DB_ADDRESS=$DB_ADDRESS" >> $CONFFILE -echo "DB_USER=$DB_USER" >> $CONFFILE -echo "DB_PASSWORD=$DB_PASSWORD" >> $CONFFILE -echo "FIREBIRD_ISQL=$FIREBIRD_ISQL" >> $CONFFILE -echo "FIREBIRD_GROUP=$FIREBIRD_GROUP" >> $CONFFILE mkdir -p modules