aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/BuildIt.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/BuildIt.sh132
1 files changed, 132 insertions, 0 deletions
diff --git a/src/BuildIt.sh b/src/BuildIt.sh
new file mode 100755
index 0000000..6696210
--- /dev/null
+++ b/src/BuildIt.sh
@@ -0,0 +1,132 @@
1#!/bin/bash
2
3mkdir -p build
4
5# Poor mans git sub modules / subtrees, coz otherwise it gets complex.
6if [ ! -d git-sub-modules/fcgi2 ]; then
7 pushd git-sub-modules >/dev/null
8 git clone https://github.com/FastCGI-Archives/fcgi2.git
9 popd >/dev/null
10else
11 pushd git-sub-modules/fcgi2 >/dev/null
12 echo "Updating fcgi2."
13# git pull | grep "Already up-to-date." && rm -fr build/fcgi2
14 popd >/dev/null
15fi
16
17if [ ! -d build/fcgi2 ]; then
18 cp -r git-sub-modules/fcgi2 build/
19 pushd build/fcgi2 >/dev/null
20# make distclean
21 ./autogen.sh
22 ./configure
23 sed -e "s/#define PACKAGE/#define FCGI_PACKAGE/g" -i fcgi_config.h
24 sed -e "s/#define VERSION /#define FCGI_VERSION /g" -i fcgi_config.h
25 make
26 popd >/dev/null
27fi
28
29echo ""
30echo ""
31
32if [ ! -d git-sub-modules/luajit ]; then
33 pushd git-sub-modules >/dev/null
34 git clone https://luajit.org/git/luajit-2.0.git
35 mv luajit-2.0 luajit
36 pushd luajit >/dev/null
37 git checkout v2.1
38 popd >/dev/null
39 popd >/dev/null
40else
41 pushd git-sub-modules/luajit >/dev/null
42 echo "Updating LuaJIT."
43# git pull | grep "Already up-to-date." && rm -fr build/luajit
44 popd >/dev/null
45fi
46
47if [ ! -d build/luajit ]; then
48 rm -fr build/luajit
49 cp -r git-sub-modules/luajit build/
50
51 pushd build/luajit >/dev/null
52 make clean
53 make amalg
54 popd >/dev/null
55fi
56
57echo ""
58echo ""
59
60if [ ! -d git-sub-modules/qlibc ]; then
61 pushd git-sub-modules >/dev/null
62 git clone https://github.com/wolkykim/qlibc.git
63 popd >/dev/null
64else
65 pushd git-sub-modules/qlibc >/dev/null
66 echo "Updating qlibc."
67# git pull | grep "Already up-to-date." && rm -fr build/qlibc
68 popd >/dev/null
69fi
70
71if [ ! -d build/qlibc ]; then
72 rm -fr build/qlibc
73 cp -r git-sub-modules/qlibc build/
74
75 pushd build/qlibc >/dev/null
76 make clean
77 ./configure
78 make
79 popd >/dev/null
80fi
81
82echo ""
83echo ""
84
85if [ ! -d git-sub-modules/toybox ]; then
86 pushd git-sub-modules >/dev/null
87 git clone https://github.com/landley/toybox.git
88 popd >/dev/null
89else
90 pushd git-sub-modules/toybox >/dev/null
91 echo "Updating toybox."
92# git pull | grep "Already up-to-date." && rm -fr build/toybox
93 popd >/dev/null
94fi
95
96if [ ! -d build/toybox ]; then
97 rm -fr build/toybox
98 cp -r git-sub-modules/toybox build/
99 ln -fs ../../../boxes build/toybox/toys/boxes
100 ln -fs ../../../sledjchisl build/toybox/toys/sledjchisl
101 ln -fs ../toys/sledjchisl/fcgi_SC.c build/toybox/lib
102 ln -fs ../toys/sledjchisl/fcgi_SC.h build/toybox/lib
103 ln -fs ../toys/boxes/handlekeys.c build/toybox/lib
104 ln -fs ../toys/boxes/handlekeys.h build/toybox/lib
105
106 pushd build/toybox >/dev/null
107 sed -e "s/strend(/tb_strend(/g" -i lib/lib.h
108 find ./ -type f -name "*.c" -exec sed -e "s/strend(/tb_strend(/g" -i {} \;
109 make clean
110 #make defconfig
111 #make menuconfig
112 make allnoconfig KCONFIG_ALLCONFIG=../../miniconfig || exit 1
113 popd >/dev/null
114fi
115
116echo ""
117echo ""
118
119pushd build/toybox >/dev/null
120export CFLAGS="-I../luajit/src -I../fcgi2 -I../fcgi2/include -I../qlibc/include/qlibc $(mysql_config --cflags) -g3"
121export 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"
122make || exit 1
123popd >/dev/null
124ln -fs ../src/build/toybox/toybox ../bin/sledjchisl
125
126#sudo rm -f /opt/opensim_SC/var/cache/sledjchisl.socket
127#sudo rm -f /opt/opensim_SC/var/cache/sessions/*
128#sudo rm -f /opt/opensim_SC/var/lib/users/*
129#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
130##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
131##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
132###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