5 # $Date: 2010/05/09 12:39:01 $
6 ######################################################
8 # Installation path prefix
12 # Binaries access bits
16 # Data files access bits
20 # Binaries and data files owner
24 # Name of the firebird's group
25 # Need for chown directory with firebird db
27 FIREBIRD_GROUP=firebird
30 # Firebird must have priviledges to read/write for specified path
32 DB_ADDRESS="localhost:/var/stargazer/stargazer.fdb"
35 # This user must have priviledges to create database
43 # Full path to isql utility
44 # Note: Debian users have to specify path to isql-fb utility
46 FIREBIRD_ISQL="/opt/firebird/bin/isql"
50 release=`uname -r | cut -b1`
52 CONFFILE="../../Makefile.conf"
53 VAR_DIR="./inst/var/stargazer"
54 MIN_XMLRPCC_VERSION="1.06.27"
55 XMLRPC_FEATURES="c++2 abyss-server"
67 CXXFLAGS="$CXXFLAGS -g3 -W -Wall"
74 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
75 LDFLAGS="$LDFLAGS -L/usr/local/lib"
77 if [ "$sys" = "Linux" ]
81 ETC_DIR="./inst/linux/etc/stargazer"
85 if [ "$sys" = "FreeBSD" ]
95 ETC_DIR="./inst/freebsd/etc/stargazer"
99 if [ "$OS" = "unknown" ]
101 echo "#############################################################################"
102 echo "# Sorry, but stargazer currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #"
103 echo "#############################################################################"
107 echo "#############################################################################"
108 echo " Building STG 2.4 for $sys $release"
109 echo "#############################################################################"
111 STG_LIBS="stg_logger.lib
121 PLUGINS="authorization/ao
122 authorization/inetaccess
123 configuration/sgconfig
130 if [ "$OS" = "linux" ]
141 DEFS="$DEFS -DFREE_BSD"
144 DEFS="$DEFS -DFREE_BSD5"
145 if [ "$OS" = "bsd7" ]
153 capture/ether_freebsd
154 capture/divert_freebsd"
155 SHELL="/usr/local/bin/bash"
158 echo -n "Checking endianess... "
159 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
160 gcc $CXXFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
164 echo "Endianess checking failed"
171 CXXFLAGS="$CXXFLAGS -DARCH_LE"
175 CXXFLAGS="$CXXFLAGS -DARCH_BE"
181 echo -n "Checking for -lexpat... "
182 echo "int main() { return 0; }" > build_check.c
183 gcc $CXXFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
194 echo -n "Checking for -lfbclient... "
195 gcc $CXXFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
206 echo -n "Checking for mysql_config... "
207 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
211 echo -n "Checking for -lmysqlclient... "
212 gcc $CXXFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
218 CHECK_MYSQLCLIENT=yes
224 echo -n "Checking for mysql_config --cflags... "
225 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
231 #CXXFLAGS="$CXXFLAGS $MYSQL_CFLAGS"
232 echo "[$MYSQL_CFLAGS]"
233 echo -n "Checking for mysql_config --libs_r... "
234 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
240 CHECK_MYSQLCLIENT=yes
241 #LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
242 echo "[$MYSQL_LDFLAGS]"
247 echo -n "Checking for pg_config... "
248 PG_VERSION=`pg_config --version 2> /dev/null`
252 echo -n "Checking for -lpq... "
253 gcc $CXXFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
265 echo -n "Checking for pg_config --includedir... "
266 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
273 echo -n "Checking for pg_config --libdir... "
274 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
286 echo -n "Checking for xmlrpc-c-config... "
287 XMLRPCC_VERSION=`xmlrpc-c-config $XMLRPC_FEATURES --version 2> /dev/null`
291 echo -n "Checking for -lxmlrpc... "
292 gcc $CXXFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
302 elif [ "$XMLRPCC_VERSION" \< "$MIN_XMLRPCC_VERSION" ]
304 echo "no (need at least $MIN_XMLRPCC_VERSION, actual $XMLRPCC_VERSION)";
307 echo "yes (version $XMLRPCC_VERSION)";
308 echo -n "Checking for xmlrpc-c-config --cflags... "
309 XMLRPC_CFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --cflags 2> /dev/null`
315 echo "[$XMLRPC_CFLAGS]"
316 echo -n "Checking for xmlrpc-c-config --libs... "
317 XMLRPC_LDFLAGS=`xmlrpc-c-config $XMLRPC_FEATURES --libs 2> /dev/null`
324 echo "[$XMLRPC_LDFLAGS]"
331 if [ "$CHECK_EXPAT" != "yes" ]
333 echo "-lexpat not found!"
337 if [ "$CHECK_FBCLIENT" = "yes" ]
345 if [ "$CHECK_PQ" = "yes" ]
351 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
357 if [ "$CHECK_XMLRPC" = "yes" ]
360 configuration/rpcconfig"
363 echo "OS=$OS" > $CONFFILE
364 echo "STG_TIME=yes" >> $CONFFILE
365 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
366 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
367 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
368 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
369 echo "DIR_MOD=\$(DIR_BUILD)/modules" >> $CONFFILE
370 echo "DIR_PLUGINS=\$(DIR_BUILD)/plugins" >> $CONFFILE
371 echo "ARCH=$ARCH" >> $CONFFILE
372 echo "CHECK_EXPAT=$CHECK_EXPAT" >> $CONFFILE
373 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
374 echo "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT" >> $CONFFILE
375 echo "CHECK_PQ=$CHECK_PQ" >> $CONFFILE
376 echo "CHECK_XMLRPC=$CHECK_XMLRPC" >> $CONFFILE
377 echo "DEFS=$DEFS" >> $CONFFILE
378 echo -n "STG_LIBS=" >> $CONFFILE
381 echo -n "$lib " >> $CONFFILE
384 echo -n "PLUGINS=" >> $CONFFILE
385 for plugin in $PLUGINS
387 echo -n "$plugin " >> $CONFFILE
390 echo "SHELL=$SHELL" >> $CONFFILE
391 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
392 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
393 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
394 echo "PREFIX=$PREFIX" >> $CONFFILE
395 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
396 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
397 echo "OWNER=$OWNER" >> $CONFFILE
398 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
399 echo "ETC_DIR=$ETC_DIR" >> $CONFFILE
400 echo "DB_ADDRESS=$DB_ADDRESS" >> $CONFFILE
401 echo "DB_USER=$DB_USER" >> $CONFFILE
402 echo "DB_PASSWORD=$DB_PASSWORD" >> $CONFFILE
403 echo "FIREBIRD_ISQL=$FIREBIRD_ISQL" >> $CONFFILE
404 echo "FIREBIRD_GROUP=$FIREBIRD_GROUP" >> $CONFFILE
408 if [ "$1" != "debug" ]
412 echo -e "\n\n\nDebug build. Type $MAKE explicitly"