annotate kdiff3/admin/cvs.sh @ 14:415083d043f3

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