]> git.stg.codes - stg.git/blob - projects/sgauth/build
Виправлено помилку компіляції викликану тим що bind2nd потребує
[stg.git] / projects / sgauth / build
1 #!/bin/sh
2
3 #   $Author: faust $
4 #   $Revision: 1.24 $
5 #   $Date: 2010/04/14 08:59: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 else
22     if [ "$1" = "debug" ]
23     then
24         DEFS="-DDEBUG"
25         MAKEOPTS="-j1"
26         CXXFLAGS="$CXXFLAGS -g3 -W -Wall"
27     else
28         MAKEOPTS="-j1"
29     fi
30 fi
31
32 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
33 LDFLAGS="$CXXFLAGS -L/usr/local/lib"
34
35 if [ "$sys" = "Linux" ]
36 then
37     OS=linux
38     release=""
39     MAKE="make"
40 fi
41
42 if [ "$sys" = "FreeBSD" ]
43 then
44     case $release in
45         4) OS=bsd;;
46         5) OS=bsd5;;
47         6) OS=bsd5;;
48         7) OS=bsd7;;
49         8) OS=bsd7;;
50         *) OS=unknown;;
51     esac
52     MAKE="gmake"
53 fi
54
55 if [ "$OS" = "unknown" ]
56 then 
57     echo "#############################################################################"
58     echo "# Sorry, but sgauth currently supported by Linux, FreeBSD 4.x, 5.x, 6.x  #"
59     echo "#############################################################################"
60     exit 1
61 fi
62
63 echo "#############################################################################"
64 echo "       Building sgauth for $sys $release"
65 echo "#############################################################################"
66
67 STG_LIBS="crypto.lib 
68           common.lib 
69           common_settings.lib
70           conffiles.lib
71           ia_auth_c.lib"
72
73 if [ "$OS" = "linux" ]
74 then
75     DEFS="$DEFS -DLINUX"
76     LIB_THREAD=-lpthread
77     SHELL="/bin/bash"
78 else
79     if [ "$OS" = "bsd" ]
80     then
81         DEFS="$DEFS -DFREE_BSD"
82         LIB_THREAD=-lc_r
83     else
84         DEFS="$DEFS -DFREE_BSD5"
85         if [ "$OS" = "bsd7" ]
86         then
87             LIB_THREAD=-lpthread
88         else
89             LIB_THREAD=-lc_r
90         fi
91     fi
92     SHELL="/usr/local/bin/bash"
93 fi
94
95 echo -n "Checking endianess... "
96 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
97 gcc $CXXFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
98 if [ $? != 0 ]
99 then
100     echo "FAIL!"
101     echo "Endianess checking failed"
102     exit;
103 else
104     ./fake
105     if [ $? = 1 ]
106     then
107         ARCH=le
108         CXXFLAGS="$CXXFLAGS -DARCH_LE"
109         echo "Little Endian"
110     else
111         ARCH=be
112         CXXFLAGS="$CXXFLAGS -DARCH_BE"
113         echo "Big Endian"
114     fi
115 fi
116 rm -f fake
117 rm -f build_check.c
118
119 echo "OS=$OS" > $CONFFILE
120 echo "STG_TIME=yes" >> $CONFFILE
121 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
122 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
123 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
124 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
125 echo "ARCH=$ARCH" >> $CONFFILE
126 echo "DEFS=$DEFS" >> $CONFFILE
127 echo -n "STG_LIBS=" >> $CONFFILE
128 for lib in $STG_LIBS
129 do
130     echo -n "$lib " >> $CONFFILE
131 done
132 echo "" >> $CONFFILE
133 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
134 echo "SHELL=$SHELL" >> $CONFFILE
135 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
136 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
137 echo "PREFIX=$PREFIX" >> $CONFFILE
138 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
139 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
140 echo "OWNER=$OWNER" >> $CONFFILE
141 $MAKE $MAKEOPTS
142