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"
48 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
57 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
58 LDFLAGS="$LDFLAGS -L/usr/local/lib"
60 if [ "$sys" = "Linux" ]
64 ETC_DIR="./inst/linux/etc/stargazer"
68 if [ "$sys" = "FreeBSD" ]
79 ETC_DIR="./inst/freebsd/etc/stargazer"
83 if [ "$OS" = "unknown" ]
85 echo "#############################################################################"
86 echo "# Sorry, but stargazer currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #"
87 echo "#############################################################################"
91 echo "#############################################################################"
92 echo " Building STG 2.4 for $sys $release"
93 echo "#############################################################################"
105 PLUGINS="authorization/ao
106 authorization/inetaccess
107 configuration/sgconfig
115 if [ "$OS" = "linux" ]
124 DEFS="$DEFS -DFREE_BSD"
127 DEFS="$DEFS -DFREE_BSD5"
128 if [ "$OS" = "bsd7" ]
136 capture/ether_freebsd
137 capture/divert_freebsd"
150 echo -n "Checking CC... "
151 $CC --version > /dev/null 2> /dev/null
159 echo -n "Checking CXX... "
160 $CXX --version > /dev/null 2> /dev/null
164 echo "$CXX not found"
169 echo -n "Checking endianess... "
170 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
171 $CC $CFLAGS $LDFLAGS build_check.c -o fake
175 echo "Endianess checking failed"
182 CXXFLAGS="$CXXFLAGS -DARCH_LE"
183 CFLAGS="$CFLAGS -DARCH_LE"
187 CXXFLAGS="$CXXFLAGS -DARCH_BE"
188 CFLAGS="$CFLAGS -DARCH_BE"
194 echo -n "Checking for -lexpat... "
195 echo "int main() { return 0; }" > build_check.c
196 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
207 echo -n "Checking for -lfbclient... "
208 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
219 echo -n "Checking for mysql_config... "
220 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
224 echo -n "Checking for -lmysqlclient... "
225 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
231 CHECK_MYSQLCLIENT=yes
237 echo -n "Checking for mysql_config --cflags... "
238 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
244 echo "[$MYSQL_CFLAGS]"
245 echo -n "Checking for mysql_config --libs_r... "
246 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
252 CHECK_MYSQLCLIENT=yes
253 echo "[$MYSQL_LDFLAGS]"
258 echo -n "Checking for pg_config... "
259 PG_VERSION=`pg_config --version 2> /dev/null`
263 echo -n "Checking for -lpq... "
264 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
276 echo -n "Checking for pg_config --includedir... "
277 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
284 echo -n "Checking for pg_config --libdir... "
285 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
297 echo -n "Checking for xmlrpc-c-config... "
298 XMLRPCC_VERSION=`xmlrpc-c-config $XMLRPC_FEATURES --version 2> /dev/null`
302 echo -n "Checking for -lxmlrpc... "
303 $CC $CFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
313 elif [ "$XMLRPCC_VERSION" \< "$MIN_XMLRPCC_VERSION" ]
315 echo "no (need at least $MIN_XMLRPCC_VERSION, actual $XMLRPCC_VERSION)";
318 echo "yes (version $XMLRPCC_VERSION)";
319 echo -n "Checking for xmlrpc-c-config --cflags... "
320 XMLRPC_CFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --cflags 2> /dev/null`
326 echo "[$XMLRPC_CFLAGS]"
327 echo -n "Checking for xmlrpc-c-config --libs... "
328 XMLRPC_LDFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --libs 2> /dev/null`
335 echo "[$XMLRPC_LDFLAGS]"
340 if [ "$OS" = "linux" ]
342 echo -n "Checking for linux/netfilter_ipv4/ip_queue.h... "
343 echo "#include <linux/types.h>" > build_check.c
344 echo "#include <linux/netfilter_ipv4/ip_queue.h>" >> build_check.c
345 echo "int main() { return 0; }" >> build_check.c
346 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
353 DEFS="$DEFS -DHAS_IP_QUEUE_H"
363 if [ "$CHECK_EXPAT" != "yes" ]
365 echo "-lexpat not found!"
369 if [ "$CHECK_FBCLIENT" = "yes" ]
377 if [ "$CHECK_PQ" = "yes" ]
383 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
389 if [ "$CHECK_XMLRPC" = "yes" ]
392 configuration/rpcconfig"
395 echo "OS=$OS" > $CONFFILE
396 echo "STG_TIME=yes" >> $CONFFILE
397 echo "DEBUG=$DEBUG" >> $CONFFILE
398 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
399 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
400 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
401 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
402 echo "DIR_MOD=\$(DIR_BUILD)/modules" >> $CONFFILE
403 echo "DIR_PLUGINS=\$(DIR_BUILD)/plugins" >> $CONFFILE
404 echo "ARCH=$ARCH" >> $CONFFILE
405 echo "CHECK_EXPAT=$CHECK_EXPAT" >> $CONFFILE
406 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
407 echo "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT" >> $CONFFILE
408 echo "CHECK_PQ=$CHECK_PQ" >> $CONFFILE
409 echo "CHECK_XMLRPC=$CHECK_XMLRPC" >> $CONFFILE
410 echo "DEFS=$DEFS" >> $CONFFILE
411 echo -n "STG_LIBS=" >> $CONFFILE
414 echo -n "$lib " >> $CONFFILE
417 echo -n "PLUGINS=" >> $CONFFILE
418 for plugin in $PLUGINS
420 echo -n "$plugin " >> $CONFFILE
423 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
424 echo "CFLAGS=$CFLAGS" >> $CONFFILE
425 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
426 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
427 echo "PREFIX=$PREFIX" >> $CONFFILE
428 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
429 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
430 echo "DIR_MODE=$DIR_MODE" >> $CONFFILE
431 echo "OWNER=$OWNER" >> $CONFFILE
432 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
433 echo "ETC_DIR=$ETC_DIR" >> $CONFFILE
437 if [ "$1" != "debug" ]
441 echo -e "\n\n\nDebug build. Type $MAKE explicitly"