* util/kbuild: complete rewrite.
authorMark Eichin <eichin@mit.edu>
Fri, 30 Sep 1994 00:00:42 +0000 (00:00 +0000)
committerMark Eichin <eichin@mit.edu>
Fri, 30 Sep 1994 00:00:42 +0000 (00:00 +0000)
* util/kfrags: fragments of input to kbuild.

See top of util/kbuild for instructions.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4390 dc483132-0cff-0310-8789-dd5450dbe970

src/util/ChangeLog [new file with mode: 0644]
src/util/kbuild

diff --git a/src/util/ChangeLog b/src/util/ChangeLog
new file mode 100644 (file)
index 0000000..9f07edf
--- /dev/null
@@ -0,0 +1,5 @@
+Thu Sep 29 19:54:38 1994  Mark Eichin  (eichin@cygnus.com)
+
+       * util/kbuild: complete rewrite.
+       * util/kfrags: fragments of input to kbuild.
+
index 7a32dab88158d33ddd769ff370373f5360ecc4c7..621c1e1b1c52d0afc494cbc7c25fcf838b458414 100644 (file)
@@ -4,25 +4,69 @@
 # configuration file to control which support programs are used to
 # compile it, which options are given to configure, etc.
 #
+# usage: kbuild { [ frag ] [ var=value ] [ config-lib-path ] }
+#    where frag is something like base, or gcc, or cns, where it finds
+#    base.conf in the config lib path
+#    var=value sets var to value in the script processing (useful to override
+#    SRCDIR or KRB4)
+#    config-lib-path adds itself to the search path for frags.
+#
+#
+# frags themselves are files named frag.conf which have variable settings
+# and filenames. # is a comment marker. If the line is an assignment, it's
+# read; if it begins with /, it's an explicit member of the path; if it 
+# doesn't, it's searched for in the path set in the last fragment.
+#
+# for example, at mit, one might say
+#
+# /mit/krb5/sandbox/util/kbuild base suncc athena
+#
+# or at cygnus, one might say
+#
+# /6h/eichin/mit-v5/build/base/util/kbuild base gcc cns
+#
+# You get the idea.
+#
+# -- Mark Eichin <eichin@cygnus.com> This file is in the Public Domain.
+#
+
+progname=$0
+pts="`echo ${progname} | sed 's=[^/]*$=='`"
 
-CONFIG=$1
+conflib=". $pts/kfrags"
+
+THISCONF=./kbuild.temp
+rm -f $THISCONF
 BUILD_PATH=./build-path
+rm -rf $BUILD_PATH
+
 
-if [ ${CONFIG}x = x ]; then
-       echo "You must specify an build configuration file!"
-       exit 1
-fi
 
+for arg
+do
+  case "$arg" in
+  /*)  conflib="$arg $conflib" ;;
+  ..*) conflib="$arg $conflib" ;;
+  *=*)  echo $arg >> $THISCONF ;;
+  *)
+         for p in $conflib
+         do
+               frag=$p/$arg.conf
+               if test -r $frag ; then
+                       break
+               fi
+         done
+         echo "# $frag" >> $THISCONF
+         awk '/^#/ { next; } /^[ \t]*$/ {next; }/^[a-zA-Z0-9_]+=.*$/ { print; next; } /^\// { print "ABS_PROGS=\"${ABS_PROGS} "$0"\""; next; } { print "CMD_PROGS=\"${CMD_PROGS} "$0"\""; next; }' < $frag | sed -e 's/^PATH=/XPATH=/' >> $THISCONF
+       ;;
+  esac
+done
 
-SRCDIR=`sed -e '/^SRCDIR:/!d' -e 's/SRCDIR: *//' $CONFIG`
-CONFIG_OPTS=`sed -e '/^CONFIG_OPTS:/!d' -e 's/CONFIG_OPTS: *//' $CONFIG`
-CC=`sed -e '/^CC:/!d' -e 's/CC: *//' $CONFIG`
-CC_OPTS=`sed -e '/^CC_OPTS:/!d' -e 's/CC_OPTS: *//' $CONFIG`
-KRB4=`sed -e '/^KRB4:/!d' -e 's/KRB4: *//' $CONFIG`
+# echo ==== THISCONF: =====
+# cat $THISCONF
+# echo --------------------
+. $THISCONF
 
-CMD_PROGS=`cat $CONFIG | sed -e '1,/BEGIN CMD_LIST/d' \
-                              -e '/END CMD_LIST/,$d' \
-                              -e '/^$/d' -e '/^\#/d'`
 
 if test ${CC}x != "x"
 then
@@ -45,7 +89,41 @@ cd $BUILD_PATH
 
 for i in $CMD_PROGS
 do
-       ln -s $i
+missed=true
+# echo "trying cmdprog $i"
+       for p in `echo $XPATH | sed 's/:/ /g'`
+       do
+# echo "trying cmdprog $i in path element $p"
+               if test -x $p/$i ; then
+                       if test -x $i ; then
+# echo "nuking $i"
+                               rm $i
+                       fi
+# echo "linking $p/$i"
+                       ln -s $p/$i
+                       missed=false
+                       break
+               fi
+       done
+if $missed ; then
+       echo "COULDN'T FIND $i in $XPATH"
+fi
+done
+
+for i in $ABS_PROGS
+do
+       if test -x $i ; then
+# echo "trying absprog $i"
+       base=`echo $i | sed 's-^.*/\([^/]*\)$-\1-p'`
+       if test -x $base ; then
+               rm $base
+# echo "nuking $base"
+       fi
+# echo "linking $i"
+       ln -s $i 
+       else
+               echo "COULDN'T FIND $i"
+       fi
 done
 
 cd ..
@@ -54,6 +132,7 @@ PATH=`pwd`/$BUILD_PATH
 export PATH
 echo "Build path is $PATH"
 
+echo "configuring with: $SRCDIR/configure $CONFIG_OPTS"
 $SRCDIR/configure $CONFIG_OPTS
 
 echo "Configuration done.  Building using the command:"