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"
47 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
54 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
55 LDFLAGS="$LDFLAGS -L/usr/local/lib"
57 if [ "$sys" = "Linux" ]
61 ETC_DIR="./inst/linux/etc/stargazer"
65 if [ "$sys" = "FreeBSD" ]
75 ETC_DIR="./inst/freebsd/etc/stargazer"
79 if [ "$OS" = "unknown" ]
81 echo "#############################################################################"
82 echo "# Sorry, but stargazer currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #"
83 echo "#############################################################################"
87 echo "#############################################################################"
88 echo " Building STG 2.4 for $sys $release"
89 echo "#############################################################################"
101 PLUGINS="authorization/ao
102 authorization/inetaccess
103 configuration/sgconfig
111 if [ "$OS" = "linux" ]
122 DEFS="$DEFS -DFREE_BSD"
125 DEFS="$DEFS -DFREE_BSD5"
126 if [ "$OS" = "bsd7" ]
134 capture/ether_freebsd
135 capture/divert_freebsd"
136 SHELL="/usr/local/bin/bash"
149 echo -n "Checking CC... "
150 $CC --version > /dev/null 2> /dev/null
158 echo -n "Checking CXX... "
159 $CXX --version > /dev/null 2> /dev/null
163 echo "$CXX not found"
168 echo -n "Checking endianess... "
169 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
170 $CC $CFLAGS $LDFLAGS build_check.c -o fake
174 echo "Endianess checking failed"
181 CXXFLAGS="$CXXFLAGS -DARCH_LE"
182 CFLAGS="$CFLAGS -DARCH_LE"
186 CXXFLAGS="$CXXFLAGS -DARCH_BE"
187 CFLAGS="$CFLAGS -DARCH_BE"
193 echo -n "Checking for -lexpat... "
194 echo "int main() { return 0; }" > build_check.c
195 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
206 echo -n "Checking for -lfbclient... "
207 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
218 echo -n "Checking for mysql_config... "
219 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
223 echo -n "Checking for -lmysqlclient... "
224 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
230 CHECK_MYSQLCLIENT=yes
236 echo -n "Checking for mysql_config --cflags... "
237 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
243 echo "[$MYSQL_CFLAGS]"
244 echo -n "Checking for mysql_config --libs_r... "
245 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
251 CHECK_MYSQLCLIENT=yes
252 echo "[$MYSQL_LDFLAGS]"
257 echo -n "Checking for pg_config... "
258 PG_VERSION=`pg_config --version 2> /dev/null`
262 echo -n "Checking for -lpq... "
263 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
275 echo -n "Checking for pg_config --includedir... "
276 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
283 echo -n "Checking for pg_config --libdir... "
284 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
296 echo -n "Checking for xmlrpc-c-config... "
297 XMLRPCC_VERSION=`xmlrpc-c-config $XMLRPC_FEATURES --version 2> /dev/null`
301 echo -n "Checking for -lxmlrpc... "
302 $CC $CFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
312 elif [ "$XMLRPCC_VERSION" \< "$MIN_XMLRPCC_VERSION" ]
314 echo "no (need at least $MIN_XMLRPCC_VERSION, actual $XMLRPCC_VERSION)";
317 echo "yes (version $XMLRPCC_VERSION)";
318 echo -n "Checking for xmlrpc-c-config --cflags... "
319 XMLRPC_CFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --cflags 2> /dev/null`
325 echo "[$XMLRPC_CFLAGS]"
326 echo -n "Checking for xmlrpc-c-config --libs... "
327 XMLRPC_LDFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --libs 2> /dev/null`
334 echo "[$XMLRPC_LDFLAGS]"
341 if [ "$CHECK_EXPAT" != "yes" ]
343 echo "-lexpat not found!"
347 if [ "$CHECK_FBCLIENT" = "yes" ]
355 if [ "$CHECK_PQ" = "yes" ]
361 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
367 if [ "$CHECK_XMLRPC" = "yes" ]
370 configuration/rpcconfig"
373 echo "OS=$OS" > $CONFFILE
374 echo "STG_TIME=yes" >> $CONFFILE
375 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
376 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
377 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
378 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
379 echo "DIR_MOD=\$(DIR_BUILD)/modules" >> $CONFFILE
380 echo "DIR_PLUGINS=\$(DIR_BUILD)/plugins" >> $CONFFILE
381 echo "ARCH=$ARCH" >> $CONFFILE
382 echo "CHECK_EXPAT=$CHECK_EXPAT" >> $CONFFILE
383 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
384 echo "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT" >> $CONFFILE
385 echo "CHECK_PQ=$CHECK_PQ" >> $CONFFILE
386 echo "CHECK_XMLRPC=$CHECK_XMLRPC" >> $CONFFILE
387 echo "DEFS=$DEFS" >> $CONFFILE
388 echo -n "STG_LIBS=" >> $CONFFILE
391 echo -n "$lib " >> $CONFFILE
394 echo -n "PLUGINS=" >> $CONFFILE
395 for plugin in $PLUGINS
397 echo -n "$plugin " >> $CONFFILE
400 echo "SHELL=$SHELL" >> $CONFFILE
401 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
402 echo "CFLAGS=$CFLAGS" >> $CONFFILE
403 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
404 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
405 echo "PREFIX=$PREFIX" >> $CONFFILE
406 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
407 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
408 echo "DIR_MODE=$DIR_MODE" >> $CONFFILE
409 echo "OWNER=$OWNER" >> $CONFFILE
410 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
411 echo "ETC_DIR=$ETC_DIR" >> $CONFFILE
415 if [ "$1" != "debug" ]
419 echo -e "\n\n\nDebug build. Type $MAKE explicitly"