aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/BuildIt.sh
blob: d9320a4902efd8322bc21328676362a8ab1fd863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/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
    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