4 # This script can be used to for checking out and updating
5 # a program with anonymous r/o CVS access.
7 # by Konstantin Klyagin <konst@konst.org.ua>
9 # $Id: motorsync,v 1.19 2004/07/08 14:39:39 konst Exp $
12 CROOT
=":pserver:anonymous@cvs.thekonst.net:/home/konst/cvs/root"
15 MODULES
="kktoolbox/kkstrtext kktoolbox/kksystr kktoolbox/kkconsui parser"
20 CVS
="cvs -z9 -d $CROOT"
25 for i
in automake autoconf aclocal autoheader gettextize
; do
27 if test ! -f "$r"; then
28 echo "error: you must have $i installed to be able to use $0"
33 vcvs
=`cvs --version | grep System | gawk '{print $5}' | gawk -F . '{print $1 " " $2}'`
34 if test "$vcvs" = "1 10"; then
35 echo "CVS version 1.11 or later is needed in order to use $0"
40 for i
in automake aclocal
; do
41 r
=`which $i-$ver 2>&1`
43 if test -f "$r"; then eval $i=$i-$ver; fi
47 for i
in autoconf autoheader
; do
48 r
=`which $i-$ver 2>&1`
50 if test -f "$r"; then eval $i=$i-$ver; fi
55 if test ! -d ${DEST}; then
61 moduledir
=`echo $1 | sed 's@^..*/\(..*\)$@\1@g'`
69 for module
in $PROG $MODULES
71 if test $module != $PROG; then
72 getmoduledirname
$module
82 if test $1 = "checkout"; then
83 $CVS co
-d $codir $module
90 [ $RETVAL != 0 ] && return
94 find $DEST -name ".#*" -exec rm -f {} \
;
98 echo -n "Creating symbolic links for sources of libraries.. "
100 for module
in $MODULES
102 getmoduledirname
$module
103 dir
=$DEST/$moduledir/orig
105 if test -d $dir; then
108 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"`
110 srcfname
=`echo $fn | sed 's@^..*/\(orig/..*\)$@\1@'`
111 destdir
=`dirname $fn | sed 's@/orig@@'`
112 updirs
=`echo $srcfname | sed 's/ /_/g;s/\// /g' | wc -w`
113 updirs
=`expr $updirs - 2`
116 while test $i -lt $updirs; do
117 srcfname
="../"$srcfname
121 if test ! -d $destdir; then
125 if test ! -f $destdir/`basename $srcfname`; then
126 ln -sf $srcfname $destdir/
136 if test ! -z "$MAKEUPDATE"; then
137 for fn
in `find $DEST -name "Makefile.am"`
139 sed $MAKEUPDATE $fn >.makefile.am
147 for fn
in `find $DEST -name "configure.in"`
149 smask
="s/${moduledir}-[[:digit:].-][[:digit:].-]*/${moduledir}/g"
151 sed $smask $fn >.configure.
in
156 MSUBDIRS
=`cat $DEST/Makefile.am | egrep "^SUBDIRS" | sed 's/SUBDIRS[ =][ =]*//g'`
161 onlist
=`echo $MSUBDIRS | grep $moduledir`
162 if test -z "$onlist"; then
163 MSUBDIRS
="$moduledir $MSUBDIRS"
167 echo "SUBDIRS = $MSUBDIRS" >.makefile.am
168 egrep -v "^SUBDIRS" $DEST/Makefile.am
>>.makefile.am
169 mv .makefile.am
$DEST/Makefile.am
173 if test "$MONOLITE" != "0"
175 traverse
="${DEST}/configure.in"
177 traverse
=`find $DEST -name "configure.in" -print`
185 headneeded
=`grep AM_CONFIG_HEADER configure.in`
186 if test ! -z "$headneeded"; then $autoheader; fi
192 if test ! -f intl
/Makefile.
in; then
195 gettextize
-f --intl $p
196 if test ! -z "$p"; then p
=""; else break; fi
199 if test -f po
/Makevars.template
-a ! -f po
/Makevars
; then
200 mv po
/Makevars.template po
/Makevars
204 sed 's/^\s*SUBDIRS[ =]*m4[ =]*\(.*\)$/SUBDIRS = \1/g' <Makefile.am
>11
205 grep -v "ACLOCAL_AMFLAGS = -I m4" 11 >Makefile.am
207 sed 's@intl/Makefile@@;s@po/Makefile.in@@;s@m4/Makefile @@' <configure.
in >11
217 This is a script which can checkout and update $PROG from an
218 anonymous CVS repository.
221 $0 {update|checkout} <pathname>
227 CVS operations finished sucessfully.
229 To build the updated stuff go to the ${DEST} directory
230 and issue the following commands:
238 if test $# -lt 2; then
243 if test ! -d $2; then
244 echo "the location you specified does not exist: $2"
252 if test $1 = "checkout" -o $1 = "update"; then
259 if test $RETVAL != 0; then
260 echo "$0 aborted, exit code = $RETVAL"