Subversion Repositories Scribus

Rev

Rev 5934 | Details | Compare with Previous | Last modification | View Log | RSS feed

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