diff options
Diffstat (limited to '')
-rwxr-xr-x | src/BuildIt.sh | 132 |
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 | |||
3 | mkdir -p build | ||
4 | |||
5 | # Poor mans git sub modules / subtrees, coz otherwise it gets complex. | ||
6 | if [ ! -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 | ||
10 | else | ||
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 | ||
15 | fi | ||
16 | |||
17 | if [ ! -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 | ||
27 | fi | ||
28 | |||
29 | echo "" | ||
30 | echo "" | ||
31 | |||
32 | if [ ! -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 | ||
40 | else | ||
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 | ||
45 | fi | ||
46 | |||
47 | if [ ! -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 | ||
55 | fi | ||
56 | |||
57 | echo "" | ||
58 | echo "" | ||
59 | |||
60 | if [ ! -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 | ||
64 | else | ||
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 | ||
69 | fi | ||
70 | |||
71 | if [ ! -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 | ||
80 | fi | ||
81 | |||
82 | echo "" | ||
83 | echo "" | ||
84 | |||
85 | if [ ! -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 | ||
89 | else | ||
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 | ||
94 | fi | ||
95 | |||
96 | if [ ! -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 | ||
114 | fi | ||
115 | |||
116 | echo "" | ||
117 | echo "" | ||
118 | |||
119 | pushd build/toybox >/dev/null | ||
120 | export CFLAGS="-I../luajit/src -I../fcgi2 -I../fcgi2/include -I../qlibc/include/qlibc $(mysql_config --cflags) -g3" | ||
121 | 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" | ||
122 | make || exit 1 | ||
123 | popd >/dev/null | ||
124 | ln -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 | ||