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 CFLAGS="$CFLAGS -ggdb3 -W -Wall"
43 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
50 CFLAGS="$CFLAGS -I/usr/local/include"
51 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
52 LDFLAGS="$LDFLAGS -L/usr/local/lib"
54 if [ "$sys" = "Linux" ]
58 ETC_DIR="./inst/linux/etc/stargazer"
62 if [ "$sys" = "FreeBSD" ]
73 ETC_DIR="./inst/freebsd/etc/stargazer"
77 if [ "$sys" = "Darwin" ]
80 ETC_DIR="./inst/freebsd/etc/stargazer"
84 if [ "$OS" = "unknown" ]
86 printf "#############################################################################\n"
87 printf "# Sorry, but stargazer currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n"
88 printf "#############################################################################\n"
92 printf "#############################################################################\n"
93 printf " Building STG 2.4 for $sys $release\n"
94 printf "#############################################################################\n"
106 PLUGINS="authorization/ao
107 authorization/inetaccess
108 configuration/sgconfig
116 if [ "$OS" = "linux" ]
125 DEFS="$DEFS -DFREE_BSD"
128 if [ "$OS" = "bsd7" ]
130 DEFS="$DEFS -DFREE_BSD5"
133 if [ "$OS" == "darwin" ]
135 DEFS="$DEFS -DDARWIN"
143 capture/ether_freebsd
144 capture/divert_freebsd"
157 printf "Checking CC... "
158 $CC --version > /dev/null 2> /dev/null
162 printf "$CC not found\n"
166 printf "Checking CXX... "
167 $CXX --version > /dev/null 2> /dev/null
171 printf "$CXX not found\n"
176 printf "Checking endianess... "
177 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
178 $CC $CFLAGS $LDFLAGS build_check.c -o fake
182 printf "Endianess checking failed\n"
189 CXXFLAGS="$CXXFLAGS -DARCH_LE"
190 CFLAGS="$CFLAGS -DARCH_LE"
191 printf "Little Endian\n"
194 CXXFLAGS="$CXXFLAGS -DARCH_BE"
195 CFLAGS="$CFLAGS -DARCH_BE"
196 printf "Big Endian\n"
201 printf "Checking for -lexpat... "
202 printf "int main() { return 0; }\n" > build_check.c
203 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
214 printf "Checking for -lfbclient... "
215 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
226 printf "Checking for mysql_config... "
227 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
231 printf "Checking for -lmysqlclient... "
232 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
238 CHECK_MYSQLCLIENT=yes
244 printf "Checking for mysql_config --cflags... "
245 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
251 printf "[$MYSQL_CFLAGS]\n"
252 printf "Checking for mysql_config --libs_r... "
253 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
259 CHECK_MYSQLCLIENT=yes
260 printf "[$MYSQL_LDFLAGS]\n"
265 printf "Checking for pg_config... "
266 PG_VERSION=`pg_config --version 2> /dev/null`
270 printf "Checking for -lpq... "
271 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
283 printf "Checking for pg_config --includedir... "
284 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
290 printf "[$PG_CFLAGS]\n"
291 printf "Checking for pg_config --libdir... "
292 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
299 printf "[$PG_LDFLAGS]\n"
304 printf "Checking for xmlrpc-c-config... "
305 XMLRPCC_VERSION=`xmlrpc-c-config $XMLRPC_FEATURES --version 2> /dev/null`
309 printf "Checking for -lxmlrpc... "
310 $CC $CFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
320 elif [ "$XMLRPCC_VERSION" \< "$MIN_XMLRPCC_VERSION" ]
322 printf "no (need at least $MIN_XMLRPCC_VERSION, actual $XMLRPCC_VERSION)\n";
325 printf "yes (version $XMLRPCC_VERSION)\n";
326 printf "Checking for xmlrpc-c-config --cflags... "
327 XMLRPC_CFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --cflags 2> /dev/null`
333 printf "[$XMLRPC_CFLAGS]\n"
334 printf "Checking for xmlrpc-c-config --libs... "
335 XMLRPC_LDFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --libs 2> /dev/null`
342 printf "[$XMLRPC_LDFLAGS]\n"
347 if [ "$OS" = "linux" ]
349 printf "Checking for linux/netfilter_ipv4/ip_queue.h... "
350 printf "#include <linux/types.h>\n" > build_check.c
351 printf "#include <linux/netfilter_ipv4/ip_queue.h>\n" >> build_check.c
352 printf "int main() { return 0; }\n" >> build_check.c
353 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
360 DEFS="$DEFS -DHAS_IP_QUEUE_H"
370 if [ "$CHECK_EXPAT" != "yes" ]
372 printf "-lexpat not found!\n"
376 if [ "$CHECK_FBCLIENT" = "yes" ]
384 if [ "$CHECK_PQ" = "yes" ]
390 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
396 if [ "$CHECK_XMLRPC" = "yes" ]
399 configuration/rpcconfig"
402 printf "OS=$OS\n" > $CONFFILE
403 printf "STG_TIME=yes\n" >> $CONFFILE
404 printf "DEBUG=$DEBUG\n" >> $CONFFILE
405 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
406 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
407 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
408 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
409 printf "DIR_MOD=\$(DIR_BUILD)/modules\n" >> $CONFFILE
410 printf "DIR_PLUGINS=\$(DIR_BUILD)/plugins\n" >> $CONFFILE
411 printf "ARCH=$ARCH\n" >> $CONFFILE
412 printf "CHECK_EXPAT=$CHECK_EXPAT\n" >> $CONFFILE
413 printf "CHECK_FBCLIENT=$CHECK_FBCLIENT\n" >> $CONFFILE
414 printf "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT\n" >> $CONFFILE
415 printf "CHECK_PQ=$CHECK_PQ\n" >> $CONFFILE
416 printf "CHECK_XMLRPC=$CHECK_XMLRPC\n" >> $CONFFILE
417 printf "DEFS=$DEFS\n" >> $CONFFILE
418 printf "STG_LIBS=" >> $CONFFILE
421 printf "$lib " >> $CONFFILE
423 printf "\n" >> $CONFFILE
424 printf "PLUGINS=" >> $CONFFILE
425 for plugin in $PLUGINS
427 printf "$plugin " >> $CONFFILE
429 printf "\n" >> $CONFFILE
430 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
431 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
432 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
433 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
434 printf "PREFIX=$PREFIX\n" >> $CONFFILE
435 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
436 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
437 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
438 printf "OWNER=$OWNER\n" >> $CONFFILE
439 printf "VAR_DIR=$VAR_DIR\n" >> $CONFFILE
440 printf "ETC_DIR=$ETC_DIR\n" >> $CONFFILE
444 if [ "$1" != "debug" ]
448 printf "\n\n\nDebug build. Type $MAKE explicitly\n"