]> git.stg.codes - stg.git/blob - projects/sgconf_xml/build
Добавлены спецификаторы const для некоторых методов класса CONFIGPROTO в
[stg.git] / projects / sgconf_xml / build
1 #!/bin/sh
2
3 #   $Author: nobunaga $
4 #   $Revision: 1.2 $
5 #   $Date: 2008/01/05 12:11:02 $
6 ######################################################
7
8 OS=unknown
9 sys=`uname -s`
10 release=`uname -r | cut -b1`
11 BUILD_DIR=`pwd`
12 CONFFILE="../../Makefile.conf"
13 PREFIX="/"
14 BIN_MODE=0755
15 DATA_MODE=0644
16 OWNER=root
17
18 if [ -z $1 ]
19 then
20     MAKEOPTS="-j1"
21     CFLAGS="-O2"
22 else
23     if [ "$1" = "debug" ]
24     then
25         DEFS="-DDEBUG"
26         MAKEOPTS="-j1"
27         CFLAGS="-g3"
28     else
29         MAKEOPTS="-j1"
30         CFLAGS="-O2"
31     fi
32 fi
33
34 if [ "$sys" = "Linux" ]
35 then
36     OS=linux
37     release=""
38     ETC_DIR="./inst/linux/etc/stargazer"
39 fi
40
41 if [ "$sys" = "FreeBSD" ]
42 then
43     case $release in
44         4) OS=bsd;;
45         5) OS=bsd5;;
46         6) OS=bsd5;;    
47         *) OS=unknown;;
48     esac
49     ETC_DIR="./inst/freebsd/etc/stargazer"
50 fi
51
52 if [ "$OS" = "unknown" ]
53 then 
54     echo "#############################################################################"
55     echo "# Sorry, but sgconf currently supported by Linux, FreeBSD 4.x, 5.x, 6.x  #"
56     echo "#############################################################################"
57     exit 1
58 fi
59
60 echo "#############################################################################"
61 echo "       Building sgconf for $sys $release"
62 echo "#############################################################################"
63
64 STG_LIBS="conffiles.lib
65           crypto.lib 
66           common.lib 
67           srvconf.lib"
68
69 if [ "$OS" = "linux" ]
70 then
71     DEFS="$DEFS -DLINUX"
72     LIB_THREAD=-lpthread
73     SHELL="/bin/bash"
74 else
75     if [ "$OS" = "bsd" ]
76     then
77         DEFS="$DEFS -DFREE_BSD"
78     else
79         DEFS="$DEFS -DFREE_BSD5"
80     fi
81     SHELL="/usr/local/bin/bash"
82     LIB_THREAD=-lc_r
83 fi
84
85 echo -n "Checking for -lexpat... "
86 echo "int main() { return 0; }" > build_check.c
87 gcc build_check.c -lexpat -o fake > /dev/null 2> /dev/null
88 if [ $? != 0 ]
89 then
90     CHECK_EXPAT=no
91     echo "no"
92 else
93     CHECK_EXPAT=yes
94     echo "yes"
95 fi
96 rm -f fake
97 rm -f build_check.c
98
99 if [ "$CHECK_EXPAT" != "yes" ]
100 then
101     echo "-lexpat not found!"
102     exit 1
103 fi
104
105 echo "OS=$OS" > $CONFFILE
106 echo "STG_TIME=no" >> $CONFFILE
107 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
108 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
109 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
110 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
111 echo "CHECK_EXPAT=$CHECK_EXPAT" >> $CONFFILE
112 echo "DEFS=$DEFS" >> $CONFFILE
113 echo -n "STG_LIBS=" >> $CONFFILE
114 for lib in $STG_LIBS
115 do
116     echo -n "$lib " >> $CONFFILE
117 done
118 echo "" >> $CONFFILE
119 echo "SHELL=$SHELL" >> $CONFFILE
120 echo "CFLAGS=$CFLAGS" >> $CONFFILE
121 echo "PREFIX=$PREFIX" >> $CONFFILE
122 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
123 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
124 echo "OWNER=$OWNER" >> $CONFFILE
125 echo "ETC_DIR=$ETC_DIR" >> $CONFFILE
126
127 gmake $MAKEOPTS
128