1 |
#!/bin/sh |
2 |
|
3 |
# Build script |
4 |
# builds new-style dists from cvs source, and puts them |
5 |
# in a single location for download (eg. snapshots) |
6 |
# |
7 |
# $Id: build.sh,v 1.5 2003/03/28 20:06:53 tdb Exp $ |
8 |
|
9 |
# base directory for staging |
10 |
STAGING=/u1/i-scream/staging |
11 |
|
12 |
# log everything :-) |
13 |
LOG=$STAGING/build.log |
14 |
exec > $LOG 2>&1 |
15 |
set -x |
16 |
|
17 |
# various directories |
18 |
CMSSOURCE=$STAGING/cms/source |
19 |
BUILDS=$STAGING/builds |
20 |
DISTFILES=$STAGING/distfiles |
21 |
CVSROOT=/u1/i-scream/cvsmirror |
22 |
WEBSNAPSHOTS=/u1/i-scream/httpd/htdocs/snapshots |
23 |
LIBURL=http://www.i-scream.org.uk/downloads/lib |
24 |
|
25 |
# standard process for an i-scream style build |
26 |
iscreambuild() { |
27 |
SOURCEDIR=$1 |
28 |
DESTDIR=$2 |
29 |
BIN=$3 |
30 |
cd $SOURCEDIR |
31 |
if [ "X$TAG" != "X" ]; then |
32 |
cvs -d $CVSROOT update -dPr $TAG |
33 |
cvs2cl --stdout --no-wrap -r -t -w -S -g "-d $CVSROOT" -g "-q" -l "-r::$TAG" > build/ChangeLog |
34 |
fi |
35 |
LIBRARIES= |
36 |
eval `grep "LIBRARIES=" configure` |
37 |
for LIB in $LIBRARIES; do |
38 |
fetchlib $LIB |
39 |
cp $DISTFILES/$LIB build/lib |
40 |
done |
41 |
./configure |
42 |
if [ "X$BIN" = "Xyes" ]; then |
43 |
gnumake dist-bin dest=$DESTDIR CVSROOT=$CVSROOT |
44 |
gnumake clean |
45 |
fi |
46 |
gnumake dist dest=$DESTDIR CVSROOT=$CVSROOT |
47 |
} |
48 |
|
49 |
# standard process for a gnu autoconf/automake/libtool style build |
50 |
gnubuild() { |
51 |
SOURCEDIR=$1 |
52 |
DESTDIR=$2 |
53 |
LIBTOOL=$3 |
54 |
cd $SOURCEDIR |
55 |
if [ "X$TAG" != "X" ]; then |
56 |
cvs -d $CVSROOT update -dPr $TAG |
57 |
cvs2cl --stdout --no-wrap -r -t -w -S -g "-d $CVSROOT" -g "-q" -l "-r::$TAG" > ChangeLog |
58 |
fi |
59 |
aclocal |
60 |
autoheader |
61 |
autoconf |
62 |
if [ "X$LIBTOOL" = "Xyes" ]; then |
63 |
libtoolize -c |
64 |
fi |
65 |
automake -a -c |
66 |
./configure |
67 |
gnumake dist |
68 |
TARBALL=`ls *.tar.gz` |
69 |
mkdir -p $DESTDIR |
70 |
cp $TARBALL $DESTDIR |
71 |
gpg -abs --default-key=0x135D6B0A $DESTDIR/$TARBALL |
72 |
} |
73 |
|
74 |
# grab a required library off the web to maintain a local copy |
75 |
fetchlib() { |
76 |
LIB=$1 |
77 |
if [ ! -f $DISTFILES/$LIB ]; then |
78 |
wget -P $DISTFILES $LIBURL/$LIB |
79 |
fi |
80 |
if [ ! -f $DISTFILES/$LIB ]; then |
81 |
echo Required library $LIB does not exist at $LIBURL |
82 |
exit 1 |
83 |
fi |
84 |
} |
85 |
|
86 |
# Full set of programs to be built |
87 |
PROGS="server util corbaservices conient dbreporter rrdgraphing php winhost libstatgrab ihost" |
88 |
|
89 |
# Read command line args |
90 |
if [ "X$1" != "X" ]; then |
91 |
PROGS=$1 |
92 |
fi |
93 |
if [ "X$2" != "X" ]; then |
94 |
TAG=$2 |
95 |
fi |
96 |
|
97 |
echo "+ Build started on `date`" |
98 |
|
99 |
# remove any old files so we have a fresh start |
100 |
echo "+ Cleaning up" |
101 |
rm -Rf cms |
102 |
rm -Rf $BUILDS/* |
103 |
|
104 |
# pull the latest source from our local cvs |
105 |
echo "+ Updating CVS" |
106 |
cvs -d $CVSROOT checkout cms/source |
107 |
cd $CMSSOURCE |
108 |
|
109 |
# Build all listed programs |
110 |
for PROG in $PROGS; do |
111 |
case $PROG in |
112 |
server) |
113 |
iscreambuild $CMSSOURCE/server $BUILDS/server yes |
114 |
;; |
115 |
util) |
116 |
iscreambuild $CMSSOURCE/util $BUILDS/util yes |
117 |
;; |
118 |
corbaservices) |
119 |
iscreambuild $CMSSOURCE/corbaservices $BUILDS/corbaservices yes |
120 |
;; |
121 |
conient) |
122 |
iscreambuild $CMSSOURCE/conient $BUILDS/conient yes |
123 |
;; |
124 |
rrdgraphing) |
125 |
iscreambuild $CMSSOURCE/reports/rrdgraphing $BUILDS/rrdgraphing no |
126 |
;; |
127 |
php) |
128 |
iscreambuild $CMSSOURCE/reports/php $BUILDS/php no |
129 |
;; |
130 |
libstatgrab) |
131 |
gnubuild $CMSSOURCE/libstatgrab $BUILDS/libstatgrab yes |
132 |
;; |
133 |
ihost) |
134 |
gnubuild $CMSSOURCE/ihost $BUILDS/ihost no |
135 |
;; |
136 |
libukcprog) |
137 |
gnubuild $CMSSOURCE/libukcprog $BUILDS/libukcprog yes |
138 |
;; |
139 |
esac |
140 |
done |
141 |
|
142 |
# sync builds to the web tree |
143 |
echo "+ Copying to snapshots web tree" |
144 |
rsync -rlpogtxHv $BUILDS/. $WEBSNAPSHOTS |
145 |
|
146 |
echo "+ Done" |
147 |
|
148 |
echo "+ Build completed on `date`" |