~ubuntu-branches/ubuntu/intrepid/gwenview/intrepid

« back to all changes in this revision

Viewing changes to admin/cvs.sh

  • Committer: Bazaar Package Importer
  • Author(s): Christopher Martin
  • Date: 2005-04-06 11:33:06 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050406113306-7zovl7z0io5bacpd
Tags: 1.2.0-1
* New upstream release.
  + Fixes crashes when using "Back" to navigate. (Closes: #301811)
* Enable KIPI support.
* Add a doc-base file for the handbook.

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
unset MAKEFLAGS
 
10
 
 
11
call_and_fix_autoconf()
 
12
{
 
13
  $AUTOCONF || exit 1
 
14
  if test -r configure.in.in ; then
 
15
    perl -pi -e "print \"if test \\\"x\\\$with_fast_perl\\\" = \\\"xyes\\\"; then\
 
16
    \\n  perl -i.bak \\\$ac_aux_dir/conf.change.pl \\\$CONFIG_STATUS\
 
17
    \\\\\\n    || mv \\\$CONFIG_STATUS.bak \\\$CONFIG_STATUS\
 
18
    \\n  rm -f \\\$CONFIG_STATUS.bak\\nfi\
 
19
    \\n\" if /^\\s*chmod\\s+.*\\+x\\s+.*CONFIG_STATUS/; s,^#line.*LINENO.*\$,/* \$& */, ;" configure
 
20
  fi
 
21
}
 
22
 
 
23
strip_makefile()
 
24
{
 
25
  if test ! -f $makefile_wo; then
 
26
    perl -e '$in=0; while ( <> ) { $in = 1 if ($_ =~ m/^if / ); print $_ unless ($in || $_ =~ m/^include /); $in = 0 if ($_ =~ m/^endif/); }' < $makefile_am > $makefile_wo
 
27
  fi
 
28
}
 
29
 
 
30
check_autotool_versions()
 
31
{
 
32
required_autoconf_version="2.53 or newer"
 
33
AUTOCONF_VERSION=`$AUTOCONF --version | head -n 1`
 
34
case $AUTOCONF_VERSION in
 
35
  Autoconf*2.5* | autoconf*2.5* ) : ;;
 
36
  "" )
 
37
    echo "*** AUTOCONF NOT FOUND!."
 
38
    echo "*** KDE requires autoconf $required_autoconf_version"
 
39
    exit 1
 
40
    ;;
 
41
  * )
 
42
    echo "*** YOU'RE USING $AUTOCONF_VERSION."
 
43
    echo "*** KDE requires autoconf $required_autoconf_version"
 
44
    exit 1
 
45
    ;;
 
46
esac
 
47
 
 
48
AUTOHEADER_VERSION=`$AUTOHEADER --version | head -n 1`
 
49
case $AUTOHEADER_VERSION in
 
50
  Autoconf*2.5* | autoheader*2.5* ) : ;;
 
51
  "" )
 
52
    echo "*** AUTOHEADER NOT FOUND!."
 
53
    echo "*** KDE requires autoheader $required_autoconf_version"
 
54
    exit 1
 
55
    ;;
 
56
  * )
 
57
    echo "*** YOU'RE USING $AUTOHEADER_VERSION."
 
58
    echo "*** KDE requires autoheader $required_autoconf_version"
 
59
    exit 1
 
60
    ;;
 
61
esac
 
62
 
 
63
unset UNSERMAKE || :
 
64
 
 
65
AUTOMAKE_STRING=`$AUTOMAKE --version | head -n 1`
 
66
required_automake_version="1.6.1 or newer"
 
67
case $AUTOMAKE_STRING in
 
68
  automake*1.5d* | automake*1.5* | automake*1.5-* )
 
69
    echo "*** YOU'RE USING $AUTOMAKE_STRING."
 
70
    echo "*** KDE requires automake $required_automake_version"
 
71
    exit 1
 
72
    ;;
 
73
  automake*1.6.* | automake*1.7* | automake*1.8* | automake*1.9*) : ;;
 
74
  "" )
 
75
    echo "*** AUTOMAKE NOT FOUND!."
 
76
    echo "*** KDE requires automake $required_automake_version"
 
77
    exit 1
 
78
    ;;
 
79
  *unsermake* ) :
 
80
    echo "*** YOU'RE USING UNSERMAKE."
 
81
    echo "*** GOOD LUCK!! :)"
 
82
    UNSERMAKE=unsermake
 
83
    ;;
 
84
  * )
 
85
    echo "*** YOU'RE USING $AUTOMAKE_STRING."
 
86
    echo "*** KDE requires automake $required_automake_version"
 
87
    exit 1
 
88
    ;;
 
89
esac
 
90
unset required_automake_version
 
91
}
 
92
 
 
93
cvs()
 
94
{
 
95
check_autotool_versions
 
96
acinclude_m4 
 
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 configure.in
 
103
    echo "*** Creating list of subdirectories"
 
104
    create_subdirs
 
105
 
 
106
    if test -r Makefile.am.in; then
 
107
        echo "*** Creating Makefile.am"
 
108
        if grep '\$(top_srcdir)/Makefile.am:' $makefile_am >/dev/null; then 
 
109
            strip_makefile
 
110
            $MAKE -f $makefile_wo top_srcdir=. ./Makefile.am || exit 1
 
111
        else
 
112
            Makefile_am
 
113
        fi
 
114
     fi
 
115
     configure_files
 
116
     echo "*** Creating configure.in"
 
117
     if grep '\$(top_srcdir)/configure.in:' $makefile_am >/dev/null; then 
 
118
       strip_makefile
 
119
       $MAKE -f $makefile_wo top_srcdir=. ./configure.in || exit 1
 
120
     else
 
121
       configure_in
 
122
     fi
 
123
fi
 
124
 
 
125
echo "*** Creating aclocal.m4"
 
126
$ACLOCAL $ACLOCALFLAGS || exit 1
 
127
echo "*** Creating configure"
 
128
call_and_fix_autoconf
 
129
 
 
130
if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then
 
131
  echo "*** Creating config.h template"
 
132
  $AUTOHEADER || exit 1
 
133
fi
 
134
 
 
135
echo "*** Creating Makefile templates"
 
136
$AUTOMAKE || exit 1
 
137
 
 
138
if test -z "$UNSERMAKE"; then
 
139
  echo "*** Postprocessing Makefile templates"
 
140
  perl -w admin/am_edit || exit 1
 
141
fi
 
142
 
 
143
if egrep "^cvs-local:" $makefile_am >/dev/null; then \
 
144
  strip_makefile
 
145
  $MAKE -f $makefile_wo cvs-local top_srcdir=. || exit 1
 
146
fi
 
147
 
 
148
echo "*** Creating date/time stamp"
 
149
touch stamp-h.in
 
150
 
 
151
echo "*** Finished"
 
152
echo "    Don't forget to run ./configure"
 
153
echo "    If you haven't done so in a while, run ./configure --help"
 
154
}
 
155
 
 
156
dist()
 
157
{
 
158
check_autotool_versions
 
159
 
 
160
###
 
161
### First build all of the files necessary to do just "make"
 
162
###
 
163
acinclude_m4
 
164
if test -r configure.in.in; then
 
165
  rm -f configure.in
 
166
  create_subdirs
 
167
 
 
168
  if test -r Makefile.am.in; then
 
169
    if grep '\$(top_srcdir)/Makefile.am:' $makefile_am >/dev/null; then 
 
170
      strip_makefile
 
171
      $MAKE -f $makefile_wo top_srcdir=. ./Makefile.am || exit 1
 
172
    else
 
173
      Makefile_am
 
174
    fi
 
175
  fi
 
176
  configure_files
 
177
  if grep '\$(top_srcdir)/configure.in:' $makefile_am >/dev/null; then 
 
178
    strip_makefile
 
179
    $MAKE -f $makefile_wo top_srcdir=. ./configure.in || exit 1
 
180
  else
 
181
    configure_in
 
182
  fi
 
183
fi
 
184
$ACLOCAL $ACLOCALFLAGS
 
185
if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then
 
186
  echo "*** Creating config.h template"
 
187
  $AUTOHEADER || exit 1
 
188
fi
 
189
$AUTOMAKE --foreign
 
190
if test -z "$UNSERMAKE"; then
 
191
  echo "*** Postprocessing Makefile templates"
 
192
  perl -w admin/am_edit || exit 1
 
193
fi
 
194
call_and_fix_autoconf
 
195
touch stamp-h.in
 
196
if grep "^cvs-local:" $makefile_am >/dev/null; then
 
197
  strip_makefile
 
198
  $MAKE -f $makefile_wo cvs-local top_srcdir=.
 
199
fi
 
200
 
 
201
###
 
202
### Then make messages
 
203
###
 
204
if test -d po; then
 
205
 LIST=`find ./po -name "*.po"`
 
206
 for i in $LIST; do
 
207
  file2=`echo $i | sed -e "s#\.po#\.gmo#"`
 
208
  msgfmt -o $file2 $i || touch $file2
 
209
 done
 
210
fi
 
211
if grep "^cvs-dist-local:" $makefile_am >/dev/null; then
 
212
  strip_makefile
 
213
  $MAKE -f $makefile_wo cvs-dist-local top_srcdir=.
 
214
fi
 
215
}
 
216
 
 
217
subdir_dist()
 
218
{
 
219
$ACLOCAL $ACLOCALFLAGS
 
220
$AUTOHEADER
 
221
$AUTOMAKE
 
222
AUTOMAKE_STRING=`$AUTOMAKE --version | head -n 1`
 
223
case $AUTOMAKE_STRING in
 
224
  *unsermake* ) :
 
225
    ;;
 
226
  *)
 
227
     perl -w ../admin/am_edit --path=../admin
 
228
esac
 
229
call_and_fix_autoconf
 
230
touch stamp-h.in
 
231
}
 
232
 
 
233
configure_in()
 
234
{
 
235
rm -f configure.in configure.in.new
 
236
kde_use_qt_param=
 
237
test -f configure.files || { echo "need configure.files for configure.in"; exit 1; }
 
238
list=`fgrep -v "configure.in.bot" < configure.files | fgrep -v "configure.in.mid"`
 
239
: > configure.in.new
 
240
for file in $list; do 
 
241
  echo "dnl =======================================================" >> configure.in.new
 
242
  echo "dnl FILE: $file" >> configure.in.new
 
243
  echo "dnl =======================================================" >> configure.in.new
 
244
  echo "" >> configure.in.new
 
245
  cat $file >> configure.in.new
 
246
done
 
247
echo "KDE_CREATE_SUBDIRSLIST" >> configure.in.new
 
248
if test -f Makefile.am.in; then
 
249
  subdirs=`cat subdirs`
 
250
  for dir in $subdirs; do
 
251
    vdir=`echo $dir | sed -e 's,[-+.@],_,g'`
 
252
    echo "AM_CONDITIONAL($vdir""_SUBDIR_included, test \"x\$$vdir""_SUBDIR_included\" = xyes)" >> configure.in.new
 
253
    if test -f "$dir/configure.in"; then
 
254
        echo "if test \"x\$$vdir""_SUBDIR_included\" = xyes; then " >> configure.in.new
 
255
        echo "  AC_CONFIG_SUBDIRS($dir)" >> configure.in.new
 
256
        echo "fi" >> configure.in.new
 
257
    fi
 
258
  done
 
259
fi
 
260
 
 
261
echo "AC_CONFIG_FILES([ Makefile ])" >> configure.in.new
 
262
 
 
263
if test -f inst-apps; then
 
264
    topleveldirs=`cat inst-apps`
 
265
else
 
266
    topleveldirs=
 
267
    for dir in `ls -1d * | sort`; do
 
268
        if test "$dir" != "debian" && test -d $dir; then
 
269
            topleveldirs="$topleveldirs $dir"
 
270
        fi
 
271
    done
 
272
fi
 
273
 
 
274
for topleveldir in $topleveldirs; do 
 
275
  if test -f $topleveldir/configure.in; then
 
276
        continue
 
277
  fi
 
278
  if test -f $topleveldir/Makefile.am; then :; else
 
279
        continue
 
280
  fi
 
281
 
 
282
  mfs=`find $topleveldir -follow -name Makefile.am -print | fgrep -v "/." | \
 
283
       sed -e 's#\./##; s#/Makefile.am$##' | sort | sed -e 's#$#/Makefile#'`
 
284
  for i in $mfs; do
 
285
     echo "AC_CONFIG_FILES([ $i ])" >> configure.in.new
 
286
  done
 
287
done
 
288
 
 
289
files=`cat configure.files`
 
290
list=`egrep '^dnl AC_OUTPUT\(.*\)' $files | sed -e "s#^.*dnl AC_OUTPUT(\(.*\))#\1#"`
 
291
for file in $list; do 
 
292
    echo "AC_CONFIG_FILES([ $file ])" >>  configure.in.new
 
293
done
 
294
 
 
295
midfiles=`cat configure.files | fgrep "configure.in.mid"`
 
296
test -n "$midfiles" && cat $midfiles >> configure.in.new
 
297
 
 
298
echo "AC_OUTPUT" >> configure.in.new
 
299
modulename=
 
300
if test -f configure.in.in; then
 
301
   if head -n 2 configure.in.in | egrep "^#MIN_CONFIG\(.*\)$" > /dev/null; then
 
302
      kde_use_qt_param=`cat configure.in.in | sed -n -e "s/#MIN_CONFIG(\(.*\))/\1/p"`
 
303
   fi
 
304
   if head -n 2 configure.in.in | egrep "^#MIN_CONFIG" > /dev/null; then
 
305
      line=`grep "^AM_INIT_AUTOMAKE(" configure.in.in`
 
306
      if test -n "$line"; then
 
307
          modulename=`echo $line | sed -e "s#AM_INIT_AUTOMAKE(\([^,]*\),.*#\1#"`
 
308
          VERSION=`echo $line | sed -e "s#AM_INIT_AUTOMAKE([^,]*, *\([^)]*\)).*#\1#"`
 
309
      fi
 
310
      sed -e "s#AM_INIT_AUTOMAKE([^@].*#dnl PACKAGE set before#" \
 
311
          configure.in.new > configure.in && mv configure.in configure.in.new
 
312
   fi
 
313
fi
 
314
if test -z "$VERSION" || test "$VERSION" = "@VERSION@"; then
 
315
     VERSION="\"3.3.92\""
 
316
fi
 
317
if test -z "$modulename" || test "$modulename" = "@MODULENAME@"; then
 
318
   modulename=`pwd`; 
 
319
   modulename=`basename $modulename`
 
320
   esc_VERSION=`echo $VERSION | sed -e "s#[^.0-9a-zA-Z]##g"`
 
321
   modulename=`echo $modulename | sed -e "s#-$esc_VERSION##"`   
 
322
 
 
323
fi
 
324
if test -n "$kde_use_qt_param"; then
 
325
      sed -e "s#^dnl KDE_USE_QT#KDE_USE_QT($kde_use_qt_param)#" \
 
326
        configure.in.new > configure.in && mv configure.in configure.in.new
 
327
fi
 
328
sed -e "s#@MODULENAME@#$modulename#" configure.in.new |
 
329
        sed -e "s#@VERSION@#$VERSION#" > configure.in
 
330
botfiles=`cat configure.files | egrep "configure.in.bot"`
 
331
test -n "$botfiles" && cat $botfiles >> configure.in
 
332
cat $admindir/configure.in.bot.end >> configure.in
 
333
rm -f configure.in.new
 
334
}
 
335
 
 
336
configure_files()
 
337
{
 
338
echo "*** Creating configure.files"
 
339
admindir=NO
 
340
for i in . .. ../.. ../../..; do
 
341
  if test -x $i/admin; then admindir=$i/admin; break; fi
 
342
done
 
343
rm -f configure.files
 
344
touch configure.files
 
345
if test -f configure.in.in && head -n 2 configure.in.in | grep "^#MIN_CONFIG" > /dev/null; then
 
346
        echo $admindir/configure.in.min >> configure.files
 
347
fi
 
348
test -f configure.in.in && echo configure.in.in >> configure.files
 
349
# we collect files in the subdirs and do some sorting tricks, so subsubdirs come after subdirs
 
350
if test -f inst-apps; then
 
351
   inst=`cat inst-apps`
 
352
   list=""
 
353
   for i in $inst; do
 
354
      list="$list `find $i/ -follow -name "configure.in.in" -o -name "configure.in.bot" -o -name "configure.in.mid" | \
 
355
                sed -e "s,/configure,/aaaconfigure," | sort | sed -e "s,/aaaconfigure,/configure,"`"
 
356
   done
 
357
else
 
358
   list=`find . -follow -name "configure.in.in" -o -name "configure.in.bot" -o -name "configure.in.mid" | \
 
359
                sed -e "s,/configure,/aaaconfigure," | sort | sed -e "s,/aaaconfigure,/configure,"`
 
360
fi
 
361
for i in $list; do if test -f $i && test `dirname $i` != "." ; then
 
362
  echo $i >> configure.files
 
363
fi; done
 
364
test -f configure.in.mid && echo configure.in.mid >> configure.files
 
365
test -f configure.in.bot && echo configure.in.bot >> configure.files
 
366
if test ! -s configure.files; then
 
367
   echo "There are no files to build a configure. Please check your checkout."
 
368
   exit 1
 
369
fi
 
370
}
 
371
 
 
372
create_subdirs()
 
373
{
 
374
if grep '\$(top_srcdir)/subdirs:' $makefile_am >/dev/null; then 
 
375
    # as many modules contain rules to create subdirs without any
 
376
    # dependencies make won't create it unless there is no file.
 
377
    # so we check if that's a dummy rule or one that works
 
378
    rm -f subdirs.cvs.sh.$$
 
379
    if test -f subdirs; then
 
380
        mv subdirs subdirs.cvs.sh.$$
 
381
    fi
 
382
    strip_makefile
 
383
    $MAKE -f $makefile_wo top_srcdir=. ./subdirs || exit 1
 
384
    if test -f subdirs.cvs.sh.$$; then
 
385
        if test -s subdirs; then
 
386
            rm subdirs.cvs.sh.$$ 
 
387
        else
 
388
            mv subdirs.cvs.sh.$$ subdirs
 
389
        fi
 
390
    fi
 
391
else
 
392
    subdirs
 
393
fi
 
394
}
 
395
 
 
396
subdirs()
 
397
{
 
398
dirs=
 
399
idirs=
 
400
if test -f inst-apps; then
 
401
   idirs=`cat inst-apps`
 
402
else
 
403
   idirs=`ls -1 | sort`
 
404
fi
 
405
 
 
406
compilefirst=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' $makefile_am | head -n 1`
 
407
compilelast=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' $makefile_am | head -n 1`
 
408
for i in $idirs; do
 
409
    if test -f $i/Makefile.am; then
 
410
       case " $compilefirst $compilelast " in
 
411
         *" $i "*) ;;
 
412
         *) dirs="$dirs $i"
 
413
       esac
 
414
    fi
 
415
done
 
416
 
 
417
: > ./_SUBDIRS
 
418
 
 
419
for d in $compilefirst; do
 
420
   echo $d >> ./_SUBDIRS
 
421
done
 
422
 
 
423
(for d in $dirs; do 
 
424
   list=`sed -ne "s#^COMPILE_BEFORE_$d""[ ]*=[ ]*##p" $makefile_am | head -n 1`
 
425
   for s in $list; do
 
426
      echo $s $d
 
427
   done
 
428
   list=`sed -ne "s#^COMPILE_AFTER_$d""[ ]*=[ ]*##p" $makefile_am | head -n 1`
 
429
   for s in $list; do
 
430
      echo $d $s
 
431
   done
 
432
   echo $d $d
 
433
done ) | tsort >> ./_SUBDIRS
 
434
 
 
435
for d in $compilelast; do
 
436
   echo $d >> ./_SUBDIRS
 
437
done
 
438
 
 
439
if test -r subdirs && cmp -s subdirs _SUBDIRS; then
 
440
    rm -f _SUBDIRS
 
441
fi
 
442
test -r _SUBDIRS && mv _SUBDIRS subdirs || true
 
443
}
 
444
 
 
445
Makefile_am()
 
446
{
 
447
if test -f Makefile.am.in; then
 
448
  compilefirst=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' $makefile_am | head -n 1`
 
449
  compilelast=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' $makefile_am | head -n 1`
 
450
 
 
451
  idirs=
 
452
  dirs=
 
453
  if test -f inst-apps; then
 
454
     idirs=`cat inst-apps`
 
455
  else
 
456
     idirs=`cat subdirs`
 
457
  fi
 
458
  for i in $idirs; do
 
459
    case " $compilefirst $compilelast " in
 
460
      *" $i "*) ;;
 
461
      *) dirs="$dirs $i"
 
462
    esac
 
463
  done
 
464
 
 
465
  adds=`fgrep '$(top_srcdir)/acinclude.m4:' Makefile.am.in | sed -e 's,^[^:]*: *,,; s,\$(top_srcdir)/,,g'`
 
466
  if echo "$adds" | fgrep "*" >/dev/null ; then
 
467
    adds=`ls -d -1 $adds 2>/dev/null`
 
468
    fgrep -v  '$(top_srcdir)/acinclude.m4:' Makefile.am.in > Makefile.am.in.adds
 
469
    str='$(top_srcdir)/acinclude.m4:'
 
470
    for add in $adds; do 
 
471
        str="$str \$(top_srcdir)/$add"
 
472
    done
 
473
    echo $str >> Makefile.am.in.adds
 
474
  else
 
475
    cat Makefile.am.in > Makefile.am.in.adds
 
476
  fi
 
477
 
 
478
  cat Makefile.am.in.adds | \
 
479
      sed -e 's,^\s*\(COMPILE_BEFORE.*\),# \1,' | \
 
480
      sed -e 's,^\s*\(COMPILE_AFTER.*\),# \1,' > Makefile.am
 
481
    echo "SUBDIRS="'$(TOPSUBDIRS)' >> Makefile.am
 
482
  rm Makefile.am.in.adds
 
483
fi
 
484
}
 
485
 
 
486
acinclude_m4()
 
487
{
 
488
  echo "*** Creating acinclude.m4"
 
489
  adds=
 
490
  if grep '\$(top_srcdir)/acinclude.m4:' $makefile_am >/dev/null; then 
 
491
    strip_makefile
 
492
    rm -f acinclude.m4
 
493
    adds=`grep '\$(top_srcdir)/acinclude.m4:' $makefile_wo | sed -e 's,^[^:]*: *,,; s,\$(top_srcdir),.,g'`
 
494
    if echo $adds | fgrep "*" >/dev/null ; then
 
495
      adds=`ls -d -1 $adds 2>/dev/null`
 
496
    else
 
497
      $MAKE -f $makefile_wo top_srcdir=. ./acinclude.m4 || exit 1
 
498
    fi
 
499
  else
 
500
    rm -f acinclude.m4
 
501
  fi
 
502
  # if it wasn't created up to now, then we do it better
 
503
  if test ! -f acinclude.m4; then
 
504
     cat admin/acinclude.m4.in admin/libtool.m4.in admin/pkg.m4.in $adds > acinclude.m4
 
505
  fi
 
506
}
 
507
 
 
508
cvs_clean()
 
509
{
 
510
if test -d CVS; then :; else
 
511
  echo "You don't have a toplevel CVS directory."
 
512
  echo "You most certainly didn't use cvs to get these sources."
 
513
  echo "But this function depends on cvs's information."
 
514
  exit 1
 
515
fi
 
516
perl $admindir/cvs-clean.pl
 
517
}
 
518
 
 
519
package_merge()
 
520
{
 
521
catalogs=$POFILES
 
522
for cat in $catalogs; do
 
523
  msgmerge -o $cat.new $cat $PACKAGE.pot
 
524
  if test -s $cat.new; then
 
525
    grep -v "\"POT-Creation" $cat.new > $cat.new.2
 
526
    grep -v "\"POT-Creation" $cat >> $cat.new.1
 
527
    if diff $cat.new.1 $cat.new.2; then
 
528
        rm $cat.new
 
529
    else
 
530
        mv $cat.new $cat
 
531
    fi
 
532
    rm -f $cat.new.1 $cat.new.2
 
533
  fi
 
534
done
 
535
}
 
536
 
 
537
extract_messages()
 
538
{
 
539
podir=${podir:-$PWD/po}
 
540
files=`find . -name Makefile.am | xargs egrep -l '^messages:' `
 
541
dirs=`for i in $files; do echo \`dirname $i\`; done`
 
542
tmpname="$PWD/messages.log"
 
543
if test -z "$EXTRACTRC"; then EXTRACTRC=extractrc ; fi
 
544
if test -z "$PREPARETIPS"; then PREPARETIPS=preparetips ; fi
 
545
export EXTRACTRC PREPARETIPS
 
546
 
 
547
for subdir in $dirs; do
 
548
  test -z "$VERBOSE" || echo "Making messages in $subdir"
 
549
  (cd $subdir
 
550
   if test -n "`grep -e '^messages:.*rc.cpp' Makefile.am`"; then
 
551
        $EXTRACTRC *.rc *.ui *.kcfg > rc.cpp
 
552
   else
 
553
        candidates=`ls -1 *.rc *.ui *.kcfg 2>/dev/null`
 
554
        if test -n "$candidates"; then
 
555
            echo "$subdir has *.rc, *.ui or *.kcfg files, but not correct messages line"
 
556
        fi
 
557
   fi
 
558
   if find . -name \*.c\* -o -name \*.h\* | xargs fgrep -s -q KAboutData ; then
 
559
        echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp
 
560
   else echo " " > _translatorinfo.cpp
 
561
   fi
 
562
   perl -e '$mes=0; while (<STDIN>) { next if (/^(if\s|else\s|endif)/); if (/^messages:/) { $mes=1; print $_; next; } if ($mes) { if (/$\\(XGETTEXT\)/ && / -o/) { s/ -o \$\(podir\)/ _translatorinfo.cpp -o \$\(podir\)/ } print $_; } else { print $_; } }' < Makefile.am | egrep -v '^include ' > _transMakefile
 
563
 
 
564
   kdepotpath=${includedir:-${KDEDIR:-`kde-config --prefix`}/include}/kde.pot
 
565
 
 
566
   $MAKE -s -f _transMakefile podir=$podir EXTRACTRC="$EXTRACTRC" PREPARETIPS="$PREPARETIPS" srcdir=. \
 
567
        XGETTEXT="${XGETTEXT:-xgettext} --foreign-user -C -ci18n -ki18n -ktr2i18n -kI18N_NOOP -kI18N_NOOP2 -kaliasLocale -x $kdepotpath" messages
 
568
   exit_code=$?
 
569
   if test "$exit_code" != 0; then
 
570
       echo "make exit code: $exit_code"
 
571
   fi
 
572
   ) 2>&1 | grep -v '^make\[1\]' > $tmpname
 
573
   test -s $tmpname && { echo $subdir ; cat "$tmpname"; }
 
574
   test -f $subdir/rc.cpp && rm -f $subdir/rc.cpp
 
575
   rm -f $subdir/_translatorinfo.cpp
 
576
   rm -f $subdir/_transMakefile
 
577
done
 
578
rm -f $tmpname
 
579
}
 
580
 
 
581
package_messages()
 
582
{
 
583
rm -rf po.backup
 
584
mkdir po.backup
 
585
 
 
586
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
 
587
  egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > po.backup/$i
 
588
  cat po/$i > po.backup/backup_$i
 
589
  touch -r po/$i po.backup/backup_$i
 
590
  rm po/$i
 
591
done
 
592
 
 
593
extract_messages
 
594
 
 
595
for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do
 
596
  test -f po/$i || echo "disappeared: $i"
 
597
done
 
598
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
 
599
   sed -e 's,^"Content-Type: text/plain; charset=CHARSET\\n"$,"Content-Type: text/plain; charset=UTF-8\\n",' po/$i > po/$i.new && mv po/$i.new po/$i
 
600
   #msgmerge -q -o po/$i po/$i po/$i
 
601
   egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > temp.pot
 
602
  if test -f po.backup/$i && ! cmp -s temp.pot po.backup/$i; then
 
603
        echo "will update $i"
 
604
  else
 
605
    if test -f po.backup/backup_$i; then
 
606
      test -z "$VERBOSE" || echo "I'm restoring $i"
 
607
      mv po.backup/backup_$i po/$i
 
608
      rm po.backup/$i
 
609
    else
 
610
      echo "will add $i"
 
611
    fi
 
612
  fi
 
613
done
 
614
rm -f temp.pot
 
615
rm -rf po.backup
 
616
}
 
617
 
 
618
unset LC_ALL || :
 
619
unset LANG || :
 
620
unset LC_CTYPE || :
 
621
unset LANGUAGE || :
 
622
 
 
623
unset CDPATH || :
 
624
admindir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
 
625
test "x$admindir" = "x$0" && admindir=.
 
626
 
 
627
test "x$MAKE" = x && MAKE=make
 
628
makefile_am=Makefile.am
 
629
makefile_wo=Makefile.am.wo
 
630
if test -f Makefile.am.in; then
 
631
  makefile_am=Makefile.am.in
 
632
  makefile_wo=Makefile.am.in.wo
 
633
  rm -f $makefile_wo
 
634
fi
 
635
 
 
636
# Suck in the AUTOCONF detection code
 
637
. $admindir/detect-autoconf.sh
 
638
 
 
639
###
 
640
### Main
 
641
###
 
642
 
 
643
arg=`echo $1 | tr .- __`
 
644
case $arg in
 
645
  cvs | dist | subdir_dist | configure_in | configure_files | subdirs | \
 
646
  cvs_clean | package_merge | package_messages | Makefile_am | acinclude_m4 | extract_messages ) $arg ;;
 
647
  configure ) call_and_fix_autoconf ;;
 
648
  * ) echo "Usage: cvs.sh <target>"
 
649
      echo "Target can be one of:"
 
650
      echo "    cvs cvs-clean dist"
 
651
      echo "    configure.in configure.files"
 
652
      echo "    package-merge package-messages"
 
653
      echo ""
 
654
      echo "Usage: anything but $1"
 
655
      exit 1 ;;
 
656
esac
 
657
 
 
658
if test -f $makefile_wo; then
 
659
  rm $makefile_wo
 
660
fi
 
661
 
 
662
exit 0