File duilder changed (mode: 100755) (index 4366629..3ae028d) |
... |
... |
function duilder_docs() |
9 |
9 |
EXPORT_PATH="${3}" |
EXPORT_PATH="${3}" |
10 |
10 |
|
|
11 |
11 |
echo "Copying docs to [${EXPORT_PATH}]..." |
echo "Copying docs to [${EXPORT_PATH}]..." |
12 |
|
for f in README License LICENCE Changelog TODO FAQ; do |
|
|
12 |
|
for f in README License LICENSE Changelog TODO FAQ INSTALL; do |
13 |
13 |
if [ -r "${f}" ]; then |
if [ -r "${f}" ]; then |
14 |
14 |
cp -vp "${f}" "${EXPORT_PATH}/" |
cp -vp "${f}" "${EXPORT_PATH}/" |
15 |
15 |
fi |
fi |
|
... |
... |
function duilder_git() |
34 |
34 |
exit 0 |
exit 0 |
35 |
35 |
fi |
fi |
36 |
36 |
|
|
|
37 |
|
if [ ! -x /usr/bin/git ]; then |
|
38 |
|
echo "Warning: Git not found!" |
|
39 |
|
exit 0 |
|
40 |
|
fi |
|
41 |
|
|
37 |
42 |
if [ ! -d .git ]; then |
if [ ! -d .git ]; then |
|
43 |
|
echo "Warning: I cannot find .git directory!" |
38 |
44 |
exit 0 |
exit 0 |
39 |
45 |
fi |
fi |
40 |
46 |
|
|
|
... |
... |
function duilder_git() |
45 |
51 |
echo "Generate GIT tree for HTTP transport..." |
echo "Generate GIT tree for HTTP transport..." |
46 |
52 |
if [ ! -d "${GIT_DEST}/${PRJ}.git" ]; then |
if [ ! -d "${GIT_DEST}/${PRJ}.git" ]; then |
47 |
53 |
git-clone --bare . "${GIT_DEST}/${PRJ}.git" |
git-clone --bare . "${GIT_DEST}/${PRJ}.git" |
|
54 |
|
|
|
55 |
|
# Activate post-update hook |
48 |
56 |
chmod a+x "${GIT_DEST}/${PRJ}.git/hooks/post-update" |
chmod a+x "${GIT_DEST}/${PRJ}.git/hooks/post-update" |
|
57 |
|
|
|
58 |
|
# add project name and description |
49 |
59 |
echo "${PRJ}" > "${GIT_DEST}/${PRJ}.git/description" |
echo "${PRJ}" > "${GIT_DEST}/${PRJ}.git/description" |
|
60 |
|
|
50 |
61 |
# allow export by git daemon? |
# allow export by git daemon? |
51 |
62 |
#touch "${GIT_DEST}/${PRJ}.git/git-daemon-export-ok |
#touch "${GIT_DEST}/${PRJ}.git/git-daemon-export-ok |
52 |
63 |
else |
else |
|
... |
... |
function duilder_srpm() |
85 |
96 |
EXPORT_PATH="${3}" |
EXPORT_PATH="${3}" |
86 |
97 |
BUILD_SRPM="${4}" |
BUILD_SRPM="${4}" |
87 |
98 |
SRPM_DEST="${5}" |
SRPM_DEST="${5}" |
|
99 |
|
SRPM_POST_RUN="${6}" |
88 |
100 |
|
|
89 |
101 |
P="${PRJ}-${VER}" |
P="${PRJ}-${VER}" |
90 |
102 |
|
|
|
... |
... |
function duilder_srpm() |
95 |
107 |
echo "Building SRPM..." |
echo "Building SRPM..." |
96 |
108 |
rpmbuild -ts "${P}.tar.gz" |
rpmbuild -ts "${P}.tar.gz" |
97 |
109 |
|
|
|
110 |
|
PKG="/usr/src/redhat/SRPMS/${P}-1.src.rpm" |
|
111 |
|
|
98 |
112 |
if [ ! -z "${SRPM_DEST}" ]; then |
if [ ! -z "${SRPM_DEST}" ]; then |
99 |
113 |
echo "Copying to [${SRPM_DEST}]..." |
echo "Copying to [${SRPM_DEST}]..." |
100 |
|
cp -vp /usr/src/redhat/SRPMS/${P}* "${SRPM_DEST}/" |
|
|
114 |
|
cp -vp "${PKG}" "${SRPM_DEST}/" |
101 |
115 |
fi |
fi |
102 |
116 |
|
|
103 |
117 |
echo "Copying to export dir [${EXPORT_PATH}]..." |
echo "Copying to export dir [${EXPORT_PATH}]..." |
104 |
118 |
mkdir -p "${EXPORT_PATH}" |
mkdir -p "${EXPORT_PATH}" |
105 |
|
cp -vp /usr/src/redhat/SRPMS/${P}* "${EXPORT_PATH}/" |
|
|
119 |
|
cp -vp "${PKG}" "${EXPORT_PATH}/" |
|
120 |
|
|
|
121 |
|
if [ -x "${SRPM_POST_RUN}" ]; then |
|
122 |
|
echo "Running post SRPM build script [${SRPM_POST_RUN}]..." |
|
123 |
|
${SRPM_POST_RUN} "${PKG}" |
|
124 |
|
fi |
106 |
125 |
} |
} |
107 |
126 |
|
|
108 |
127 |
function duilder_tar() |
function duilder_tar() |
|
... |
... |
function duilder_tar() |
123 |
142 |
(cd .. && rm -f "${P}" && ln -s "${PRJ}" "${P}") |
(cd .. && rm -f "${P}" && ln -s "${PRJ}" "${P}") |
124 |
143 |
tar czhf "${P}.tar.gz" \ |
tar czhf "${P}.tar.gz" \ |
125 |
144 |
--exclude '.git' \ |
--exclude '.git' \ |
|
145 |
|
--exclude ./Makefile \ |
126 |
146 |
--exclude "${P}.tar.gz" \ |
--exclude "${P}.tar.gz" \ |
127 |
147 |
${ADD} \ |
${ADD} \ |
128 |
148 |
-C .. "${P}" |
-C .. "${P}" |
|
... |
... |
function duilder_tar() |
137 |
157 |
|
|
138 |
158 |
#################################################################### |
#################################################################### |
139 |
159 |
|
|
140 |
|
###### Multiplexer |
|
|
160 |
|
# Multiplexer |
141 |
161 |
if [ "${1}" = "docs" ]; then |
if [ "${1}" = "docs" ]; then |
142 |
162 |
shift |
shift |
143 |
163 |
duilder_docs "$@" |
duilder_docs "$@" |
|
... |
... |
while [ "${1}" != "" ]; do |
227 |
247 |
shift |
shift |
228 |
248 |
done |
done |
229 |
249 |
|
|
|
250 |
|
# Truncate future sed file |
|
251 |
|
> tmp.sed |
230 |
252 |
|
|
231 |
253 |
DB_SUPPORT=0 |
DB_SUPPORT=0 |
232 |
254 |
|
|
233 |
255 |
echo -n "Searching for PostgreSQL..." |
echo -n "Searching for PostgreSQL..." |
234 |
|
PG_FOUND=0 |
|
235 |
|
PG_VERSION="" |
|
236 |
256 |
set +e |
set +e |
237 |
257 |
PG_VERSION="`pg_config --version 2>/dev/null`" |
PG_VERSION="`pg_config --version 2>/dev/null`" |
238 |
258 |
set -e |
set -e |
239 |
259 |
if [ -z "${PG_VERSION}" ]; then |
if [ -z "${PG_VERSION}" ]; then |
240 |
|
echo " not found!" |
|
|
260 |
|
echo " not found." |
|
261 |
|
PG_FOUND=0 |
241 |
262 |
else |
else |
242 |
|
echo " found version ${PG_VERSION}!" |
|
|
263 |
|
echo " found version ${PG_VERSION}." |
243 |
264 |
PG_FOUND=1 |
PG_FOUND=1 |
244 |
265 |
PG_INC="${DB_INC} -I`pg_config --includedir`" |
PG_INC="${DB_INC} -I`pg_config --includedir`" |
245 |
266 |
PG_LIB="${DB_INC} -L`pg_config --libdir` -lpq" |
PG_LIB="${DB_INC} -L`pg_config --libdir` -lpq" |
|
267 |
|
|
|
268 |
|
echo "s#@PG_VERSION@#${PG_VERSION}#g" >> tmp.sed |
|
269 |
|
echo "s#@PG_INC@#${PG_INC}#g" >> tmp.sed |
|
270 |
|
echo "s#@PG_LIB@#${PG_LIB}#g" >> tmp.sed |
|
271 |
|
|
246 |
272 |
DB_SUPPORT=1 |
DB_SUPPORT=1 |
|
273 |
|
echo "s#@DB_SUPPORT@#${DB_SUPPORT}#g" >> tmp.sed |
|
274 |
|
fi |
|
275 |
|
echo "s#@PG_FOUND@#${PG_FOUND}#g" >> tmp.sed |
|
276 |
|
|
|
277 |
|
|
|
278 |
|
echo -n "Searching for epoll..." |
|
279 |
|
set +e |
|
280 |
|
echo -e "#include <sys/epoll.h> \n int main(void) { return epoll_create(64); }" | gcc -x c -pipe - -o /dev/null 2>/dev/null |
|
281 |
|
E="${?}" |
|
282 |
|
set -e |
|
283 |
|
if [ "${E}" != "0" ]; then |
|
284 |
|
echo " not found." |
|
285 |
|
echo "s#@EPOLL_FOUND@#0#g" >> tmp.sed |
|
286 |
|
else |
|
287 |
|
echo " found." |
|
288 |
|
echo "s#@EPOLL_FOUND@#1#g" >> tmp.sed |
247 |
289 |
fi |
fi |
248 |
290 |
|
|
249 |
291 |
# generic stuff |
# generic stuff |
250 |
292 |
echo "s#@PRJ@#${PRJ}#g" >> tmp.sed |
echo "s#@PRJ@#${PRJ}#g" >> tmp.sed |
251 |
293 |
echo "s#@VER@#${VER}#g" >> tmp.sed |
echo "s#@VER@#${VER}#g" >> tmp.sed |
252 |
294 |
echo "s#@REV@#${REV}#g" >> tmp.sed |
echo "s#@REV@#${REV}#g" >> tmp.sed |
|
295 |
|
echo "s#@DESCRIPTION@#${DESCRIPTION}#g" >> tmp.sed |
|
296 |
|
|
253 |
297 |
echo "s#@ETC@#${ETC}#g" >> tmp.sed |
echo "s#@ETC@#${ETC}#g" >> tmp.sed |
254 |
298 |
echo "s#@BIN@#${BIN}#g" >> tmp.sed |
echo "s#@BIN@#${BIN}#g" >> tmp.sed |
255 |
299 |
echo "s#@USR_BIN@#${USR_BIN}#g" >> tmp.sed |
echo "s#@USR_BIN@#${USR_BIN}#g" >> tmp.sed |
|
... |
... |
echo "s#@USR_INCLUDE@#${USR_INCLUDE}#g" >> tmp.sed |
260 |
304 |
echo "s#@USR_INC@#${USR_INCLUDE}#g" >> tmp.sed |
echo "s#@USR_INC@#${USR_INCLUDE}#g" >> tmp.sed |
261 |
305 |
echo "s#@USR_LIB@#${USR_LIB}#g" >> tmp.sed |
echo "s#@USR_LIB@#${USR_LIB}#g" >> tmp.sed |
262 |
306 |
echo "s#@USR_SHARE_DOC@#${USR_SHARE_DOC}#g" >> tmp.sed |
echo "s#@USR_SHARE_DOC@#${USR_SHARE_DOC}#g" >> tmp.sed |
263 |
|
# PG stuff |
|
264 |
|
echo "s#@PG_VERSION@#${PG_VERSION}#g" >> tmp.sed |
|
265 |
|
echo "s#@PG_FOUND@#${PG_FOUND}#g" >> tmp.sed |
|
266 |
|
echo "s#@PG_INC@#${PG_INC}#g" >> tmp.sed |
|
267 |
|
echo "s#@PG_LIB@#${PG_LIB}#g" >> tmp.sed |
|
268 |
|
# DB stuff |
|
269 |
|
echo "s#@DB_SUPPORT@#${DB_SUPPORT}#g" >> tmp.sed |
|
270 |
307 |
# Export stuff |
# Export stuff |
271 |
308 |
echo "s#@EXPORT_PATH@#${EXPORT_PATH}#g" >> tmp.sed |
echo "s#@EXPORT_PATH@#${EXPORT_PATH}#g" >> tmp.sed |
272 |
309 |
|
|
|
... |
... |
if [ -r Makefile.in ]; then |
314 |
351 |
echo >> Makefile |
echo >> Makefile |
315 |
352 |
echo ".PHONY: dist" >> Makefile |
echo ".PHONY: dist" >> Makefile |
316 |
353 |
echo "dist: clean" >> Makefile |
echo "dist: clean" >> Makefile |
317 |
|
echo " @./duilder tar \"\$(PRJ)\" \"\$(VER)\" \"${EXPORT_PATH}\" \"${EXCLUDE}\"" >> Makefile |
|
318 |
|
echo " @./duilder srpm \"\$(PRJ)\" \"\$(VER)\" \"${EXPORT_PATH}\" \"${BUILD_SRPM}\" \"${SRPM_DEST}\"" >> Makefile |
|
319 |
354 |
echo " @./duilder git \"\$(PRJ)\" \"${GIT_DEST}\" \"${EXPORT_GIT}\" \"${EXPORT_PATH}\" \"${GIT_CHANGELOG}\"" >> Makefile |
echo " @./duilder git \"\$(PRJ)\" \"${GIT_DEST}\" \"${EXPORT_GIT}\" \"${EXPORT_PATH}\" \"${GIT_CHANGELOG}\"" >> Makefile |
|
355 |
|
echo " @./duilder tar \"\$(PRJ)\" \"\$(VER)\" \"${EXPORT_PATH}\" \"${EXCLUDE}\"" >> Makefile |
|
356 |
|
echo " @./duilder srpm \"\$(PRJ)\" \"\$(VER)\" \"${EXPORT_PATH}\" \"${BUILD_SRPM}\" \"${SRPM_DEST}\" \"${SRPM_POST_RUN}\"" >> Makefile |
320 |
357 |
echo " @./duilder docs \"\$(PRJ)\" \"\$(VER)\" \"${EXPORT_PATH}\"" >> Makefile |
echo " @./duilder docs \"\$(PRJ)\" \"\$(VER)\" \"${EXPORT_PATH}\"" >> Makefile |
321 |
358 |
echo " @rm -f \"\$(PRJ)-\$(VER).tar.gz\"" >> Makefile |
echo " @rm -f \"\$(PRJ)-\$(VER).tar.gz\"" >> Makefile |
322 |
359 |
echo >> Makefile |
echo >> Makefile |