~ubuntu-branches/ubuntu/edgy/bookmarkbridge/edgy

« back to all changes in this revision

Viewing changes to admin/cvs.sh

  • Committer: Bazaar Package Importer
  • Author(s): Masami Ichikawa
  • Date: 2006-06-06 21:09:51 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20060606210951-xxz38ne6oe01tgnt
Tags: upstream-0.76
ImportĀ upstreamĀ versionĀ 0.76

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
#
3
 
# cvs.sh
4
 
#
5
 
# This file contains support code from Makefile.common
6
 
# It defines a shell function for each known target
7
 
# and then does a case to call the correct function.
8
 
 
9
 
call_and_fix_autoconf()
10
 
{
11
 
  $AUTOCONF || exit 1
12
 
  if test -r configure.in.in ; then
13
 
    perl -pi -e "print \"if test \\\"x\\\$with_fast_perl\\\" = \\\"xyes\\\"; then\
14
 
    \\n  perl -i.bak \\\$ac_aux_dir/conf.change.pl \\\$CONFIG_STATUS\
15
 
    \\\\\\n    || mv \\\$CONFIG_STATUS.bak \\\$CONFIG_STATUS\
16
 
    \\n  rm -f \\\$CONFIG_STATUS.bak\\nfi\
17
 
    \\n\" if /^\\s*chmod\\s+.*\\+x\\s+.*CONFIG_STATUS/;" configure
18
 
  fi
19
 
}
20
 
 
21
 
strip_makefile()
22
 
{
23
 
  if test -f $makefile_wo; then :; else
24
 
    perl -e '$in=0; while ( <> ) { $in = 1 if ($_=~ m/^if /); print $_ unless ($in); $in = 0 if ($_ =~ m/^endif/); }' < Makefile.am.in > $makefile_wo
25
 
  fi
26
 
}
27
 
 
28
 
check_autotool_versions()
29
 
{
30
 
AUTOCONF_VERSION=`$AUTOCONF --version | head -1`
31
 
case $AUTOCONF_VERSION in
32
 
  Autoconf*2.5* | autoconf*2.5* ) : ;;
33
 
  "" )
34
 
    echo "*** AUTOCONF NOT FOUND!."
35
 
    echo "*** KDE requires autoconf 2.52 or 2.53"
36
 
    exit 1
37
 
    ;;
38
 
  * )
39
 
    echo "*** YOU'RE USING $AUTOCONF_VERSION."
40
 
    echo "*** KDE requires autoconf 2.52 or 2.53"
41
 
    exit 1
42
 
    ;;
43
 
esac
44
 
 
45
 
AUTOHEADER_VERSION=`$AUTOHEADER --version | head -1`
46
 
case $AUTOHEADER_VERSION in
47
 
  Autoconf*2.5* | autoheader*2.5* ) : ;;
48
 
  "" )
49
 
    echo "*** AUTOHEADER NOT FOUND!."
50
 
    echo "*** KDE requires autoheader 2.52 or 2.53 (part of autoconf)"
51
 
    exit 1
52
 
    ;;
53
 
  * )
54
 
    echo "*** YOU'RE USING $AUTOHEADER_VERSION."
55
 
    echo "*** KDE requires autoheader 2.52 or 2.53 (part of autoconf)"
56
 
    exit 1
57
 
    ;;
58
 
esac
59
 
 
60
 
AUTOMAKE_STRING=`$AUTOMAKE --version | head -1`
61
 
case $AUTOMAKE_STRING in
62
 
  automake*1.5d* )
63
 
    echo "*** YOU'RE USING $AUTOMAKE_STRING."
64
 
    echo "*** KDE requires automake 1.5"
65
 
    exit 1
66
 
    ;;
67
 
  automake*1.5* | automake*1.5-* | automake*1.6.* | automake*1.7.* ) : ;;
68
 
  "" )
69
 
    echo "*** AUTOMAKE NOT FOUND!."
70
 
    echo "*** KDE requires automake 1.5"
71
 
    exit 1
72
 
    ;;
73
 
  unsermake* ) :
74
 
    echo "*** YOU'RE USING UNSERMAKE."
75
 
    echo "*** GOOD LUCK!! :)"
76
 
    ;;
77
 
  * )
78
 
    echo "*** YOU'RE USING $AUTOMAKE_STRING."
79
 
    echo "*** KDE requires automake 1.5"
80
 
    exit 1
81
 
    ;;
82
 
esac
83
 
}
84
 
 
85
 
cvs()
86
 
{
87
 
check_autotool_versions
88
 
 
89
 
### Produce acinclude.m4
90
 
if grep '\$(top_srcdir)/acinclude.m4:' $makefile_am >/dev/null; then
91
 
  echo "*** Creating acinclude.m4"
92
 
  rm -f acinclude.m4 configure.files
93
 
  
94
 
  strip_makefile
95
 
  $MAKE -f $makefile_wo top_srcdir=. ./acinclude.m4
96
 
fi
97
 
 
98
 
### Make new subdirs and configure.in.
99
 
### The make calls could be optimized away here,
100
 
### with a little thought.
101
 
if test -r configure.in.in; then
102
 
  rm -f subdirs configure.in
103
 
  echo "*** Creating list of subdirectories"
104
 
  subdirs
105
 
  echo "*** Creating configure.in"
106
 
  configure_files
107
 
  strip_makefile
108
 
  $MAKE -f $makefile_wo top_srcdir=. ./configure.in || exit 1
109
 
fi
110
 
 
111
 
echo "*** Creating aclocal.m4"
112
 
$ACLOCAL || exit 1
113
 
echo "*** Creating configure"
114
 
call_and_fix_autoconf
115
 
 
116
 
if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then
117
 
  echo "*** Creating config.h template"
118
 
  $AUTOHEADER || exit 1
119
 
fi
120
 
 
121
 
echo "*** Creating Makefile templates"
122
 
$AUTOMAKE || exit 1
123
 
if test -z "$UNSERMAKE"; then
124
 
  echo "*** Postprocessing Makefile templates"
125
 
  perl admin/am_edit || exit 1
126
 
fi
127
 
 
128
 
if egrep "^cvs-local:" $makefile_am >/dev/null; then \
129
 
  strip_makefile
130
 
  $MAKE -f $makefile_wo cvs-local || exit 1
131
 
fi
132
 
 
133
 
echo "*** Creating date/time stamp"
134
 
touch stamp-h.in
135
 
 
136
 
echo "*** Finished"
137
 
echo "    Don't forget to run ./configure"
138
 
echo "    If you haven't done so in a while, run ./configure --help"
139
 
}
140
 
 
141
 
dist()
142
 
{
143
 
check_autotool_versions
144
 
 
145
 
###
146
 
### First build all of the files necessary to do just "make"
147
 
###
148
 
if grep '\$(top_srcdir)/acinclude.m4:' $makefile_am >/dev/null; then
149
 
  strip_makefile
150
 
  $MAKE -f $makefile_wo top_srcdir=. ./acinclude.m4
151
 
fi
152
 
if test -r configure.in.in; then
153
 
  subdirs
154
 
  configure_files
155
 
  strip_makefile
156
 
  $MAKE -f $makefile_wo top_srcdir=. ./configure.in
157
 
fi
158
 
$ACLOCAL
159
 
$AUTOHEADER
160
 
$AUTOMAKE --foreign --include-deps
161
 
perl admin/am_edit
162
 
call_and_fix_autoconf
163
 
touch stamp-h.in
164
 
if grep "^cvs-local:" $makefile_am >/dev/null; then
165
 
  strip_makefile
166
 
  $MAKE -f $makefile_wo cvs-local
167
 
fi
168
 
 
169
 
###
170
 
### Then make messages
171
 
###
172
 
if test -d po; then
173
 
 LIST=`find ./po -name "*.po"`
174
 
 for i in $LIST; do
175
 
  file2=`echo $i | sed -e "s#\.po#\.gmo#"`
176
 
  msgfmt -o $file2 $i || touch $file2
177
 
 done
178
 
fi
179
 
if grep "^cvs-dist-local:" $makefile_am >/dev/null; then
180
 
  strip_makefile
181
 
  $MAKE -f $makefile_wo cvs-dist-local
182
 
fi
183
 
}
184
 
 
185
 
subdir_dist()
186
 
{
187
 
$ACLOCAL
188
 
$AUTOHEADER
189
 
$AUTOMAKE --foreign --include-deps
190
 
perl ../admin/am_edit
191
 
call_and_fix_autoconf
192
 
}
193
 
 
194
 
configure_in()
195
 
{
196
 
rm -f configure.in configure.in.new
197
 
kde_use_qt_param=
198
 
test -f configure.files || { echo "need configure.files for configure.in"; exit 1; }
199
 
cat `egrep -v "configure.in.bot" < configure.files` > configure.in.new
200
 
echo "KDE_CREATE_SUBDIRSLIST" >> configure.in.new
201
 
if test -f Makefile.am.in; then
202
 
  subdirs=`cat subdirs`
203
 
  for dir in $subdirs; do
204
 
    dir=`echo $dir | sed -e "s,[-+],_,g"`
205
 
    echo "AM_CONDITIONAL($dir""_SUBDIR_included, test \"x\$$dir""_SUBDIR_included\" = xyes)" >> configure.in.new
206
 
  done
207
 
fi
208
 
# echo "AC_OUTPUT( \\" >> configure.in.new
209
 
mfs=`find . -type d -print | fgrep -v "/." | \
210
 
     sed -e "s#\./##" -e "/^debian/d" | sort`
211
 
for i in $mfs; do
212
 
  topleveldir=`echo $i| sed -e "s#/.*##"`
213
 
  if test -f $topleveldir/configure.in; then
214
 
        continue
215
 
  fi
216
 
  if test -f $i/Makefile.am; then :; else
217
 
        continue
218
 
  fi
219
 
  if test -s inst-apps; then
220
 
    if grep "\"^$topleveldir\"" inst-apps > /dev/null 2>&1; then
221
 
        continue
222
 
    fi
223
 
  fi
224
 
  if test "$i" = "."; then
225
 
     echo "AC_CONFIG_FILES([ Makefile ])" >> configure.in.new
226
 
  else
227
 
     echo "AC_CONFIG_FILES([ $i/Makefile ])" >> configure.in.new
228
 
  fi
229
 
  if test -n "$UNSERMAKE"; then
230
 
      if test "$i" = "."; then
231
 
        echo "AC_CONFIG_FILES([ Makefile.rules ])" >> configure.in.new
232
 
      else
233
 
        echo "AC_CONFIG_FILES([ $i/Makefile.rules ])" >> configure.in.new
234
 
      fi
235
 
  fi
236
 
done
237
 
egrep '^dnl AC_OUTPUT\(.*\)' `cat configure.files` | sed -e "s#^.*dnl AC_OUTPUT(\(.*\))#AC_CONFIG_FILES([ \1 ])#" >> configure.in.new
238
 
if test -n "$UNSERMAKE"; then
239
 
  echo "AC_CONFIG_FILES([ MakeVars ])" >> configure.in.new
240
 
fi
241
 
echo "AC_OUTPUT" >> configure.in.new
242
 
modulename=
243
 
if test -f configure.in.in; then
244
 
   if head -2 configure.in.in | egrep "^#MIN_CONFIG\(.*\)$" > /dev/null; then
245
 
      kde_use_qt_param=`cat configure.in.in | sed -n -e "s/#MIN_CONFIG(\(.*\))/\1/p"`
246
 
   fi
247
 
   if head -2 configure.in.in | egrep "^#MIN_CONFIG" > /dev/null; then
248
 
      line=`grep "^AM_INIT_AUTOMAKE(" configure.in.in`
249
 
      if test -n "$line"; then
250
 
          modulename=`echo $line | sed -e "s#AM_INIT_AUTOMAKE(\([^,]*\),.*#\1#"`
251
 
          VERSION=`echo $line | sed -e "s#AM_INIT_AUTOMAKE([^,]*, *\([^)]*\)).*#\1#"`
252
 
      fi
253
 
      sed -e "s#AM_INIT_AUTOMAKE([^@].*#dnl PACKAGE set before#" \
254
 
          configure.in.new > configure.in && mv configure.in configure.in.new
255
 
   fi
256
 
fi
257
 
if test -z "$VERSION" || test "$VERSION" = "@VERSION@"; then
258
 
     VERSION="\"3.0.7\""
259
 
fi
260
 
if test -z "$modulename" || test "$modulename" = "@MODULENAME@"; then
261
 
   modulename=`pwd`; 
262
 
   modulename=`basename $modulename`
263
 
   esc_VERSION=`echo $VERSION | sed -e "s#[^.0-9a-zA-Z]##g"`
264
 
   modulename=`echo $modulename | sed -e "s#-$esc_VERSION##"`   
265
 
 
266
 
fi
267
 
if test -n "$kde_use_qt_param"; then
268
 
      sed -e "s#^dnl KDE_USE_QT#KDE_USE_QT($kde_use_qt_param)#" \
269
 
        configure.in.new > configure.in && mv configure.in configure.in.new
270
 
fi
271
 
sed -e "s#@MODULENAME@#$modulename#" configure.in.new |
272
 
        sed -e "s#@VERSION@#$VERSION#" > configure.in
273
 
botfiles=`cat configure.files | egrep "configure.in.bot"`
274
 
test -n "$botfiles" && cat $botfiles >> configure.in
275
 
rm -f configure.in.new
276
 
}
277
 
 
278
 
configure_files()
279
 
{
280
 
admindir=NO
281
 
for i in . .. ../.. ../../..; do
282
 
  if test -x $i/admin; then admindir=$i/admin; break; fi
283
 
done
284
 
rm -f configure.files
285
 
touch configure.files
286
 
if test -f configure.in.in && head -2 configure.in.in | grep "^#MIN_CONFIG" > /dev/null; then
287
 
        echo $admindir/configure.in.min >> configure.files
288
 
fi
289
 
test -f configure.in.in && echo configure.in.in >> configure.files
290
 
list=`find . -name "configure.in.in" -o -name "configure.in.bot" | sort`
291
 
for i in $list; do if test -f $i && test `dirname $i` != "." ; then
292
 
  echo $i >> configure.files
293
 
fi; done
294
 
test -f configure.in.mid && echo configure.in.mid >> configure.files
295
 
test -f configure.in.bot && echo configure.in.bot >> configure.files
296
 
}
297
 
 
298
 
subdirs()
299
 
{
300
 
dirs=
301
 
compilefirst=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' $makefile_am | head -1`
302
 
compilelast=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' $makefile_am | head -1`
303
 
for i in `ls -1`; do
304
 
    if test -f $i/Makefile.am; then
305
 
       case " $compilefirst $compilelast " in
306
 
         *" $i "*) ;;
307
 
         *) dirs="$dirs $i"
308
 
       esac
309
 
    fi
310
 
done
311
 
 
312
 
: > ./_SUBDIRS
313
 
 
314
 
for d in $compilefirst; do
315
 
   echo $d >> ./_SUBDIRS
316
 
done
317
 
 
318
 
(for d in $dirs; do 
319
 
   list=`sed -ne "s#^COMPILE_BEFORE_$d""[ ]*=[ ]*##p" $makefile_am | head -1`
320
 
   for s in $list; do
321
 
      echo $s $d
322
 
   done
323
 
   list=`sed -ne "s#^COMPILE_AFTER_$d""[ ]*=[ ]*##p" $makefile_am | head -1`
324
 
   for s in $list; do
325
 
      echo $d $s
326
 
   done
327
 
   echo $d $d
328
 
done ) | tsort >> ./_SUBDIRS
329
 
 
330
 
for d in $compilelast; do
331
 
   echo $d >> ./_SUBDIRS
332
 
done
333
 
 
334
 
if test -f Makefile.am.in; then
335
 
  cp Makefile.am.in Makefile.am
336
 
  if test -n "$UNSERMAKE"; then
337
 
    topsubdirs=
338
 
    for i in $compilefirst $dirs $compilelast; do
339
 
       vari=`echo $i | sed -e "s,[-+],_,g"`
340
 
       echo "if $vari""_SUBDIR_included" >> Makefile.am
341
 
       echo "$vari""_SUBDIR=$i" >> Makefile.am
342
 
       echo "endif" >> Makefile.am
343
 
       topsubdirs="$topsubdirs \$($vari""_SUBDIR)"
344
 
    done
345
 
    echo "SUBDIRS=$topsubdirs" >> Makefile.am
346
 
  else
347
 
    echo "SUBDIRS="'$(TOPSUBDIRS)' >> Makefile.am
348
 
  fi
349
 
fi
350
 
if test -r subdirs && diff subdirs _SUBDIRS > /dev/null; then
351
 
  rm -f _SUBDIRS
352
 
fi
353
 
test -r _SUBDIRS && mv _SUBDIRS subdirs || true
354
 
}
355
 
 
356
 
cvs_clean()
357
 
{
358
 
if test -d CVS; then :; else
359
 
  echo "You don't have a toplevel CVS directory."
360
 
  echo "You most certainly didn't use cvs to get these sources."
361
 
  echo "But this function depends on cvs's information."
362
 
  exit 1
363
 
fi
364
 
perl $admindir/cvs-clean.pl
365
 
}
366
 
 
367
 
package_merge()
368
 
{
369
 
catalogs=$POFILES
370
 
for cat in $catalogs; do
371
 
  msgmerge -o $cat.new $cat $PACKAGE.pot
372
 
  if test -s $cat.new; then
373
 
    grep -v "\"POT-Creation" $cat.new > $cat.new.2
374
 
    grep -v "\"POT-Creation" $cat >> $cat.new.1
375
 
    if diff $cat.new.1 $cat.new.2; then
376
 
        rm $cat.new
377
 
    else
378
 
        mv $cat.new $cat
379
 
    fi
380
 
    rm -f $cat.new.1 $cat.new.2
381
 
  fi
382
 
done
383
 
}
384
 
 
385
 
package_messages()
386
 
{
387
 
rm -rf po.backup
388
 
mkdir po.backup
389
 
 
390
 
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
391
 
  egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > po.backup/$i
392
 
  cp po/$i po.backup/backup_$i
393
 
  touch -r po/$i po.backup/backup_$i
394
 
  rm po/$i
395
 
done
396
 
 
397
 
podir=${podir:-$PWD/po}
398
 
files=`find . -name Makefile.am | xargs egrep -l '^messages:' `
399
 
dirs=`for i in $files; do echo \`dirname $i\`; done`
400
 
tmpname="$PWD/messages.log"
401
 
if test -z "$EXTRACTRC"; then EXTRACTRC=extractrc ; fi
402
 
if test -z "$PREPARETIPS"; then PREPARETIPS=preparetips ; fi
403
 
export EXTRACTRC PREPARETIPS
404
 
 
405
 
for subdir in $dirs; do
406
 
  test -z "$VERBOSE" || echo "Making messages in $subdir"
407
 
  (cd $subdir
408
 
   if test -n "`grep -e '^messages:.*rc.cpp' Makefile.am`"; then
409
 
        $EXTRACTRC *.rc *.ui > rc.cpp
410
 
   else
411
 
        candidates=`ls -1 *.rc *.ui 2>/dev/null`
412
 
        if test -n "$candidates"; then
413
 
            echo "$subdir has *.rc or *.ui files, but not correct messages line"
414
 
        fi
415
 
   fi
416
 
   if test -n "`grep -r KAboutData *.c* *.C* 2>/dev/null`"; then
417
 
        echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp
418
 
   else echo " " > _translatorinfo.cpp
419
 
   fi
420
 
   perl -e '$mes=0; while (<STDIN>) { next if (/^(if|else|endif)\s/); if (/^messages:/) { $mes=1; print $_; next; } if ($mes) { if (/$\\(XGETTEXT\)/ && / -o/) { s/ -o \$\(podir\)/ _translatorinfo.cpp -o \$\(podir\)/ } print $_; } else { print $_; } }' < Makefile.am > _transMakefile
421
 
 
422
 
   $MAKE -s -f _transMakefile podir=$podir EXTRACTRC="$EXTRACTRC" PREPARETIPS="$PREPARETIPS" \
423
 
        XGETTEXT="${XGETTEXT:-xgettext} -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x ${includedir:-$KDEDIR/include}/kde.pot" \
424
 
        messages 
425
 
   ) 2>&1 | grep -v '^make\[1\]' > $tmpname
426
 
   test -s $tmpname && { echo $subdir ; cat "$tmpname"; }
427
 
   test -f $subdir/rc.cpp && rm -f $subdir/rc.cpp
428
 
   rm -f $subdir/_translatorinfo.cpp
429
 
   rm -f $subdir/_transMakefile
430
 
done
431
 
rm -f $tmpname
432
 
for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do
433
 
  test -f po/$i || echo "disappeared: $i"
434
 
done
435
 
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
436
 
   msgmerge -q -o po/$i po/$i po/$i
437
 
   egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > temp.pot
438
 
  if test -f po.backup/$i && test -n "`diff temp.pot po.backup/$i`"; then
439
 
        echo "will update $i"
440
 
        msgmerge -q po.backup/backup_$i po/$i > temp.pot
441
 
        mv temp.pot po/$i
442
 
  else
443
 
    if test -f po.backup/backup_$i; then
444
 
      test -z "$VERBOSE" || echo "I'm restoring $i"
445
 
      mv po.backup/backup_$i po/$i
446
 
      rm po.backup/$i
447
 
    else
448
 
      echo "will add $i"
449
 
    fi
450
 
  fi
451
 
done
452
 
rm -f temp.pot
453
 
rm -rf po.backup
454
 
}
455
 
 
456
 
admindir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
457
 
test "x$admindir" = "x$0" && admindir=.
458
 
 
459
 
test "x$MAKE" = x && MAKE=make
460
 
makefile_am=Makefile.am
461
 
makefile_wo=Makefile.am
462
 
if test -f Makefile.am.in; then
463
 
  makefile_am=Makefile.am.in
464
 
  makefile_wo=Makefile.am.in.wo
465
 
fi
466
 
 
467
 
# Suck in the AUTOCONF detection code
468
 
. $admindir/detect-autoconf.sh
469
 
 
470
 
###
471
 
### Main
472
 
###
473
 
 
474
 
arg=`echo $1 | tr '\-.' __`
475
 
case $arg in
476
 
  cvs | dist | subdir_dist | configure_in | configure_files | subdirs | \
477
 
  cvs_clean | package_merge | package_messages ) $arg ;;
478
 
  * ) echo "Usage: cvs.sh <target>"
479
 
      echo "Target can be one of:"
480
 
      echo "    cvs cvs-clean dist"
481
 
      echo "    configure.in configure.files"
482
 
      echo "    package-merge package-messages"
483
 
      echo ""
484
 
      echo "Usage: anything but $1"
485
 
      exit 1 ;;
486
 
esac
487
 
 
488
 
if test -f Makefile.am.in.wo; then
489
 
  rm Makefile.am.in.wo
490
 
fi
491
 
 
492
 
exit 0