Subversion Repositories Scribus

Rev

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