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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
#!/bin/sh
#
# This script can be used to for checking out and updating
# a program with anonymous r/o CVS access.
#
# by Konstantin Klyagin <konst@konst.org.ua>
#
# $Id: cicqsync,v 1.41 2005/08/29 09:00:22 konst Exp $
#
CROOT=":pserver:anonymous@cvs.thekonst.net:/home/konst/cvs/root"
PROG="centericq"
MODULES="libyahoo2 libicq2000 kktoolbox/kkconsui kktoolbox/kksystr kktoolbox/kkstrtext firetalk libjabber connwrap libgadu libmsn"
MAKEUPDATE="s@/home/konst/devel/kktoolbox@\$(top_srcdir)@g;s@/home/konst/devel/libyahoo@\$(top_srcdir)/libyahoo@g;s@/home/konst/devel/libicq2000@\$(top_srcdir)/libicq2000@g;s@/home/konst/devel/firetalk@\$(top_srcdir)/firetalk@g;s@/home/konst/devel/libjabber@\$(top_srcdir)/libjabber@g;s@/home/konst/devel/connwrap@\$(top_srcdir)/connwrap@g;s@/home/konst/devel/libgadu@\$(top_srcdir)/libgadu@g;s@/home/konst/devel/libmsn@\$(top_srcdir)/libmsn@g"
MONOLITE="0"
RETVAL=0
CVS="cvs -z9 -d $CROOT"
moduledir=""
checkutils() {
for i in automake autoconf aclocal autoheader gettextize; do
r=`which $i 2>&1`
if test ! -f "$r"; then
echo "error: you must have $i installed to be able to use $0"
exit 1
fi
done
vcvs=`cvs --version | grep System | gawk '{print $5}' | gawk -F . '{print $1 " " $2}'`
if test "$vcvs" = "1 10"; then
echo "CVS version 1.11 or later is needed in order to use $0"
exit 1
fi
# ver=1.4
for i in automake aclocal; do
r=`which $i-$ver 2>&1`
eval $i=$i
if test -f "$r"; then eval $i=$i-$ver; fi
done
# ver=2.13
for i in autoconf autoheader; do
r=`which $i-$ver 2>&1`
eval $i=$i
if test -f "$r"; then eval $i=$i-$ver; fi
done
}
preparedirs() {
if test ! -d ${DEST}; then
mkdir -p ${DEST};
fi
}
getmoduledirname() {
moduledir=`echo $1 | sed 's@^..*/\(..*\)$@\1@g'`
}
progsync() {
preparedirs
codir=$PROG
dir=$prefix
for module in $PROG $MODULES
do
if test $module != $PROG; then
getmoduledirname $module
dir=$DEST/$moduledir
codir="orig"
fi
mkdir -p $dir
if test -d $dir; then
cd $dir
if test $1 = "checkout"; then
$CVS co -d $codir $module
else
cd $codir
$CVS update -C -P -d
fi
RETVAL=$?
[ $RETVAL != 0 ] && return
fi
done
find $DEST -name ".#*" -exec rm -f {} \;
}
makelinks() {
echo -n "Creating symbolic links for sources of libraries.. "
for module in $MODULES
do
getmoduledirname $module
dir=$DEST/$moduledir/orig
if test -d $dir; then
cd $dir
for fn in `find $dir -name "*.h" -o -name "*.cc" -o -name "*.c" -o -name "*.cpp" -o -name "*.C" -o -name "Makefile.am" -o -name "*.in"`
do
srcfname=`echo $fn | sed 's@^..*/\(orig/..*\)$@\1@'`
destdir=`dirname $fn | sed 's@/orig@@'`
updirs=`echo $srcfname | sed 's/ /_/g;s/\// /g' | wc -w`
updirs=`expr $updirs - 2`
i=0
while test $i -lt $updirs; do
srcfname="../"$srcfname
i=`expr $i + 1`
done
if test ! -d $destdir; then
mkdir -p $destdir
fi
if test ! -f $destdir/`basename $srcfname`; then
ln -sf $srcfname $destdir/
fi
done
fi
done
echo "ok"
}
updatemakepaths() {
if test ! -z "$MAKEUPDATE"; then
for fn in `find $DEST -name "Makefile.am"`
do
sed $MAKEUPDATE $fn >.makefile.am
mv .makefile.am $fn
done
fi
for m in $MODULES
do
getmoduledirname $m
for fn in `find $DEST -name "configure.in"`
do
smask="s/${moduledir}-[[:digit:].-][[:digit:].-]*/${moduledir}/g"
sed $smask $fn >.configure.in
mv .configure.in $fn
done
done
MSUBDIRS=`cat $DEST/Makefile.am | egrep "^SUBDIRS" | sed 's/SUBDIRS[ =][ =]*//g'`
for m in $MODULES
do
getmoduledirname $m
onlist=`echo $MSUBDIRS | grep $moduledir`
if test -z "$onlist"; then
MSUBDIRS="$moduledir $MSUBDIRS"
fi
done
echo "SUBDIRS = $MSUBDIRS" >.makefile.am
egrep -v "^SUBDIRS" $DEST/Makefile.am >>.makefile.am
mv .makefile.am $DEST/Makefile.am
}
runautomake() {
if test "$MONOLITE" != "0"
then
traverse="${DEST}/configure.in"
else
traverse=`find $DEST -name "configure.in" -print`
fi
for i in $traverse
do
cd `dirname $i`
$aclocal
headneeded=`grep AM_CONFIG_HEADER configure.in`
if test ! -z "$headneeded"; then $autoheader; fi
$autoconf
$automake -a -c
done
cd $DEST
if test ! -f intl/Makefile.in; then
p="--no-changelog"
while true; do
gettextize -f --intl $p
if test ! -z "$p"; then p=""; else break; fi
done
if test -f po/Makevars.template -a ! -f po/Makevars; then
mv po/Makevars.template po/Makevars
fi
if test -d m4; then
sed 's/^\s*SUBDIRS[ =]*m4[ =]*\(.*\)$/SUBDIRS = \1/g' <Makefile.am >11
grep -v "ACLOCAL_AMFLAGS = -I m4" 11 >Makefile.am
rm -rf m4 11
sed 's@intl/Makefile@@;s@po/Makefile.in@@;s@m4/Makefile @@' <configure.in >11
mv 11 configure.in
fi
aclocal
fi
}
usage() {
echo "
This is a script which can checkout and update $PROG from an
anonymous CVS repository.
script usage:
$0 {update|checkout} <pathname>
"
}
finishmsg() {
echo "
CVS operations finished sucessfully.
To build the updated stuff go to the ${DEST} directory
and issue the following commands:
./configure
make
make install
"
}
if test $# -lt 2; then
usage
else
checkutils
if test ! -d $2; then
echo "the location you specified does not exist: $2"
exit
else
cd $2
prefix=`pwd`
DEST=${prefix}/$PROG
fi
if test $1 = "checkout" -o $1 = "update"; then
progsync $1
else
usage
exit
fi
if test $RETVAL != 0; then
echo "$0 aborted, exit code = $RETVAL"
else
updatemakepaths
makelinks
runautomake
finishmsg
fi
fi
exit $RETVAL
|