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