#!/bin/bash mkdir -p build # Poor mans git sub modules / subtrees, coz otherwise it gets complex. if [ ! -d git-sub-modules/fcgi2 ]; then pushd git-sub-modules >/dev/null git clone https://github.com/FastCGI-Archives/fcgi2.git popd >/dev/null else pushd git-sub-modules/fcgi2 >/dev/null echo "Updating fcgi2." # git pull | grep "Already up-to-date." && rm -fr build/fcgi2 popd >/dev/null fi if [ ! -d build/fcgi2 ]; then cp -r git-sub-modules/fcgi2 build/ pushd build/fcgi2 >/dev/null # make distclean ./autogen.sh ./configure sed -e "s/#define PACKAGE/#define FCGI_PACKAGE/g" -i fcgi_config.h sed -e "s/#define VERSION /#define FCGI_VERSION /g" -i fcgi_config.h make popd >/dev/null fi echo "" echo "" if [ ! -d git-sub-modules/luajit ]; then pushd git-sub-modules >/dev/null git clone https://luajit.org/git/luajit-2.0.git mv luajit-2.0 luajit pushd luajit >/dev/null git checkout v2.1 popd >/dev/null popd >/dev/null else pushd git-sub-modules/luajit >/dev/null echo "Updating LuaJIT." # git pull | grep "Already up-to-date." && rm -fr build/luajit popd >/dev/null fi if [ ! -d build/luajit ]; then rm -fr build/luajit cp -r git-sub-modules/luajit build/ pushd build/luajit >/dev/null make clean make amalg popd >/dev/null fi echo "" echo "" if [ ! -d git-sub-modules/qlibc ]; then pushd git-sub-modules >/dev/null git clone https://github.com/wolkykim/qlibc.git pushd qlibc >/dev/null patch -p1 <../../patches/qlibc.patch popd >/dev/null popd >/dev/null else pushd git-sub-modules/qlibc >/dev/null echo "Updating qlibc." # git pull | grep "Already up-to-date." && rm -fr build/qlibc popd >/dev/null fi if [ ! -d build/qlibc ]; then rm -fr build/qlibc cp -r git-sub-modules/qlibc build/ pushd build/qlibc >/dev/null make clean ./configure make popd >/dev/null fi echo "" echo "" if [ ! -d git-sub-modules/toybox ]; then pushd git-sub-modules >/dev/null git clone https://github.com/landley/toybox.git popd >/dev/null else pushd git-sub-modules/toybox >/dev/null echo "Updating toybox." # git pull | grep "Already up-to-date." && rm -fr build/toybox popd >/dev/null fi if [ ! -d build/toybox ]; then rm -fr build/toybox cp -r git-sub-modules/toybox build/ ln -fs ../../../boxes build/toybox/toys/boxes ln -fs ../../../sledjchisl build/toybox/toys/sledjchisl ln -fs ../toys/sledjchisl/fcgi_SC.c build/toybox/lib ln -fs ../toys/sledjchisl/fcgi_SC.h build/toybox/lib ln -fs ../toys/boxes/handlekeys.c build/toybox/lib ln -fs ../toys/boxes/handlekeys.h build/toybox/lib pushd build/toybox >/dev/null sed -e "s/strend(/tb_strend(/g" -i lib/lib.h find ./ -type f -name "*.c" -exec sed -e "s/strend(/tb_strend(/g" -i {} \; make clean #make defconfig #make menuconfig make allnoconfig KCONFIG_ALLCONFIG=../../miniconfig || exit 1 popd >/dev/null fi echo "" echo "" pushd build/toybox >/dev/null export CFLAGS="-I../luajit/src -I../fcgi2 -I../fcgi2/include -I../qlibc/include/qlibc $(mysql_config --cflags) -g3" export LDFLAGS="-L../luajit/src -L../fcgi2/libfcgi/.libs -L../qlibc/lib $(mysql_config --libs) -Wl,-E -l:libluajit.a -l:libqlibcext.a -l:libfcgi.a -l:libqlibc.a -lcrypto -luuid -lpthread -ldl" make || exit 1 popd >/dev/null ln -fs ../src/build/toybox/toybox ../bin/sledjchisl #sudo rm -f /opt/opensim_SC/var/cache/sledjchisl.socket #sudo rm -f /opt/opensim_SC/var/cache/sessions/* #sudo rm -f /opt/opensim_SC/var/lib/users/* #sudo spawn-fcgi -n -u opensimsc -s /opt/opensim_SC/var/cache/sledjchisl.socket -M 0660 -G www-data -- /usr/bin/valgrind --leak-check=full build/toybox/generated/unstripped/toybox sledjchisl ##sudo spawn-fcgi -n -u opensimsc -s /opt/opensim_SC/var/cache/sledjchisl.socket -M 0660 -G www-data -- /usr/bin/valgrind --leak-check=full build/toybox/generated/unstripped/toybox sledjchisl 2>&1 | tee log.txt ##sudo spawn-fcgi -n -u opensimsc -s /opt/opensim_SC/var/cache/sledjchisl.socket -M 0660 -G www-data -- /usr/bin/valgrind --leak-check=full --show-leak-kinds=all build/toybox/generated/unstripped/toybox sledjchisl ###sudo spawn-fcgi -n -u opensimsc -s /opt/opensim_SC/var/cache/sledjchisl.socket -M 0660 -G www-data -- /usr/bin/ddd build/toybox/generated/unstripped/toybox sledjchisl