File TODO changed (mode: 100644) (index 56c4068..f974536) |
4 |
4 |
[ ] Cache getaddrinfo responses |
[ ] Cache getaddrinfo responses |
5 |
5 |
[ ] Replace Conn_X with Conn_get_socket_X! |
[ ] Replace Conn_X with Conn_get_socket_X! |
6 |
6 |
[ ] Use shutdown(2) before closing connection (http://www.developerweb.net/forum/archive/index.php/t-2940.html). |
[ ] Use shutdown(2) before closing connection (http://www.developerweb.net/forum/archive/index.php/t-2940.html). |
|
7 |
|
[ ] Switch all pointers to callbacks to a single callback with paramenters + |
|
8 |
|
a flag that will say for what type of callbacks to call the callback. |
|
9 |
|
[ ] Conn.c:532:19: warning: variable 'psa' set but not used [-Wunused-but-set-variable] & Co. |
|
10 |
|
[ ] |
7 |
11 |
|
|
8 |
12 |
== LOW PRIORITY == |
== LOW PRIORITY == |
9 |
13 |
[ ] Dump all memory statistics |
[ ] Dump all memory statistics |
|
14 |
18 |
[ ] Add a function to set the maximum number of connections. |
[ ] Add a function to set the maximum number of connections. |
15 |
19 |
[ ] Fix the whole list scanning for expiration, band and closing. |
[ ] Fix the whole list scanning for expiration, band and closing. |
16 |
20 |
[ ] Put callbacks in a structure to free some space from struct Conn. |
[ ] Put callbacks in a structure to free some space from struct Conn. |
17 |
|
|
|
|
21 |
|
[ ] Check if we are swapping and warn. |
|
22 |
|
[ ] Log faults and io. |
|
23 |
|
[ ] We must have a single set of pointers to callback, not many. At Conn creation, |
|
24 |
|
we copy the default set and than replace, on request, some members. |
|
25 |
|
This will simplify the code. |
18 |
26 |
[ ] Add access control |
[ ] Add access control |
19 |
27 |
Conn_ac_set_default(C, CONN_AC_DENY) - default deny (or CONN_AC_ALLOW) |
Conn_ac_set_default(C, CONN_AC_DENY) - default deny (or CONN_AC_ALLOW) |
20 |
28 |
Conn_ac_add(C, CONN_AC_ALLOW, "2001::1/64"); - for ipv6 |
Conn_ac_add(C, CONN_AC_ALLOW, "2001::1/64"); - for ipv6 |
21 |
29 |
Conn_ac_add(C, CONN_AC_ALLOW, "192.168.0.0/25"); - for ipv4 |
Conn_ac_add(C, CONN_AC_ALLOW, "192.168.0.0/25"); - for ipv4 |
22 |
30 |
[ ] A la redir stuff |
[ ] A la redir stuff |
23 |
|
|
|
24 |
31 |
[ ] Bridge 2 connections together for proxy stuff. |
[ ] Bridge 2 connections together for proxy stuff. |
25 |
32 |
[ ] Check PACKET: can we send with "send" without knowing the MAC? |
[ ] Check PACKET: can we send with "send" without knowing the MAC? |
26 |
33 |
[ ] UDP |
[ ] UDP |
27 |
34 |
[ ] Ce se intimpla daca se ajunge la ~ sfirsitul buffer-ului si nu pot inca sa |
[ ] Ce se intimpla daca se ajunge la ~ sfirsitul buffer-ului si nu pot inca sa |
28 |
|
procesez datele? |
|
|
35 |
|
procesez datele? We should log and close the connection. It is |
|
36 |
|
programmer's fault or a DoS. |
29 |
37 |
[ ] Queue for delete/trytoconnect/etc. |
[ ] Queue for delete/trytoconnect/etc. |
30 |
38 |
|
|
31 |
39 |
Performance: |
Performance: |
|
... |
... |
Pentru a reduce numarul de conexiuni in TIME-WAIT: |
47 |
55 |
echo 200 > /proc/sys/net/ipv4/tcp_max_tw_buckets |
echo 200 > /proc/sys/net/ipv4/tcp_max_tw_buckets |
48 |
56 |
|
|
49 |
57 |
[ ] Add loadbalancing and failover in the base code. |
[ ] Add loadbalancing and failover in the base code. |
50 |
|
[ ] Automaticaly put \0 at the end of receive data. |
|
51 |
|
[ ] Add the possibility to wait for an char/string before calling recv callback |
|
|
58 |
|
[ ] Automaticaly put \0 at the end of receive data. What for?! |
|
59 |
|
[ ] Add the possibility to wait for an char/string before calling recv callback. |
|
60 |
|
Maybe do this with socket filtering or in kernel? |
52 |
61 |
[ ] Change socket buffer accordingly with user settings to minimize |
[ ] Change socket buffer accordingly with user settings to minimize |
53 |
62 |
needed memory. |
needed memory. |
54 |
63 |
|
|
|
... |
... |
Pentru a reduce numarul de conexiuni in TIME-WAIT: |
57 |
66 |
[ ] Test suite |
[ ] Test suite |
58 |
67 |
[ ] Free memory when the number of connections is going down. |
[ ] Free memory when the number of connections is going down. |
59 |
68 |
[ ] Bandwidth part should have a separate pointer, to not load too much Conn structure. |
[ ] Bandwidth part should have a separate pointer, to not load too much Conn structure. |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
|
69 |
|
[ ] Maybe we should have Bandwidth classes so we can group connections. |
|
70 |
|
[ ] http://www.erlang-solutions.com/thesis/tcp_optimisation/tcp_optimisation.html |
|
71 |
|
[ ] |
63 |
72 |
|
|
64 |
73 |
=== When we switch to Conn version 2 library === |
=== When we switch to Conn version 2 library === |
65 |
74 |
[ ] Conn_socket will cann Conn_socket_proto |
[ ] Conn_socket will cann Conn_socket_proto |
66 |
75 |
[ ] use enums! |
[ ] use enums! |
|
76 |
|
[ ] All internal variables of Conn structure must not be exposed directly. |
|
77 |
|
[ ] http://urbanairship.com/blog/2010/09/29/linux-kernel-tuning-for-c500k/ |
|
78 |
|
[ ] |
File duilder changed (mode: 100755) (index bf888f6..a6e2825) |
2 |
2 |
|
|
3 |
3 |
set -e |
set -e |
4 |
4 |
|
|
5 |
|
function git_last_changelog() |
|
6 |
|
{ |
|
7 |
|
changelog="" |
|
8 |
|
|
|
9 |
|
# get the list of tags |
|
10 |
|
i=0 |
|
11 |
|
number_of_tags=0 |
|
12 |
|
for tag in `git tag -l`; do |
|
13 |
|
if [ "${tag:0:1}" != "v" ]; then |
|
14 |
|
# skip other kind of tags beside versions |
|
15 |
|
continue |
|
16 |
|
fi |
|
17 |
|
|
|
18 |
|
tags[${i}]=${tag} |
|
19 |
|
tags_commit[${i}]=`git show-ref ${tag} | cut -d' ' -f1` |
|
20 |
|
number_of_tags=$[${number_of_tags}+1] |
|
21 |
|
|
|
22 |
|
i=$[${i}+1] |
|
23 |
|
done |
|
24 |
|
|
|
25 |
|
# get the list of commits, test if is a tag and do the diff |
|
26 |
|
prev="" |
|
27 |
|
git log --pretty=oneline | cut -f1 | \ |
|
28 |
|
while read commit junk; do |
|
29 |
|
# test if it is a tag |
|
30 |
|
tag="" |
|
31 |
|
i=0 |
|
32 |
|
while [ "${i}" -lt "${number_of_tags}" ]; do |
|
33 |
|
if [ "${commit}" = "${tags_commit[${i}]}" ]; then |
|
34 |
|
tag="${tags[${i}]}" |
|
35 |
|
break |
|
36 |
|
fi |
|
37 |
|
|
|
38 |
|
i=$[${i}+1] |
|
39 |
|
done |
|
40 |
|
|
|
41 |
|
if [ -z "${tag}" ]; then |
|
42 |
|
continue |
|
43 |
|
fi |
|
44 |
|
|
|
45 |
|
if [ ! -z "${prev}" ]; then |
|
46 |
|
current=${tag} |
|
47 |
|
git shortlog ${current}..${prev} | \ |
|
48 |
|
(IFS="" |
|
49 |
|
while read line; do |
|
50 |
|
echo " ${line}" |
|
51 |
|
done) |
|
52 |
|
echo |
|
53 |
|
break |
|
54 |
|
fi |
|
55 |
|
prev=${tag} |
|
56 |
|
done |
|
57 |
|
} |
|
58 |
|
|
|
59 |
5 |
function duilder_final() |
function duilder_final() |
60 |
6 |
{ |
{ |
61 |
7 |
PRJ="${1}" |
PRJ="${1}" |
|
... |
... |
function duilder_final() |
64 |
10 |
|
|
65 |
11 |
# Run release script |
# Run release script |
66 |
12 |
if [ ! -z "${RELEASE_SCRIPT}" -a -x "${RELEASE_SCRIPT}" ]; then |
if [ ! -z "${RELEASE_SCRIPT}" -a -x "${RELEASE_SCRIPT}" ]; then |
67 |
|
echo "Running ${RELEASE_SCRIPT}..." |
|
68 |
|
export CHANGELOG=`git_last_changelog` |
|
|
13 |
|
echo "[*] Running ${RELEASE_SCRIPT}..." |
69 |
14 |
${RELEASE_SCRIPT} |
${RELEASE_SCRIPT} |
70 |
15 |
fi |
fi |
71 |
16 |
} |
} |
|
... |
... |
function duilder_docs() |
76 |
21 |
VER="${2}" |
VER="${2}" |
77 |
22 |
EXPORT_PATH="${3}" |
EXPORT_PATH="${3}" |
78 |
23 |
|
|
79 |
|
echo "Copying docs to [${EXPORT_PATH}]..." |
|
80 |
|
for f in README License LICENSE Changelog TODO FAQ INSTALL; do |
|
|
24 |
|
if [ ! -d "${EXPORT_PATH}" ]; then |
|
25 |
|
echo "[*] WARN: ${EXPORT_PATH} does not exists. Creating it..." |
|
26 |
|
mkdir -p "${EXPORT_PATH}" |
|
27 |
|
fi |
|
28 |
|
|
|
29 |
|
echo "[*] Copying docs to [${EXPORT_PATH}]..." |
|
30 |
|
for f in README License LICENSE Changelog Changelog-last TODO FAQ INSTALL; do |
81 |
31 |
if [ -r "${f}" ]; then |
if [ -r "${f}" ]; then |
82 |
32 |
cp -vp "${f}" "${EXPORT_PATH}/" |
cp -vp "${f}" "${EXPORT_PATH}/" |
83 |
33 |
fi |
fi |
84 |
34 |
done |
done |
|
35 |
|
echo |
85 |
36 |
|
|
86 |
37 |
if [ -d "screenshot" ]; then |
if [ -d "screenshot" ]; then |
87 |
|
echo "Copying screenshots..." |
|
|
38 |
|
echo "[*] Copying screenshots..." |
88 |
39 |
mkdir -p "${EXPORT_PATH}" |
mkdir -p "${EXPORT_PATH}" |
89 |
40 |
cp -vp screenshot/* "${EXPORT_PATH}/" |
cp -vp screenshot/* "${EXPORT_PATH}/" |
|
41 |
|
echo |
90 |
42 |
fi |
fi |
91 |
43 |
} |
} |
92 |
44 |
|
|
|
... |
... |
function duilder_git() |
99 |
51 |
GIT_PUSH="${5}" |
GIT_PUSH="${5}" |
100 |
52 |
|
|
101 |
53 |
if [ ! -x /usr/bin/git ]; then |
if [ ! -x /usr/bin/git ]; then |
102 |
|
echo "Warning: Git not found!" |
|
|
54 |
|
echo "[*] Warning: Git not found!" |
103 |
55 |
exit 0 |
exit 0 |
104 |
56 |
fi |
fi |
105 |
57 |
|
|
106 |
58 |
if [ ! -d .git ]; then |
if [ ! -d .git ]; then |
107 |
|
echo "Warning: I cannot find .git directory!" |
|
|
59 |
|
echo "[*] Warning: I cannot find .git directory!" |
108 |
60 |
exit 0 |
exit 0 |
109 |
61 |
fi |
fi |
110 |
62 |
|
|
111 |
63 |
if [ "${EXPORT_GIT}" = "1" ]; then |
if [ "${EXPORT_GIT}" = "1" ]; then |
112 |
|
echo "Generate GIT tree for HTTP transport..." |
|
|
64 |
|
echo "[*] Generating GIT tree for HTTP transport..." |
113 |
65 |
if [ ! -d "${GIT_DEST}/${PRJ}.git" ]; then |
if [ ! -d "${GIT_DEST}/${PRJ}.git" ]; then |
114 |
66 |
git clone --bare . "${GIT_DEST}/${PRJ}.git" |
git clone --bare . "${GIT_DEST}/${PRJ}.git" |
115 |
67 |
|
|
|
... |
... |
function duilder_git() |
143 |
95 |
echo -n > Changelog |
echo -n > Changelog |
144 |
96 |
|
|
145 |
97 |
# get the list of tags |
# get the list of tags |
146 |
|
i=0 |
|
147 |
98 |
number_of_tags=0 |
number_of_tags=0 |
148 |
|
for tag in `git tag -l`; do |
|
149 |
|
if [ "${tag:0:1}" != "v" ]; then |
|
150 |
|
# skip other kind of tags beside versions |
|
151 |
|
continue |
|
152 |
|
fi |
|
153 |
|
|
|
154 |
|
tags[${i}]=${tag} |
|
155 |
|
tags_commit[${i}]=`git show-ref ${tag} | cut -d' ' -f1` |
|
|
99 |
|
while read sha1 full_tag; do |
|
100 |
|
tag=`echo ${full_tag} | sed -e 's#refs/tags/##' | cut -d'^' -f1` |
|
101 |
|
tags[${number_of_tags}]=${tag} |
|
102 |
|
tags_commit[${number_of_tags}]=${sha1} |
156 |
103 |
number_of_tags=$[${number_of_tags}+1] |
number_of_tags=$[${number_of_tags}+1] |
157 |
|
|
|
158 |
|
i=$[${i}+1] |
|
159 |
|
done |
|
|
104 |
|
done < <(git show-ref --tags -d | grep refs/tags/v) |
160 |
105 |
|
|
161 |
106 |
# get the list of commits, test if is a tag and do the diff |
# get the list of commits, test if is a tag and do the diff |
162 |
107 |
prev="" |
prev="" |
|
108 |
|
add="" |
|
109 |
|
first=1 |
163 |
110 |
git log --pretty=oneline | cut -f1 | \ |
git log --pretty=oneline | cut -f1 | \ |
164 |
111 |
while read commit junk; do |
while read commit junk; do |
165 |
112 |
# test if it is a tag |
# test if it is a tag |
|
... |
... |
function duilder_git() |
180 |
127 |
|
|
181 |
128 |
if [ ! -z "${prev}" ]; then |
if [ ! -z "${prev}" ]; then |
182 |
129 |
echo "[*] Generating Changelog from ${tag} -> ${prev}..." |
echo "[*] Generating Changelog from ${tag} -> ${prev}..." |
|
130 |
|
echo -en "${add}" >> Changelog |
|
131 |
|
add="\n" |
183 |
132 |
echo "[${tag} -> ${prev}]" >> Changelog |
echo "[${tag} -> ${prev}]" >> Changelog |
184 |
|
echo >> Changelog |
|
185 |
133 |
git shortlog ${tag}..${prev} | \ |
git shortlog ${tag}..${prev} | \ |
186 |
134 |
(IFS="" |
(IFS="" |
187 |
135 |
while read line; do |
while read line; do |
188 |
136 |
echo " ${line}" |
echo " ${line}" |
189 |
137 |
done) \ |
done) \ |
190 |
138 |
>> Changelog |
>> Changelog |
191 |
|
echo >> Changelog |
|
|
139 |
|
|
|
140 |
|
if [ "${first}" = "1" ]; then |
|
141 |
|
echo "[*] Generating Changelog-last..." |
|
142 |
|
cp Changelog Changelog-last |
|
143 |
|
first=0 |
|
144 |
|
fi |
192 |
145 |
fi |
fi |
193 |
146 |
prev=${tag} |
prev=${tag} |
194 |
147 |
done |
done |
|
... |
... |
function duilder_srpm() |
206 |
159 |
|
|
207 |
160 |
P="${PRJ}-${VER}" |
P="${PRJ}-${VER}" |
208 |
161 |
|
|
|
162 |
|
if [ ! -d "${EXPORT_PATH}" ]; then |
|
163 |
|
echo "WARN: ${EXPORT_PATH} does not exists. Creating it..." |
|
164 |
|
mkdir -p "${EXPORT_PATH}" |
|
165 |
|
fi |
|
166 |
|
|
209 |
167 |
if [ "${BUILD_SRPM}" != "1" ]; then |
if [ "${BUILD_SRPM}" != "1" ]; then |
210 |
168 |
exit 0 |
exit 0 |
211 |
169 |
fi |
fi |
212 |
170 |
|
|
213 |
|
echo "Building SRPM..." |
|
|
171 |
|
echo "[*] Building SRPM..." |
214 |
172 |
rpmbuild -ts "${P}.tar.gz" |
rpmbuild -ts "${P}.tar.gz" |
|
173 |
|
echo |
215 |
174 |
|
|
216 |
|
PKG="${RPMBUILD}/SRPMS/${P}-1.src.rpm" |
|
|
175 |
|
PKG="${RPMBUILD}/SRPMS/${P}-${REV}.src.rpm" |
|
176 |
|
|
|
177 |
|
# Run a rpmlint on it |
|
178 |
|
if [ -x /usr/bin/rpmlint ]; then |
|
179 |
|
echo "[*] RPMlinting..." |
|
180 |
|
rpmlint -iv "${PKG}" > rpmlint.out |
|
181 |
|
else |
|
182 |
|
echo "[*] WARN: rpmlint is missing!" |
|
183 |
|
fi |
217 |
184 |
|
|
218 |
185 |
if [ ! -z "${SRPM_DEST}" ]; then |
if [ ! -z "${SRPM_DEST}" ]; then |
219 |
|
echo "Copying [${PKG}] to [${SRPM_DEST}]..." |
|
|
186 |
|
echo "[*] Copying [${PKG}] to [${SRPM_DEST}]..." |
220 |
187 |
cp -vp "${PKG}" "${SRPM_DEST}/" |
cp -vp "${PKG}" "${SRPM_DEST}/" |
|
188 |
|
echo |
221 |
189 |
fi |
fi |
222 |
190 |
|
|
223 |
|
echo "Copying to export dir [${EXPORT_PATH}]..." |
|
|
191 |
|
echo "[*] Copying to export dir [${EXPORT_PATH}]..." |
224 |
192 |
mkdir -p "${EXPORT_PATH}" |
mkdir -p "${EXPORT_PATH}" |
225 |
193 |
cp -vp "${PKG}" "${EXPORT_PATH}/" |
cp -vp "${PKG}" "${EXPORT_PATH}/" |
|
194 |
|
echo |
226 |
195 |
|
|
227 |
196 |
if [ -x "${SRPM_POST_RUN}" ]; then |
if [ -x "${SRPM_POST_RUN}" ]; then |
228 |
|
echo "Running post SRPM build script [${SRPM_POST_RUN}]..." |
|
|
197 |
|
echo "[*] Running post SRPM build script [${SRPM_POST_RUN}]..." |
229 |
198 |
${SRPM_POST_RUN} "${PKG}" |
${SRPM_POST_RUN} "${PKG}" |
230 |
199 |
fi |
fi |
231 |
200 |
} |
} |
|
... |
... |
function duilder_tar() |
239 |
208 |
|
|
240 |
209 |
P="${PRJ}-${VER}" |
P="${PRJ}-${VER}" |
241 |
210 |
|
|
242 |
|
echo "Generating tarball [${P}.tar.gz]..." |
|
|
211 |
|
if [ ! -d "${EXPORT_PATH}" ]; then |
|
212 |
|
echo "[*] WARN: ${EXPORT_PATH} does not exists. Creating it..." |
|
213 |
|
mkdir -p "${EXPORT_PATH}" |
|
214 |
|
fi |
|
215 |
|
|
|
216 |
|
echo "[*] Generating tarball [${P}.tar.gz]..." |
243 |
217 |
ADD_EXCLUDE="" |
ADD_EXCLUDE="" |
244 |
218 |
if [ ! -z "${EXCLUDE}" ]; then |
if [ ! -z "${EXCLUDE}" ]; then |
245 |
219 |
ADD_EXCLUDE="--exclude-from ${P}/${EXCLUDE}" |
ADD_EXCLUDE="--exclude-from ${P}/${EXCLUDE}" |
|
... |
... |
function duilder_tar() |
256 |
230 |
&& rm -rf "${P}" |
&& rm -rf "${P}" |
257 |
231 |
) |
) |
258 |
232 |
|
|
259 |
|
echo "Copying source to ${EXPORT_PATH}/..." |
|
|
233 |
|
echo "[*] Copying source to ${EXPORT_PATH}..." |
260 |
234 |
mkdir -p "${EXPORT_PATH}" |
mkdir -p "${EXPORT_PATH}" |
261 |
235 |
cp -vp "${P}.tar.gz" "${EXPORT_PATH}/" |
cp -vp "${P}.tar.gz" "${EXPORT_PATH}/" |
|
236 |
|
echo |
262 |
237 |
} |
} |
263 |
238 |
|
|
264 |
239 |
#################################################################### |
#################################################################### |
|
... |
... |
else |
271 |
246 |
fi |
fi |
272 |
247 |
|
|
273 |
248 |
|
|
|
249 |
|
if [ ! -r duilder.conf ]; then |
|
250 |
|
echo "[*] You must build a duilder.conf file!" |
|
251 |
|
exit 1 |
|
252 |
|
fi |
|
253 |
|
|
|
254 |
|
source ${PWD}/duilder.conf |
|
255 |
|
|
|
256 |
|
# fixes |
|
257 |
|
if [ -z "${GIT_DEST}" ]; then |
|
258 |
|
GIT_DEST="${EXPORT_PATH}" |
|
259 |
|
fi |
|
260 |
|
|
|
261 |
|
if [ -z "${PRJ}" ]; then |
|
262 |
|
echo "ERROR: PRJ= parameter is missing." |
|
263 |
|
exit 1 |
|
264 |
|
fi |
|
265 |
|
|
|
266 |
|
if [ -z "${VER}" ]; then |
|
267 |
|
echo "ERROR: VER= parameter is missing." |
|
268 |
|
exit 1 |
|
269 |
|
fi |
|
270 |
|
|
|
271 |
|
if [ -z "${REV}" ]; then |
|
272 |
|
echo "ERROR: REV= parameter is missing." |
|
273 |
|
exit 1 |
|
274 |
|
fi |
|
275 |
|
|
|
276 |
|
# export variables - just in case a script cares |
|
277 |
|
export PRJ VER REV EXPORT_PATH EXPORT_GIT GIT_PUSH GIT_DEST SRPM_DEST LICENSE |
|
278 |
|
|
|
279 |
|
|
274 |
280 |
# Multiplexer |
# Multiplexer |
275 |
281 |
if [ "${1}" = "docs" ]; then |
if [ "${1}" = "docs" ]; then |
276 |
282 |
shift |
shift |
|
... |
... |
if [ "${1}" = "final" ]; then |
302 |
308 |
exit $? |
exit $? |
303 |
309 |
fi |
fi |
304 |
310 |
|
|
305 |
|
if [ ! -r duilder.conf ]; then |
|
306 |
|
echo "You must build a duilder.conf file!" |
|
307 |
|
exit 1 |
|
308 |
|
fi |
|
309 |
|
|
|
310 |
311 |
|
|
311 |
312 |
###### Main stuff |
###### Main stuff |
312 |
|
|
|
313 |
|
source ${PWD}/duilder.conf |
|
314 |
|
|
|
315 |
|
# fixes |
|
316 |
|
if [ -z "${GIT_DEST}" ]; then |
|
317 |
|
GIT_DEST="${EXPORT_PATH}" |
|
318 |
|
fi |
|
319 |
|
|
|
320 |
|
# export variables - just in case a script cares |
|
321 |
|
export PRJ VER REV EXPORT_PATH EXPORT_GIT GIT_PUSH GIT_DEST SRPMS_DEST LICENSE |
|
322 |
|
|
|
323 |
|
if [ -z "${PRJ}" ]; then |
|
324 |
|
echo "ERROR: PRJ= parameter is missing." |
|
325 |
|
exit 1 |
|
326 |
|
fi |
|
327 |
|
|
|
328 |
|
if [ -z "${VER}" ]; then |
|
329 |
|
echo "ERROR: PRJ= parameter is missing." |
|
330 |
|
exit 1 |
|
331 |
|
fi |
|
332 |
|
|
|
333 |
|
if [ -z "${REV}" ]; then |
|
334 |
|
echo "ERROR: REV= parameter is missing." |
|
335 |
|
exit 1 |
|
336 |
|
fi |
|
337 |
|
|
|
338 |
|
echo |
|
339 |
|
echo "Duilder builder script" |
|
340 |
|
echo "Copyright Catalin(ux) M BOIE" |
|
341 |
|
echo |
|
342 |
|
echo "PRJ=${PRJ}, VER=${VER}, REV=${REV}" |
|
343 |
|
echo "System: `uname -a`" |
|
|
313 |
|
echo "[*] Duilder builder script" |
|
314 |
|
echo "[*] Copyright Catalin(ux) M. BOIE - catab at embedromix dot ro" |
|
315 |
|
echo "[*] PRJ=${PRJ}, VER=${VER}, REV=${REV}" |
|
316 |
|
echo "[*] System: `uname -a`" |
344 |
317 |
|
|
345 |
318 |
ETC="/etc" |
ETC="/etc" |
346 |
319 |
BIN="/bin" |
BIN="/bin" |
|
... |
... |
USR_BIN="/usr/bin" |
348 |
321 |
USR_SBIN="/usr/sbin" |
USR_SBIN="/usr/sbin" |
349 |
322 |
USR_INCLUDE="/usr/include" |
USR_INCLUDE="/usr/include" |
350 |
323 |
USR_LIB="/usr/lib" |
USR_LIB="/usr/lib" |
|
324 |
|
USR_SHARE="/usr/share" |
351 |
325 |
USR_SHARE_DOC="/usr/share/doc/${PRJ}-${VER}" |
USR_SHARE_DOC="/usr/share/doc/${PRJ}-${VER}" |
352 |
326 |
SBIN="/usr/sbin" |
SBIN="/usr/sbin" |
353 |
|
VAR_LOG="/var/log/${PRJ}" |
|
|
327 |
|
VAR="/var" |
|
328 |
|
VAR_LIB="/var/lib" |
354 |
329 |
|
|
355 |
330 |
while [ "${1}" != "" ]; do |
while [ "${1}" != "" ]; do |
356 |
331 |
VAR="`echo ${1} | cut -d'=' -f1`" |
VAR="`echo ${1} | cut -d'=' -f1`" |
|
... |
... |
while [ "${1}" != "" ]; do |
371 |
346 |
--libdir) |
--libdir) |
372 |
347 |
USR_LIB="${VAL}" |
USR_LIB="${VAL}" |
373 |
348 |
;; |
;; |
|
349 |
|
--localstatedir) |
|
350 |
|
VAR="${VAL}" |
|
351 |
|
;; |
|
352 |
|
--sharedstatedir) |
|
353 |
|
VAR_LIB="${VAL}" |
|
354 |
|
;; |
|
355 |
|
--datadir) |
|
356 |
|
USR_SHARE="${VAL}" |
|
357 |
|
;; |
374 |
358 |
esac |
esac |
375 |
359 |
shift |
shift |
376 |
360 |
done |
done |
377 |
361 |
|
|
|
362 |
|
# Last fixes |
|
363 |
|
VAR_LOG="${VAR}/log" |
|
364 |
|
VAR_RUN="${VAR}/run" |
|
365 |
|
|
|
366 |
|
|
378 |
367 |
# Truncate future sed file |
# Truncate future sed file |
379 |
368 |
> tmp.sed |
> tmp.sed |
380 |
369 |
|
|
381 |
370 |
DB_SUPPORT=0 |
DB_SUPPORT=0 |
382 |
371 |
|
|
383 |
|
echo -n "Searching for PostgreSQL..." |
|
|
372 |
|
echo -n "[*] Searching for PostgreSQL..." |
384 |
373 |
set +e |
set +e |
385 |
374 |
PG_VERSION="`pg_config --version 2>/dev/null`" |
PG_VERSION="`pg_config --version 2>/dev/null`" |
386 |
375 |
set -e |
set -e |
|
... |
... |
fi |
403 |
392 |
echo "s#@PG_FOUND@#${PG_FOUND}#g" >> tmp.sed |
echo "s#@PG_FOUND@#${PG_FOUND}#g" >> tmp.sed |
404 |
393 |
|
|
405 |
394 |
|
|
406 |
|
echo -n "Searching for MySQL..." |
|
|
395 |
|
echo -n "[*] Searching for MySQL..." |
407 |
396 |
set +e |
set +e |
408 |
397 |
MYSQL_VERSION="`mysql_config --version 2>/dev/null`" |
MYSQL_VERSION="`mysql_config --version 2>/dev/null`" |
409 |
398 |
set -e |
set -e |
|
... |
... |
else |
425 |
414 |
fi |
fi |
426 |
415 |
echo "s#@MYSQL_FOUND@#${MYSQL_FOUND}#g" >> tmp.sed |
echo "s#@MYSQL_FOUND@#${MYSQL_FOUND}#g" >> tmp.sed |
427 |
416 |
|
|
428 |
|
echo -n "Searching for poll..." |
|
|
417 |
|
echo -n "[*] Searching for poll..." |
429 |
418 |
set +e |
set +e |
430 |
419 |
echo -e "#include <poll.h> \n int main(void) { return poll(0, 0, 0); }" | gcc -x c -pipe - -o /dev/null 2>/dev/null |
echo -e "#include <poll.h> \n int main(void) { return poll(0, 0, 0); }" | gcc -x c -pipe - -o /dev/null 2>/dev/null |
431 |
420 |
E="${?}" |
E="${?}" |
|
... |
... |
else |
438 |
427 |
echo "s#@POLL_FOUND@#1#g" >> tmp.sed |
echo "s#@POLL_FOUND@#1#g" >> tmp.sed |
439 |
428 |
fi |
fi |
440 |
429 |
|
|
441 |
|
echo -n "Searching for epoll..." |
|
|
430 |
|
echo -n "[*] Searching for epoll..." |
442 |
431 |
set +e |
set +e |
443 |
432 |
echo -e "#include <sys/epoll.h> \n int main(void) { return epoll_create(64); }" | gcc -x c -pipe - -o /dev/null 2>/dev/null |
echo -e "#include <sys/epoll.h> \n int main(void) { return epoll_create(64); }" | gcc -x c -pipe - -o /dev/null 2>/dev/null |
444 |
433 |
E="${?}" |
E="${?}" |
|
... |
... |
else |
451 |
440 |
echo "s#@EPOLL_FOUND@#1#g" >> tmp.sed |
echo "s#@EPOLL_FOUND@#1#g" >> tmp.sed |
452 |
441 |
fi |
fi |
453 |
442 |
|
|
|
443 |
|
echo -n "[*] Searching for ncurses..." |
|
444 |
|
set +e |
|
445 |
|
echo -e "#include <ncurses.h> \n int main(void) { initscr(); return 0; }" | gcc -x c -pipe - -o /dev/null -lncurses 2>/dev/null |
|
446 |
|
E="${?}" |
|
447 |
|
set -e |
|
448 |
|
if [ "${E}" != "0" ]; then |
|
449 |
|
echo " not found." |
|
450 |
|
echo "s#@NCURSES_FOUND@#0#g" >> tmp.sed |
|
451 |
|
else |
|
452 |
|
echo " found." |
|
453 |
|
echo "s#@NCURSES_FOUND@#1#g" >> tmp.sed |
|
454 |
|
fi |
|
455 |
|
|
454 |
456 |
# generic stuff |
# generic stuff |
455 |
457 |
echo "s#@PRJ@#${PRJ}#g" >> tmp.sed |
echo "s#@PRJ@#${PRJ}#g" >> tmp.sed |
456 |
458 |
echo "s#@VER@#${VER}#g" >> tmp.sed |
echo "s#@VER@#${VER}#g" >> tmp.sed |
457 |
459 |
echo "s#@REV@#${REV}#g" >> tmp.sed |
echo "s#@REV@#${REV}#g" >> tmp.sed |
458 |
|
echo "s#@DESCRIPTION@#${DESCRIPTION}#g" >> tmp.sed |
|
459 |
|
|
|
460 |
460 |
echo "s#@ETC@#${ETC}#g" >> tmp.sed |
echo "s#@ETC@#${ETC}#g" >> tmp.sed |
461 |
461 |
echo "s#@BIN@#${BIN}#g" >> tmp.sed |
echo "s#@BIN@#${BIN}#g" >> tmp.sed |
462 |
462 |
echo "s#@USR_BIN@#${USR_BIN}#g" >> tmp.sed |
echo "s#@USR_BIN@#${USR_BIN}#g" >> tmp.sed |
463 |
463 |
echo "s#@SBIN@#${SBIN}#g" >> tmp.sed |
echo "s#@SBIN@#${SBIN}#g" >> tmp.sed |
464 |
464 |
echo "s#@USR_SBIN@#${USR_SBIN}#g" >> tmp.sed |
echo "s#@USR_SBIN@#${USR_SBIN}#g" >> tmp.sed |
|
465 |
|
echo "s#@VAR@#${VAR}#g" >> tmp.sed |
|
466 |
|
echo "s#@VAR_LIB@#${VAR_LIB}#g" >> tmp.sed |
465 |
467 |
echo "s#@VAR_LOG@#${VAR_LOG}#g" >> tmp.sed |
echo "s#@VAR_LOG@#${VAR_LOG}#g" >> tmp.sed |
|
468 |
|
echo "s#@VAR_RUN@#${VAR_RUN}#g" >> tmp.sed |
466 |
469 |
echo "s#@USR_INCLUDE@#${USR_INCLUDE}#g" >> tmp.sed |
echo "s#@USR_INCLUDE@#${USR_INCLUDE}#g" >> tmp.sed |
467 |
470 |
echo "s#@USR_INC@#${USR_INCLUDE}#g" >> tmp.sed |
echo "s#@USR_INC@#${USR_INCLUDE}#g" >> tmp.sed |
468 |
471 |
echo "s#@USR_LIB@#${USR_LIB}#g" >> tmp.sed |
echo "s#@USR_LIB@#${USR_LIB}#g" >> tmp.sed |
|
472 |
|
echo "s#@USR_SHARE@#${USR_SHARE}#g" >> tmp.sed |
469 |
473 |
echo "s#@USR_SHARE_DOC@#${USR_SHARE_DOC}#g" >> tmp.sed |
echo "s#@USR_SHARE_DOC@#${USR_SHARE_DOC}#g" >> tmp.sed |
470 |
474 |
# Export stuff |
# Export stuff |
471 |
475 |
echo "s#@EXPORT_PATH@#${EXPORT_PATH}#g" >> tmp.sed |
echo "s#@EXPORT_PATH@#${EXPORT_PATH}#g" >> tmp.sed |
|
... |
... |
echo "s#@EXPORT_PATH@#${EXPORT_PATH}#g" >> tmp.sed |
473 |
477 |
|
|
474 |
478 |
|
|
475 |
479 |
if [ -r Makefile.in ]; then |
if [ -r Makefile.in ]; then |
476 |
|
echo "Building Makefile..." |
|
|
480 |
|
echo "[*] Building Makefile..." |
477 |
481 |
echo -n > Makefile |
echo -n > Makefile |
478 |
482 |
echo "# duilder header starts #" >> Makefile |
echo "# duilder header starts #" >> Makefile |
479 |
483 |
echo "export PRJ := ${PRJ}" >> Makefile |
echo "export PRJ := ${PRJ}" >> Makefile |
|
... |
... |
if [ -r Makefile.in ]; then |
488 |
492 |
echo "export I_USR_SBIN := \$(DESTDIR)${USR_SBIN}" >> Makefile |
echo "export I_USR_SBIN := \$(DESTDIR)${USR_SBIN}" >> Makefile |
489 |
493 |
echo "export I_USR_INCLUDE := \$(DESTDIR)${USR_INCLUDE}" >> Makefile |
echo "export I_USR_INCLUDE := \$(DESTDIR)${USR_INCLUDE}" >> Makefile |
490 |
494 |
echo "export I_USR_INC := \$(DESTDIR)${USR_INCLUDE}" >> Makefile |
echo "export I_USR_INC := \$(DESTDIR)${USR_INCLUDE}" >> Makefile |
|
495 |
|
echo "export I_USR_SHARE := \$(DESTDIR)${USR_SHARE}" >> Makefile |
491 |
496 |
echo "export I_USR_SHARE_DOC := \$(DESTDIR)${USR_SHARE_DOC}" >> Makefile |
echo "export I_USR_SHARE_DOC := \$(DESTDIR)${USR_SHARE_DOC}" >> Makefile |
492 |
497 |
echo "export I_USR_LIB := \$(DESTDIR)${USR_LIB}" >> Makefile |
echo "export I_USR_LIB := \$(DESTDIR)${USR_LIB}" >> Makefile |
493 |
498 |
echo "export I_LIB := \$(DESTDIR)${USR_LIB}" >> Makefile |
echo "export I_LIB := \$(DESTDIR)${USR_LIB}" >> Makefile |
|
499 |
|
echo "export I_VAR := \$(DESTDIR)${VAR}" >> Makefile |
|
500 |
|
echo "export I_VAR_LIB := \$(DESTDIR)${VAR_LIB}" >> Makefile |
494 |
501 |
echo "export I_VAR_LOG := \$(DESTDIR)${VAR_LOG}" >> Makefile |
echo "export I_VAR_LOG := \$(DESTDIR)${VAR_LOG}" >> Makefile |
|
502 |
|
echo "export I_VAR_RUN := \$(DESTDIR)${VAR_RUN}" >> Makefile |
495 |
503 |
echo >> Makefile |
echo >> Makefile |
496 |
504 |
echo "# DB stuff" >> Makefile |
echo "# DB stuff" >> Makefile |
497 |
505 |
echo "export DB_SUPPORT := ${DB_SUPPORT}" >> Makefile |
echo "export DB_SUPPORT := ${DB_SUPPORT}" >> Makefile |
|
... |
... |
if [ -r Makefile.in ]; then |
528 |
536 |
fi |
fi |
529 |
537 |
|
|
530 |
538 |
if [ -r "${PRJ}.spec.in" ]; then |
if [ -r "${PRJ}.spec.in" ]; then |
531 |
|
echo "Generate .spec file..." |
|
|
539 |
|
echo "[*] Generating .spec file..." |
532 |
540 |
sed -f tmp.sed ${PRJ}.spec.in > ${PRJ}.spec |
sed -f tmp.sed ${PRJ}.spec.in > ${PRJ}.spec |
533 |
541 |
fi |
fi |
534 |
542 |
|
|
535 |
|
if [ -z "${CONFIG_H}" ]; then |
|
536 |
|
CONFIG_H="config.h" |
|
|
543 |
|
if [ ! -z "${CONFIG_H}" ]; then |
|
544 |
|
echo "[*] Generating ${CONFIG_H} file..." |
|
545 |
|
sed -f tmp.sed ${CONFIG_H}.in > ${CONFIG_H} |
537 |
546 |
fi |
fi |
538 |
|
echo "Generating ${CONFIG_H} file..." |
|
539 |
|
sed -f tmp.sed ${CONFIG_H}.in > ${CONFIG_H} |
|
540 |
547 |
|
|
541 |
548 |
rm -f tmp.sed |
rm -f tmp.sed |
542 |
549 |
|
|
543 |
550 |
if [ "`basename ${0}`" = "duilderx" ]; then |
if [ "`basename ${0}`" = "duilderx" ]; then |
544 |
|
echo "Clone myself to destination as 'duilder'..." |
|
|
551 |
|
echo "[*] Cloning myself to destination as 'duilder'..." |
545 |
552 |
cp -vpf "${0}" ${PWD}/duilder |
cp -vpf "${0}" ${PWD}/duilder |
546 |
553 |
fi |
fi |
547 |
554 |
|
|
548 |
|
echo "Done. Run make." |
|
|
555 |
|
echo "[*] Done. Run make." |