3 # Installation path prefix
11 # Data files access bits
19 # Binaries and data files owner
26 major=`printf "%s" "$release" | cut -d. -f1`
28 CONFFILE="../../Makefile.conf"
34 MAKEOPTS="$MAKEOPTS -j1"
35 CFLAGS="$CFLAGS -ggdb3 -W -Wall"
36 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
43 CFLAGS="$CFLAGS -I/usr/local/include"
44 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
45 LDFLAGS="$LDFLAGS -L/usr/local/lib"
47 if [ "$sys" = "Linux" ]
53 if [ "$sys" = "FreeBSD" ]
65 if [ "$sys" = "Darwin" ]
71 if [ "$OS" = "unknown" ]
73 printf "#############################################################################\n"
74 printf "# Sorry, but we currently support Linux, FreeBSD and Darwin. #\n"
75 printf "#############################################################################\n"
79 printf "#############################################################################\n"
80 printf " Building STG 2.409 libs for $sys $release\n"
81 printf "#############################################################################\n"
94 if [ "$OS" = "linux" ]
101 DEFS="$DEFS -DFREE_BSD"
103 if [ "$OS" = "bsd7" ]
105 DEFS="$DEFS -DFREE_BSD5"
107 if [ "$OS" == "darwin" ]
109 DEFS="$DEFS -DDARWIN"
135 printf "Checking CC... "
136 $CC --version > /dev/null 2> /dev/null
140 printf "$CC not found\n"
144 printf "Checking CXX... "
145 $CXX --version > /dev/null 2> /dev/null
149 printf "$CXX not found\n"
153 printf "Checking AR... "
154 $AR --version > /dev/null 2> /dev/null
158 printf "$AR not found\n"
162 printf "Checking RANLIB... "
163 $RANLIB --version > /dev/null 2> /dev/null
167 printf "$RANLIB not found\n"
172 printf "Checking endianess... "
173 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
174 $CC $CFLAGS $LDFLAGS build_check.c -o fake
178 printf "Endianess checking failed\n"
185 CXXFLAGS="$CXXFLAGS -DARCH_LE"
186 CFLAGS="$CFLAGS -DARCH_LE"
187 printf "Little Endian\n"
190 CXXFLAGS="$CXXFLAGS -DARCH_BE"
191 CFLAGS="$CFLAGS -DARCH_BE"
192 printf "Big Endian\n"
197 printf "Checking for -lexpat... "
198 printf "#include <expat.h>\nint main() { return 0; }\n" > build_check.c
199 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
210 printf "Checking for iconv 2nd argument... "
211 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
212 $CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
217 DEFS="$DEFS -DCONST_ICONV"
222 printf "Checking for fb_config... "
223 FB_VERSION=`fb_config --version 2> /dev/null`
227 printf "Checking for -lfbclient... "
228 printf "int main() { return 0; }\n" > build_check.c
229 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
236 FB_LDFLAGS="-lfbclient"
243 printf "Checking for fb_config --cflags... "
244 FB_CFLAGS=`fb_config --cflags`
250 printf "[$FB_CFLAGS]\n"
251 printf "Checking for fb_config --libs "
252 FB_LDFLAGS=`fb_config --libs`
259 printf "[$FB_LDFLAGS]\n"
266 if [ "$CHECK_EXPAT" != "yes" ]
268 printf -- "-lexpat not found!\n"
272 if [ "$CHECK_FBCLIENT" = "yes" ]
278 printf "OS=$OS\n" > $CONFFILE
279 printf "STG_TIME=yes\n" >> $CONFFILE
280 printf "DEBUG=$DEBUG\n" >> $CONFFILE
281 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
282 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
283 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
284 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
285 printf "ARCH=$ARCH\n" >> $CONFFILE
286 printf "CHECK_EXPAT=$CHECK_EXPAT\n" >> $CONFFILE
287 printf "CHECK_FBCLIENT=$CHECK_FBCLIENT\n" >> $CONFFILE
288 if [ "$CHECK_FBCLIENT" = "yes" ]
290 printf "FB_CFLAGS=$FB_CFLAGS\n" >> $CONFFILE
291 printf "FB_LDFLAGS=$FB_LDFLAGS\n" >> $CONFFILE
293 printf "DEFS=$DEFS\n" >> $CONFFILE
294 printf "STG_LIBS=" >> $CONFFILE
297 printf "$lib " >> $CONFFILE
299 printf "\n" >> $CONFFILE
300 printf "CC=$CC\n" >> $CONFFILE
301 printf "CXX=$CXX\n" >> $CONFFILE
302 printf "AR=$AR\n" >> $CONFFILE
303 printf "RANLIB=$RANLIB\n" >> $CONFFILE
304 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
305 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
306 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
307 printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
308 printf "PREFIX=$PREFIX\n" >> $CONFFILE
309 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
310 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
311 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
312 printf "OWNER=$OWNER\n" >> $CONFFILE
314 if [ "$1" != "debug" ]
318 printf "\n\n\nDebug build. Type $MAKE explicitly\n"