#!/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 pushd toybox >/dev/null git checkout 5a6d1746baacb40e2a3f094af50dbe9871afa3cf popd >/dev/null 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 "" if [ ! -d git-sub-modules/json-builder ]; then pushd git-sub-modules >/dev/null git clone https://github.com/json-parser/json-builder.git popd >/dev/null sed -e 's//"json.h"/g' -i git-sub-modules/json-builder/json-builder.h ln -fs ../../../git-sub-modules/json-builder/json-builder.c build/toybox/lib ln -fs ../../../git-sub-modules/json-builder/json-builder.h build/toybox/lib else pushd git-sub-modules/json-builder >/dev/null echo "Updating json-builder." # git pull popd >/dev/null fi echo "" echo "" if [ ! -d git-sub-modules/json-parser ]; then pushd git-sub-modules >/dev/null git clone https://github.com/json-parser/json-parser.git popd >/dev/null ln -fs ../../../git-sub-modules/json-parser/json.c build/toybox/lib ln -fs ../../../git-sub-modules/json-parser/json.h build/toybox/lib else pushd git-sub-modules/json-parser >/dev/null echo "Updating json-parser." # git pull 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/generated/unstripped/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